[TS] Update auto-generated TS bindings to 0.0.113
[ldk-java] / ts / bindings.c
1 #define LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ
2 #define CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free CVec_TransactionOutputsZ_free
3 #include "js-wasm.h"
4 #include <stdatomic.h>
5 #include <lightning.h>
6
7 // These should be provided...somehow...
8 void *memset(void *s, int c, size_t n);
9 void *memcpy(void *dest, const void *src, size_t n);
10 int memcmp(const void *s1, const void *s2, size_t n);
11
12 extern void __attribute__((noreturn)) abort(void);
13 static inline void assert(bool expression) {
14         if (!expression) { abort(); }
15 }
16
17 uint32_t __attribute__((export_name("test_bigint_pass_deadbeef0badf00d"))) test_bigint_pass_deadbeef0badf00d(uint64_t val) {
18         return val == 0xdeadbeef0badf00dULL;
19 }
20
21
22 void *malloc(size_t size);
23 void free(void *ptr);
24
25 #define MALLOC(a, _) malloc(a)
26 #define do_MALLOC(a, _b, _c) malloc(a)
27 #define FREE(p) if ((unsigned long)(p) > 4096) { free(p); }
28 #define DO_ASSERT(a) (void)(a)
29 #define CHECK(a)
30 #define CHECK_ACCESS(p)
31 #define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
32
33 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
34 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
35 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
36 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
37
38 _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits");
39
40 #define DECL_ARR_TYPE(ty, name) \
41         struct name##array { \
42                 uint64_t arr_len; /* uint32_t would suffice but we want to align uint64_ts as well */ \
43                 ty elems[]; \
44         }; \
45         typedef struct name##array * name##Array; \
46         static inline name##Array init_##name##Array(size_t arr_len, int lineno) { \
47                 name##Array arr = (name##Array)do_MALLOC(arr_len * sizeof(ty) + sizeof(uint64_t), #name" array init", lineno); \
48                 arr->arr_len = arr_len; \
49                 return arr; \
50         }
51
52 DECL_ARR_TYPE(int64_t, int64_t);
53 DECL_ARR_TYPE(uint64_t, uint64_t);
54 DECL_ARR_TYPE(int8_t, int8_t);
55 DECL_ARR_TYPE(uint32_t, uint32_t);
56 DECL_ARR_TYPE(void*, ptr);
57 DECL_ARR_TYPE(char, char);
58 typedef charArray jstring;
59
60 static inline jstring str_ref_to_ts(const char* chars, size_t len) {
61         charArray arr = init_charArray(len, __LINE__);
62         memcpy(arr->elems, chars, len);
63         return arr;
64 }
65 static inline LDKStr str_ref_to_owned_c(const jstring str) {
66         char* newchars = MALLOC(str->arr_len + 1, "String chars");
67         memcpy(newchars, str->elems, str->arr_len);
68         newchars[str->arr_len] = 0;
69         LDKStr res = {
70                 .chars = newchars,
71                 .len = str->arr_len,
72                 .chars_is_owned = true
73         };
74         return res;
75 }
76
77 typedef bool jboolean;
78
79 uint32_t __attribute__((export_name("TS_malloc"))) TS_malloc(uint32_t size) {
80         return (uint32_t)MALLOC(size, "JS-Called malloc");
81 }
82 void __attribute__((export_name("TS_free"))) TS_free(uint32_t ptr) {
83         FREE((void*)ptr);
84 }
85
86 jstring __attribute__((export_name("TS_get_ldk_c_bindings_version"))) TS_get_ldk_c_bindings_version() {
87         const char *res = check_get_ldk_bindings_version();
88         if (res == NULL) return NULL;
89         return str_ref_to_ts(res, strlen(res));
90 }
91 jstring __attribute__((export_name("TS_get_ldk_version"))) get_ldk_version() {
92         const char *res = check_get_ldk_version();
93         if (res == NULL) return NULL;
94         return str_ref_to_ts(res, strlen(res));
95 }
96 #include "version.c"
97 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
98
99 static inline void* untag_ptr(uint64_t ptr) {
100         if (ptr < 4096) return (void*)ptr;
101         if (sizeof(void*) == 4) {
102                 // For 32-bit systems, store pointers as 64-bit ints and use the 31st bit
103                 return (void*)(uintptr_t)ptr;
104         } else {
105                 // For 64-bit systems, assume the top byte is used for tagging, then
106                 // use bit 9 ^ bit 10.
107                 uint64_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
108                 uintptr_t p = (ptr & ~(1ULL << 55)) | (tenth_bit << 55);
109 #ifdef LDK_DEBUG_BUILD
110                 // On debug builds we also use the 11th bit as a debug flag
111                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
112                 CHECK(tenth_bit != eleventh_bit);
113                 p ^= 1ULL << 53;
114 #endif
115                 return (void*)p;
116         }
117 }
118 static inline bool ptr_is_owned(uint64_t ptr) {
119         if(ptr < 4096) return true;
120         if (sizeof(void*) == 4) {
121                 return ptr & (1ULL << 32);
122         } else {
123                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
124                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
125 #ifdef LDK_DEBUG_BUILD
126                 // On debug builds we also use the 11th bit as a debug flag
127                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
128                 CHECK(tenth_bit != eleventh_bit);
129 #endif
130                 return (ninth_bit ^ tenth_bit) ? true : false;
131         }
132 }
133 static inline uint64_t tag_ptr(const void* ptr, bool is_owned) {
134         if ((uintptr_t)ptr < 4096) return (uint64_t)ptr;
135         if (sizeof(void*) == 4) {
136                 return (((uint64_t)ptr) | ((is_owned ? 1ULL : 0) << 32));
137         } else {
138                 CHECK(sizeof(uintptr_t) == 8);
139                 uintptr_t tenth_bit = (((uintptr_t)ptr) & (1ULL << 54)) >> 54;
140                 uintptr_t t = (((uintptr_t)ptr) | (((is_owned ? 1ULL : 0ULL) ^ tenth_bit) << 55));
141 #ifdef LDK_DEBUG_BUILD
142                 uintptr_t ninth_bit = (((uintptr_t)ptr) & (1ULL << 55)) >> 55;
143                 uintptr_t eleventh_bit = (((uintptr_t)ptr) & (1ULL << 53)) >> 53;
144                 CHECK(ninth_bit == tenth_bit);
145                 CHECK(ninth_bit == eleventh_bit);
146                 t ^= 1ULL << 53;
147 #endif
148                 CHECK(ptr_is_owned(t) == is_owned);
149                 CHECK(untag_ptr(t) == ptr);
150                 return t;
151         }
152 }
153
154 static inline LDKAccessError LDKAccessError_from_js(int32_t ord) {
155         switch (ord) {
156                 case 0: return LDKAccessError_UnknownChain;
157                 case 1: return LDKAccessError_UnknownTx;
158         }
159         abort();
160 }
161 static inline int32_t LDKAccessError_to_js(LDKAccessError val) {
162         switch (val) {
163                 case LDKAccessError_UnknownChain: return 0;
164                 case LDKAccessError_UnknownTx: return 1;
165                 default: abort();
166         }
167 }
168 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_js(int32_t ord) {
169         switch (ord) {
170                 case 0: return LDKCOption_NoneZ_Some;
171                 case 1: return LDKCOption_NoneZ_None;
172         }
173         abort();
174 }
175 static inline int32_t LDKCOption_NoneZ_to_js(LDKCOption_NoneZ val) {
176         switch (val) {
177                 case LDKCOption_NoneZ_Some: return 0;
178                 case LDKCOption_NoneZ_None: return 1;
179                 default: abort();
180         }
181 }
182 static inline LDKChannelMonitorUpdateStatus LDKChannelMonitorUpdateStatus_from_js(int32_t ord) {
183         switch (ord) {
184                 case 0: return LDKChannelMonitorUpdateStatus_Completed;
185                 case 1: return LDKChannelMonitorUpdateStatus_InProgress;
186                 case 2: return LDKChannelMonitorUpdateStatus_PermanentFailure;
187         }
188         abort();
189 }
190 static inline int32_t LDKChannelMonitorUpdateStatus_to_js(LDKChannelMonitorUpdateStatus val) {
191         switch (val) {
192                 case LDKChannelMonitorUpdateStatus_Completed: return 0;
193                 case LDKChannelMonitorUpdateStatus_InProgress: return 1;
194                 case LDKChannelMonitorUpdateStatus_PermanentFailure: return 2;
195                 default: abort();
196         }
197 }
198 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
199         switch (ord) {
200                 case 0: return LDKConfirmationTarget_Background;
201                 case 1: return LDKConfirmationTarget_Normal;
202                 case 2: return LDKConfirmationTarget_HighPriority;
203         }
204         abort();
205 }
206 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
207         switch (val) {
208                 case LDKConfirmationTarget_Background: return 0;
209                 case LDKConfirmationTarget_Normal: return 1;
210                 case LDKConfirmationTarget_HighPriority: return 2;
211                 default: abort();
212         }
213 }
214 static inline LDKCreationError LDKCreationError_from_js(int32_t ord) {
215         switch (ord) {
216                 case 0: return LDKCreationError_DescriptionTooLong;
217                 case 1: return LDKCreationError_RouteTooLong;
218                 case 2: return LDKCreationError_TimestampOutOfBounds;
219                 case 3: return LDKCreationError_InvalidAmount;
220                 case 4: return LDKCreationError_MissingRouteHints;
221         }
222         abort();
223 }
224 static inline int32_t LDKCreationError_to_js(LDKCreationError val) {
225         switch (val) {
226                 case LDKCreationError_DescriptionTooLong: return 0;
227                 case LDKCreationError_RouteTooLong: return 1;
228                 case LDKCreationError_TimestampOutOfBounds: return 2;
229                 case LDKCreationError_InvalidAmount: return 3;
230                 case LDKCreationError_MissingRouteHints: return 4;
231                 default: abort();
232         }
233 }
234 static inline LDKCurrency LDKCurrency_from_js(int32_t ord) {
235         switch (ord) {
236                 case 0: return LDKCurrency_Bitcoin;
237                 case 1: return LDKCurrency_BitcoinTestnet;
238                 case 2: return LDKCurrency_Regtest;
239                 case 3: return LDKCurrency_Simnet;
240                 case 4: return LDKCurrency_Signet;
241         }
242         abort();
243 }
244 static inline int32_t LDKCurrency_to_js(LDKCurrency val) {
245         switch (val) {
246                 case LDKCurrency_Bitcoin: return 0;
247                 case LDKCurrency_BitcoinTestnet: return 1;
248                 case LDKCurrency_Regtest: return 2;
249                 case LDKCurrency_Simnet: return 3;
250                 case LDKCurrency_Signet: return 4;
251                 default: abort();
252         }
253 }
254 static inline LDKHTLCClaim LDKHTLCClaim_from_js(int32_t ord) {
255         switch (ord) {
256                 case 0: return LDKHTLCClaim_OfferedTimeout;
257                 case 1: return LDKHTLCClaim_OfferedPreimage;
258                 case 2: return LDKHTLCClaim_AcceptedTimeout;
259                 case 3: return LDKHTLCClaim_AcceptedPreimage;
260                 case 4: return LDKHTLCClaim_Revocation;
261         }
262         abort();
263 }
264 static inline int32_t LDKHTLCClaim_to_js(LDKHTLCClaim val) {
265         switch (val) {
266                 case LDKHTLCClaim_OfferedTimeout: return 0;
267                 case LDKHTLCClaim_OfferedPreimage: return 1;
268                 case LDKHTLCClaim_AcceptedTimeout: return 2;
269                 case LDKHTLCClaim_AcceptedPreimage: return 3;
270                 case LDKHTLCClaim_Revocation: return 4;
271                 default: abort();
272         }
273 }
274 static inline LDKIOError LDKIOError_from_js(int32_t ord) {
275         switch (ord) {
276                 case 0: return LDKIOError_NotFound;
277                 case 1: return LDKIOError_PermissionDenied;
278                 case 2: return LDKIOError_ConnectionRefused;
279                 case 3: return LDKIOError_ConnectionReset;
280                 case 4: return LDKIOError_ConnectionAborted;
281                 case 5: return LDKIOError_NotConnected;
282                 case 6: return LDKIOError_AddrInUse;
283                 case 7: return LDKIOError_AddrNotAvailable;
284                 case 8: return LDKIOError_BrokenPipe;
285                 case 9: return LDKIOError_AlreadyExists;
286                 case 10: return LDKIOError_WouldBlock;
287                 case 11: return LDKIOError_InvalidInput;
288                 case 12: return LDKIOError_InvalidData;
289                 case 13: return LDKIOError_TimedOut;
290                 case 14: return LDKIOError_WriteZero;
291                 case 15: return LDKIOError_Interrupted;
292                 case 16: return LDKIOError_Other;
293                 case 17: return LDKIOError_UnexpectedEof;
294         }
295         abort();
296 }
297 static inline int32_t LDKIOError_to_js(LDKIOError val) {
298         switch (val) {
299                 case LDKIOError_NotFound: return 0;
300                 case LDKIOError_PermissionDenied: return 1;
301                 case LDKIOError_ConnectionRefused: return 2;
302                 case LDKIOError_ConnectionReset: return 3;
303                 case LDKIOError_ConnectionAborted: return 4;
304                 case LDKIOError_NotConnected: return 5;
305                 case LDKIOError_AddrInUse: return 6;
306                 case LDKIOError_AddrNotAvailable: return 7;
307                 case LDKIOError_BrokenPipe: return 8;
308                 case LDKIOError_AlreadyExists: return 9;
309                 case LDKIOError_WouldBlock: return 10;
310                 case LDKIOError_InvalidInput: return 11;
311                 case LDKIOError_InvalidData: return 12;
312                 case LDKIOError_TimedOut: return 13;
313                 case LDKIOError_WriteZero: return 14;
314                 case LDKIOError_Interrupted: return 15;
315                 case LDKIOError_Other: return 16;
316                 case LDKIOError_UnexpectedEof: return 17;
317                 default: abort();
318         }
319 }
320 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
321         switch (ord) {
322                 case 0: return LDKLevel_Gossip;
323                 case 1: return LDKLevel_Trace;
324                 case 2: return LDKLevel_Debug;
325                 case 3: return LDKLevel_Info;
326                 case 4: return LDKLevel_Warn;
327                 case 5: return LDKLevel_Error;
328         }
329         abort();
330 }
331 static inline int32_t LDKLevel_to_js(LDKLevel val) {
332         switch (val) {
333                 case LDKLevel_Gossip: return 0;
334                 case LDKLevel_Trace: return 1;
335                 case LDKLevel_Debug: return 2;
336                 case LDKLevel_Info: return 3;
337                 case LDKLevel_Warn: return 4;
338                 case LDKLevel_Error: return 5;
339                 default: abort();
340         }
341 }
342 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
343         switch (ord) {
344                 case 0: return LDKNetwork_Bitcoin;
345                 case 1: return LDKNetwork_Testnet;
346                 case 2: return LDKNetwork_Regtest;
347                 case 3: return LDKNetwork_Signet;
348         }
349         abort();
350 }
351 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
352         switch (val) {
353                 case LDKNetwork_Bitcoin: return 0;
354                 case LDKNetwork_Testnet: return 1;
355                 case LDKNetwork_Regtest: return 2;
356                 case LDKNetwork_Signet: return 3;
357                 default: abort();
358         }
359 }
360 static inline LDKRecipient LDKRecipient_from_js(int32_t ord) {
361         switch (ord) {
362                 case 0: return LDKRecipient_Node;
363                 case 1: return LDKRecipient_PhantomNode;
364         }
365         abort();
366 }
367 static inline int32_t LDKRecipient_to_js(LDKRecipient val) {
368         switch (val) {
369                 case LDKRecipient_Node: return 0;
370                 case LDKRecipient_PhantomNode: return 1;
371                 default: abort();
372         }
373 }
374 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
375         switch (ord) {
376                 case 0: return LDKSecp256k1Error_IncorrectSignature;
377                 case 1: return LDKSecp256k1Error_InvalidMessage;
378                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
379                 case 3: return LDKSecp256k1Error_InvalidSignature;
380                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
381                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
382                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
383                 case 7: return LDKSecp256k1Error_InvalidTweak;
384                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
385                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
386                 case 10: return LDKSecp256k1Error_InvalidParityValue;
387         }
388         abort();
389 }
390 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
391         switch (val) {
392                 case LDKSecp256k1Error_IncorrectSignature: return 0;
393                 case LDKSecp256k1Error_InvalidMessage: return 1;
394                 case LDKSecp256k1Error_InvalidPublicKey: return 2;
395                 case LDKSecp256k1Error_InvalidSignature: return 3;
396                 case LDKSecp256k1Error_InvalidSecretKey: return 4;
397                 case LDKSecp256k1Error_InvalidSharedSecret: return 5;
398                 case LDKSecp256k1Error_InvalidRecoveryId: return 6;
399                 case LDKSecp256k1Error_InvalidTweak: return 7;
400                 case LDKSecp256k1Error_NotEnoughMemory: return 8;
401                 case LDKSecp256k1Error_InvalidPublicKeySum: return 9;
402                 case LDKSecp256k1Error_InvalidParityValue: return 10;
403                 default: abort();
404         }
405 }
406 static inline LDKSemanticError LDKSemanticError_from_js(int32_t ord) {
407         switch (ord) {
408                 case 0: return LDKSemanticError_NoPaymentHash;
409                 case 1: return LDKSemanticError_MultiplePaymentHashes;
410                 case 2: return LDKSemanticError_NoDescription;
411                 case 3: return LDKSemanticError_MultipleDescriptions;
412                 case 4: return LDKSemanticError_NoPaymentSecret;
413                 case 5: return LDKSemanticError_MultiplePaymentSecrets;
414                 case 6: return LDKSemanticError_InvalidFeatures;
415                 case 7: return LDKSemanticError_InvalidRecoveryId;
416                 case 8: return LDKSemanticError_InvalidSignature;
417                 case 9: return LDKSemanticError_ImpreciseAmount;
418         }
419         abort();
420 }
421 static inline int32_t LDKSemanticError_to_js(LDKSemanticError val) {
422         switch (val) {
423                 case LDKSemanticError_NoPaymentHash: return 0;
424                 case LDKSemanticError_MultiplePaymentHashes: return 1;
425                 case LDKSemanticError_NoDescription: return 2;
426                 case LDKSemanticError_MultipleDescriptions: return 3;
427                 case LDKSemanticError_NoPaymentSecret: return 4;
428                 case LDKSemanticError_MultiplePaymentSecrets: return 5;
429                 case LDKSemanticError_InvalidFeatures: return 6;
430                 case LDKSemanticError_InvalidRecoveryId: return 7;
431                 case LDKSemanticError_InvalidSignature: return 8;
432                 case LDKSemanticError_ImpreciseAmount: return 9;
433                 default: abort();
434         }
435 }
436 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
437         switch (ord) {
438                 case 0: return LDKSiPrefix_Milli;
439                 case 1: return LDKSiPrefix_Micro;
440                 case 2: return LDKSiPrefix_Nano;
441                 case 3: return LDKSiPrefix_Pico;
442         }
443         abort();
444 }
445 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
446         switch (val) {
447                 case LDKSiPrefix_Milli: return 0;
448                 case LDKSiPrefix_Micro: return 1;
449                 case LDKSiPrefix_Nano: return 2;
450                 case LDKSiPrefix_Pico: return 3;
451                 default: abort();
452         }
453 }
454 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
455         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
456         return ret;
457 }
458 int8_tArray  __attribute__((export_name("TS_BigEndianScalar_get_bytes"))) TS_BigEndianScalar_get_bytes(uint64_t thing) {
459         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
460         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
461         memcpy(ret_arr->elems, BigEndianScalar_get_bytes(thing_conv).data, 32);
462         return ret_arr;
463 }
464
465 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
466 void  __attribute__((export_name("TS_BigEndianScalar_free"))) TS_BigEndianScalar_free(uint64_t thing) {
467         if (!ptr_is_owned(thing)) return;
468         void* thing_ptr = untag_ptr(thing);
469         CHECK_ACCESS(thing_ptr);
470         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
471         FREE(untag_ptr(thing));
472         BigEndianScalar_free(thing_conv);
473 }
474
475 uint32_t __attribute__((export_name("TS_LDKBech32Error_ty_from_ptr"))) TS_LDKBech32Error_ty_from_ptr(uint64_t ptr) {
476         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
477         switch(obj->tag) {
478                 case LDKBech32Error_MissingSeparator: return 0;
479                 case LDKBech32Error_InvalidChecksum: return 1;
480                 case LDKBech32Error_InvalidLength: return 2;
481                 case LDKBech32Error_InvalidChar: return 3;
482                 case LDKBech32Error_InvalidData: return 4;
483                 case LDKBech32Error_InvalidPadding: return 5;
484                 case LDKBech32Error_MixedCase: return 6;
485                 default: abort();
486         }
487 }
488 int32_t __attribute__((export_name("TS_LDKBech32Error_InvalidChar_get_invalid_char"))) TS_LDKBech32Error_InvalidChar_get_invalid_char(uint64_t ptr) {
489         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
490         assert(obj->tag == LDKBech32Error_InvalidChar);
491                         int32_t invalid_char_conv = obj->invalid_char;
492         return invalid_char_conv;
493 }
494 int8_t __attribute__((export_name("TS_LDKBech32Error_InvalidData_get_invalid_data"))) TS_LDKBech32Error_InvalidData_get_invalid_data(uint64_t ptr) {
495         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
496         assert(obj->tag == LDKBech32Error_InvalidData);
497                         int8_t invalid_data_conv = obj->invalid_data;
498         return invalid_data_conv;
499 }
500 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
501         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
502         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
503         return ret;
504 }
505 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) {
506         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
507         LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
508         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
509         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
510         CVec_u8Z_free(ret_var);
511         return ret_arr;
512 }
513
514 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) {
515         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
516         int64_t ret_conv = TxOut_get_value(thing_conv);
517         return ret_conv;
518 }
519
520 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_ty_from_ptr"))) TS_LDKCOption_HTLCClaimZ_ty_from_ptr(uint64_t ptr) {
521         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
522         switch(obj->tag) {
523                 case LDKCOption_HTLCClaimZ_Some: return 0;
524                 case LDKCOption_HTLCClaimZ_None: return 1;
525                 default: abort();
526         }
527 }
528 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_Some_get_some"))) TS_LDKCOption_HTLCClaimZ_Some_get_some(uint64_t ptr) {
529         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
530         assert(obj->tag == LDKCOption_HTLCClaimZ_Some);
531                         uint32_t some_conv = LDKHTLCClaim_to_js(obj->some);
532         return some_conv;
533 }
534 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
535 CHECK(owner->result_ok);
536         return *owner->contents.result;
537 }
538 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_ok"))) TS_CResult_NoneNoneZ_get_ok(uint64_t owner) {
539         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
540         CResult_NoneNoneZ_get_ok(owner_conv);
541 }
542
543 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
544 CHECK(!owner->result_ok);
545         return *owner->contents.err;
546 }
547 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_err"))) TS_CResult_NoneNoneZ_get_err(uint64_t owner) {
548         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
549         CResult_NoneNoneZ_get_err(owner_conv);
550 }
551
552 uint32_t __attribute__((export_name("TS_LDKDecodeError_ty_from_ptr"))) TS_LDKDecodeError_ty_from_ptr(uint64_t ptr) {
553         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
554         switch(obj->tag) {
555                 case LDKDecodeError_UnknownVersion: return 0;
556                 case LDKDecodeError_UnknownRequiredFeature: return 1;
557                 case LDKDecodeError_InvalidValue: return 2;
558                 case LDKDecodeError_ShortRead: return 3;
559                 case LDKDecodeError_BadLengthDescriptor: return 4;
560                 case LDKDecodeError_Io: return 5;
561                 case LDKDecodeError_UnsupportedCompression: return 6;
562                 default: abort();
563         }
564 }
565 uint32_t __attribute__((export_name("TS_LDKDecodeError_Io_get_io"))) TS_LDKDecodeError_Io_get_io(uint64_t ptr) {
566         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
567         assert(obj->tag == LDKDecodeError_Io);
568                         uint32_t io_conv = LDKIOError_to_js(obj->io);
569         return io_conv;
570 }
571 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
572         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
573         ret.is_owned = false;
574         return ret;
575 }
576 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(uint64_t owner) {
577         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
578         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
579         uint64_t ret_ref = 0;
580         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
581         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
582         return ret_ref;
583 }
584
585 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
586 CHECK(!owner->result_ok);
587         return DecodeError_clone(&*owner->contents.err);
588 }
589 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(uint64_t owner) {
590         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
591         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
592         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
593         uint64_t ret_ref = tag_ptr(ret_copy, true);
594         return ret_ref;
595 }
596
597 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
598         LDKTxCreationKeys ret = *owner->contents.result;
599         ret.is_owned = false;
600         return ret;
601 }
602 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_ok(uint64_t owner) {
603         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
604         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
605         uint64_t ret_ref = 0;
606         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
607         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
608         return ret_ref;
609 }
610
611 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
612 CHECK(!owner->result_ok);
613         return DecodeError_clone(&*owner->contents.err);
614 }
615 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_err(uint64_t owner) {
616         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
617         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
618         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
619         uint64_t ret_ref = tag_ptr(ret_copy, true);
620         return ret_ref;
621 }
622
623 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
624         LDKChannelPublicKeys ret = *owner->contents.result;
625         ret.is_owned = false;
626         return ret;
627 }
628 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint64_t owner) {
629         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
630         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
631         uint64_t ret_ref = 0;
632         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
633         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
634         return ret_ref;
635 }
636
637 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
638 CHECK(!owner->result_ok);
639         return DecodeError_clone(&*owner->contents.err);
640 }
641 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err(uint64_t owner) {
642         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
643         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
644         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
645         uint64_t ret_ref = tag_ptr(ret_copy, true);
646         return ret_ref;
647 }
648
649 uint32_t __attribute__((export_name("TS_LDKCOption_u32Z_ty_from_ptr"))) TS_LDKCOption_u32Z_ty_from_ptr(uint64_t ptr) {
650         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
651         switch(obj->tag) {
652                 case LDKCOption_u32Z_Some: return 0;
653                 case LDKCOption_u32Z_None: return 1;
654                 default: abort();
655         }
656 }
657 int32_t __attribute__((export_name("TS_LDKCOption_u32Z_Some_get_some"))) TS_LDKCOption_u32Z_Some_get_some(uint64_t ptr) {
658         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
659         assert(obj->tag == LDKCOption_u32Z_Some);
660                         int32_t some_conv = obj->some;
661         return some_conv;
662 }
663 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
664         LDKHTLCOutputInCommitment ret = *owner->contents.result;
665         ret.is_owned = false;
666         return ret;
667 }
668 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint64_t owner) {
669         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
670         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
671         uint64_t ret_ref = 0;
672         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
673         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
674         return ret_ref;
675 }
676
677 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
678 CHECK(!owner->result_ok);
679         return DecodeError_clone(&*owner->contents.err);
680 }
681 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint64_t owner) {
682         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
683         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
684         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
685         uint64_t ret_ref = tag_ptr(ret_copy, true);
686         return ret_ref;
687 }
688
689 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
690         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
691         ret.is_owned = false;
692         return ret;
693 }
694 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
695         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
696         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
697         uint64_t ret_ref = 0;
698         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
699         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
700         return ret_ref;
701 }
702
703 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
704 CHECK(!owner->result_ok);
705         return DecodeError_clone(&*owner->contents.err);
706 }
707 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
708         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
709         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
710         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
711         uint64_t ret_ref = tag_ptr(ret_copy, true);
712         return ret_ref;
713 }
714
715 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
716         LDKChannelTransactionParameters ret = *owner->contents.result;
717         ret.is_owned = false;
718         return ret;
719 }
720 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
721         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
722         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
723         uint64_t ret_ref = 0;
724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
726         return ret_ref;
727 }
728
729 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
730 CHECK(!owner->result_ok);
731         return DecodeError_clone(&*owner->contents.err);
732 }
733 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
734         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
735         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
736         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
737         uint64_t ret_ref = tag_ptr(ret_copy, true);
738         return ret_ref;
739 }
740
741 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
742         LDKHolderCommitmentTransaction ret = *owner->contents.result;
743         ret.is_owned = false;
744         return ret;
745 }
746 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
747         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
748         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
749         uint64_t ret_ref = 0;
750         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
751         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
752         return ret_ref;
753 }
754
755 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
756 CHECK(!owner->result_ok);
757         return DecodeError_clone(&*owner->contents.err);
758 }
759 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
760         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
761         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
762         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
763         uint64_t ret_ref = tag_ptr(ret_copy, true);
764         return ret_ref;
765 }
766
767 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
768         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
769         ret.is_owned = false;
770         return ret;
771 }
772 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
773         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
774         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
775         uint64_t ret_ref = 0;
776         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
777         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
778         return ret_ref;
779 }
780
781 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
782 CHECK(!owner->result_ok);
783         return DecodeError_clone(&*owner->contents.err);
784 }
785 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
786         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
787         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
788         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
789         uint64_t ret_ref = tag_ptr(ret_copy, true);
790         return ret_ref;
791 }
792
793 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
794         LDKTrustedClosingTransaction ret = *owner->contents.result;
795         ret.is_owned = false;
796         return ret;
797 }
798 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_get_ok(uint64_t owner) {
799         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
800         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
801         uint64_t ret_ref = 0;
802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
804         return ret_ref;
805 }
806
807 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
808 CHECK(!owner->result_ok);
809         return *owner->contents.err;
810 }
811 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_err"))) TS_CResult_TrustedClosingTransactionNoneZ_get_err(uint64_t owner) {
812         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
813         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
814 }
815
816 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
817         LDKCommitmentTransaction ret = *owner->contents.result;
818         ret.is_owned = false;
819         return ret;
820 }
821 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
822         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
823         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
824         uint64_t ret_ref = 0;
825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
827         return ret_ref;
828 }
829
830 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
831 CHECK(!owner->result_ok);
832         return DecodeError_clone(&*owner->contents.err);
833 }
834 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
835         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
836         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
837         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
838         uint64_t ret_ref = tag_ptr(ret_copy, true);
839         return ret_ref;
840 }
841
842 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
843         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
844         ret.is_owned = false;
845         return ret;
846 }
847 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok(uint64_t owner) {
848         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
849         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
850         uint64_t ret_ref = 0;
851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
853         return ret_ref;
854 }
855
856 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
857 CHECK(!owner->result_ok);
858         return *owner->contents.err;
859 }
860 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_err(uint64_t owner) {
861         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
862         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
863 }
864
865 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
866 CHECK(owner->result_ok);
867         return *owner->contents.result;
868 }
869 ptrArray  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_ok"))) TS_CResult_CVec_SignatureZNoneZ_get_ok(uint64_t owner) {
870         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
871         LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
872         ptrArray ret_arr = NULL;
873         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
874         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
875         for (size_t m = 0; m < ret_var.datalen; m++) {
876                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
877                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
878                 ret_arr_ptr[m] = ret_conv_12_arr;
879         }
880         
881         return ret_arr;
882 }
883
884 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
885 CHECK(!owner->result_ok);
886         return *owner->contents.err;
887 }
888 void  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_err"))) TS_CResult_CVec_SignatureZNoneZ_get_err(uint64_t owner) {
889         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
890         CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
891 }
892
893 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
894         LDKShutdownScript ret = *owner->contents.result;
895         ret.is_owned = false;
896         return ret;
897 }
898 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_ok(uint64_t owner) {
899         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
900         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
901         uint64_t ret_ref = 0;
902         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
903         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
904         return ret_ref;
905 }
906
907 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
908 CHECK(!owner->result_ok);
909         return DecodeError_clone(&*owner->contents.err);
910 }
911 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_err(uint64_t owner) {
912         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
913         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
914         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
915         uint64_t ret_ref = tag_ptr(ret_copy, true);
916         return ret_ref;
917 }
918
919 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
920         LDKShutdownScript ret = *owner->contents.result;
921         ret.is_owned = false;
922         return ret;
923 }
924 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint64_t owner) {
925         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
926         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
927         uint64_t ret_ref = 0;
928         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
929         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
930         return ret_ref;
931 }
932
933 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
934         LDKInvalidShutdownScript ret = *owner->contents.err;
935         ret.is_owned = false;
936         return ret;
937 }
938 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint64_t owner) {
939         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
940         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
941         uint64_t ret_ref = 0;
942         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
943         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
944         return ret_ref;
945 }
946
947 static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
948         LDKBlindedPath ret = *owner->contents.result;
949         ret.is_owned = false;
950         return ret;
951 }
952 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_ok"))) TS_CResult_BlindedPathNoneZ_get_ok(uint64_t owner) {
953         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
954         LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv);
955         uint64_t ret_ref = 0;
956         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
957         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
958         return ret_ref;
959 }
960
961 static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
962 CHECK(!owner->result_ok);
963         return *owner->contents.err;
964 }
965 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_err"))) TS_CResult_BlindedPathNoneZ_get_err(uint64_t owner) {
966         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
967         CResult_BlindedPathNoneZ_get_err(owner_conv);
968 }
969
970 static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
971         LDKBlindedPath ret = *owner->contents.result;
972         ret.is_owned = false;
973         return ret;
974 }
975 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_ok"))) TS_CResult_BlindedPathDecodeErrorZ_get_ok(uint64_t owner) {
976         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
977         LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(owner_conv);
978         uint64_t ret_ref = 0;
979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
981         return ret_ref;
982 }
983
984 static inline struct LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
985 CHECK(!owner->result_ok);
986         return DecodeError_clone(&*owner->contents.err);
987 }
988 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_err"))) TS_CResult_BlindedPathDecodeErrorZ_get_err(uint64_t owner) {
989         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
990         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
991         *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv);
992         uint64_t ret_ref = tag_ptr(ret_copy, true);
993         return ret_ref;
994 }
995
996 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
997         LDKBlindedHop ret = *owner->contents.result;
998         ret.is_owned = false;
999         return ret;
1000 }
1001 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopDecodeErrorZ_get_ok(uint64_t owner) {
1002         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
1003         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
1004         uint64_t ret_ref = 0;
1005         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1006         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1007         return ret_ref;
1008 }
1009
1010 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
1011 CHECK(!owner->result_ok);
1012         return DecodeError_clone(&*owner->contents.err);
1013 }
1014 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_err"))) TS_CResult_BlindedHopDecodeErrorZ_get_err(uint64_t owner) {
1015         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
1016         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1017         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
1018         uint64_t ret_ref = tag_ptr(ret_copy, true);
1019         return ret_ref;
1020 }
1021
1022 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1023         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1024         for (size_t i = 0; i < ret.datalen; i++) {
1025                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1026         }
1027         return ret;
1028 }
1029 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1030         LDKRoute ret = *owner->contents.result;
1031         ret.is_owned = false;
1032         return ret;
1033 }
1034 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_ok"))) TS_CResult_RouteLightningErrorZ_get_ok(uint64_t owner) {
1035         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
1036         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
1037         uint64_t ret_ref = 0;
1038         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1039         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1040         return ret_ref;
1041 }
1042
1043 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1044         LDKLightningError ret = *owner->contents.err;
1045         ret.is_owned = false;
1046         return ret;
1047 }
1048 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_err"))) TS_CResult_RouteLightningErrorZ_get_err(uint64_t owner) {
1049         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
1050         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
1051         uint64_t ret_ref = 0;
1052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1054         return ret_ref;
1055 }
1056
1057 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1058         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1059         for (size_t i = 0; i < ret.datalen; i++) {
1060                 ret.data[i] = RouteHop_clone(&orig->data[i]);
1061         }
1062         return ret;
1063 }
1064 uint32_t __attribute__((export_name("TS_LDKCOption_u64Z_ty_from_ptr"))) TS_LDKCOption_u64Z_ty_from_ptr(uint64_t ptr) {
1065         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1066         switch(obj->tag) {
1067                 case LDKCOption_u64Z_Some: return 0;
1068                 case LDKCOption_u64Z_None: return 1;
1069                 default: abort();
1070         }
1071 }
1072 int64_t __attribute__((export_name("TS_LDKCOption_u64Z_Some_get_some"))) TS_LDKCOption_u64Z_Some_get_some(uint64_t ptr) {
1073         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1074         assert(obj->tag == LDKCOption_u64Z_Some);
1075                         int64_t some_conv = obj->some;
1076         return some_conv;
1077 }
1078 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
1079         LDKInFlightHtlcs ret = *owner->contents.result;
1080         ret.is_owned = false;
1081         return ret;
1082 }
1083 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok(uint64_t owner) {
1084         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
1085         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
1086         uint64_t ret_ref = 0;
1087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1089         return ret_ref;
1090 }
1091
1092 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
1093 CHECK(!owner->result_ok);
1094         return DecodeError_clone(&*owner->contents.err);
1095 }
1096 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_err(uint64_t owner) {
1097         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
1098         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1099         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
1100         uint64_t ret_ref = tag_ptr(ret_copy, true);
1101         return ret_ref;
1102 }
1103
1104 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1105         LDKRouteHop ret = *owner->contents.result;
1106         ret.is_owned = false;
1107         return ret;
1108 }
1109 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHopDecodeErrorZ_get_ok(uint64_t owner) {
1110         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
1111         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
1112         uint64_t ret_ref = 0;
1113         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1114         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1115         return ret_ref;
1116 }
1117
1118 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1119 CHECK(!owner->result_ok);
1120         return DecodeError_clone(&*owner->contents.err);
1121 }
1122 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_err"))) TS_CResult_RouteHopDecodeErrorZ_get_err(uint64_t owner) {
1123         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
1124         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1125         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
1126         uint64_t ret_ref = tag_ptr(ret_copy, true);
1127         return ret_ref;
1128 }
1129
1130 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1131         LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1132         for (size_t i = 0; i < ret.datalen; i++) {
1133                 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1134         }
1135         return ret;
1136 }
1137 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1138         LDKRoute ret = *owner->contents.result;
1139         ret.is_owned = false;
1140         return ret;
1141 }
1142 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_ok"))) TS_CResult_RouteDecodeErrorZ_get_ok(uint64_t owner) {
1143         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
1144         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
1145         uint64_t ret_ref = 0;
1146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1148         return ret_ref;
1149 }
1150
1151 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1152 CHECK(!owner->result_ok);
1153         return DecodeError_clone(&*owner->contents.err);
1154 }
1155 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_err"))) TS_CResult_RouteDecodeErrorZ_get_err(uint64_t owner) {
1156         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
1157         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1158         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
1159         uint64_t ret_ref = tag_ptr(ret_copy, true);
1160         return ret_ref;
1161 }
1162
1163 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1164         LDKRouteParameters ret = *owner->contents.result;
1165         ret.is_owned = false;
1166         return ret;
1167 }
1168 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_ok"))) TS_CResult_RouteParametersDecodeErrorZ_get_ok(uint64_t owner) {
1169         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
1170         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
1171         uint64_t ret_ref = 0;
1172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1174         return ret_ref;
1175 }
1176
1177 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1178 CHECK(!owner->result_ok);
1179         return DecodeError_clone(&*owner->contents.err);
1180 }
1181 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_err"))) TS_CResult_RouteParametersDecodeErrorZ_get_err(uint64_t owner) {
1182         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
1183         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1184         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
1185         uint64_t ret_ref = tag_ptr(ret_copy, true);
1186         return ret_ref;
1187 }
1188
1189 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1190         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1191         for (size_t i = 0; i < ret.datalen; i++) {
1192                 ret.data[i] = RouteHint_clone(&orig->data[i]);
1193         }
1194         return ret;
1195 }
1196 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
1197         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
1198         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
1199         return ret;
1200 }
1201 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1202         LDKPaymentParameters ret = *owner->contents.result;
1203         ret.is_owned = false;
1204         return ret;
1205 }
1206 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_get_ok(uint64_t owner) {
1207         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
1208         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
1209         uint64_t ret_ref = 0;
1210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1211         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1212         return ret_ref;
1213 }
1214
1215 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1216 CHECK(!owner->result_ok);
1217         return DecodeError_clone(&*owner->contents.err);
1218 }
1219 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_err"))) TS_CResult_PaymentParametersDecodeErrorZ_get_err(uint64_t owner) {
1220         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
1221         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1222         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
1223         uint64_t ret_ref = tag_ptr(ret_copy, true);
1224         return ret_ref;
1225 }
1226
1227 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
1228         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
1229         for (size_t i = 0; i < ret.datalen; i++) {
1230                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
1231         }
1232         return ret;
1233 }
1234 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1235         LDKRouteHint ret = *owner->contents.result;
1236         ret.is_owned = false;
1237         return ret;
1238 }
1239 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_ok"))) TS_CResult_RouteHintDecodeErrorZ_get_ok(uint64_t owner) {
1240         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
1241         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
1242         uint64_t ret_ref = 0;
1243         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1244         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1245         return ret_ref;
1246 }
1247
1248 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1249 CHECK(!owner->result_ok);
1250         return DecodeError_clone(&*owner->contents.err);
1251 }
1252 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_err"))) TS_CResult_RouteHintDecodeErrorZ_get_err(uint64_t owner) {
1253         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
1254         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1255         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
1256         uint64_t ret_ref = tag_ptr(ret_copy, true);
1257         return ret_ref;
1258 }
1259
1260 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1261         LDKRouteHintHop ret = *owner->contents.result;
1262         ret.is_owned = false;
1263         return ret;
1264 }
1265 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_get_ok(uint64_t owner) {
1266         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
1267         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
1268         uint64_t ret_ref = 0;
1269         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1270         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1271         return ret_ref;
1272 }
1273
1274 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1275 CHECK(!owner->result_ok);
1276         return DecodeError_clone(&*owner->contents.err);
1277 }
1278 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_err"))) TS_CResult_RouteHintHopDecodeErrorZ_get_err(uint64_t owner) {
1279         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
1280         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1281         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
1282         uint64_t ret_ref = tag_ptr(ret_copy, true);
1283         return ret_ref;
1284 }
1285
1286 uint32_t __attribute__((export_name("TS_LDKPaymentPurpose_ty_from_ptr"))) TS_LDKPaymentPurpose_ty_from_ptr(uint64_t ptr) {
1287         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1288         switch(obj->tag) {
1289                 case LDKPaymentPurpose_InvoicePayment: return 0;
1290                 case LDKPaymentPurpose_SpontaneousPayment: return 1;
1291                 default: abort();
1292         }
1293 }
1294 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage(uint64_t ptr) {
1295         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1296         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1297                         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
1298                         memcpy(payment_preimage_arr->elems, obj->invoice_payment.payment_preimage.data, 32);
1299         return payment_preimage_arr;
1300 }
1301 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret(uint64_t ptr) {
1302         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1303         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1304                         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
1305                         memcpy(payment_secret_arr->elems, obj->invoice_payment.payment_secret.data, 32);
1306         return payment_secret_arr;
1307 }
1308 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment"))) TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(uint64_t ptr) {
1309         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1310         assert(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
1311                         int8_tArray spontaneous_payment_arr = init_int8_tArray(32, __LINE__);
1312                         memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
1313         return spontaneous_payment_arr;
1314 }
1315 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1316 CHECK(owner->result_ok);
1317         return PaymentPurpose_clone(&*owner->contents.result);
1318 }
1319 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_ok(uint64_t owner) {
1320         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
1321         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
1322         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
1323         uint64_t ret_ref = tag_ptr(ret_copy, true);
1324         return ret_ref;
1325 }
1326
1327 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1328 CHECK(!owner->result_ok);
1329         return DecodeError_clone(&*owner->contents.err);
1330 }
1331 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_err(uint64_t owner) {
1332         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
1333         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1334         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
1335         uint64_t ret_ref = tag_ptr(ret_copy, true);
1336         return ret_ref;
1337 }
1338
1339 uint32_t __attribute__((export_name("TS_LDKClosureReason_ty_from_ptr"))) TS_LDKClosureReason_ty_from_ptr(uint64_t ptr) {
1340         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
1341         switch(obj->tag) {
1342                 case LDKClosureReason_CounterpartyForceClosed: return 0;
1343                 case LDKClosureReason_HolderForceClosed: return 1;
1344                 case LDKClosureReason_CooperativeClosure: return 2;
1345                 case LDKClosureReason_CommitmentTxConfirmed: return 3;
1346                 case LDKClosureReason_FundingTimedOut: return 4;
1347                 case LDKClosureReason_ProcessingError: return 5;
1348                 case LDKClosureReason_DisconnectedPeer: return 6;
1349                 case LDKClosureReason_OutdatedChannelManager: return 7;
1350                 default: abort();
1351         }
1352 }
1353 jstring __attribute__((export_name("TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg"))) TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(uint64_t ptr) {
1354         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
1355         assert(obj->tag == LDKClosureReason_CounterpartyForceClosed);
1356                         LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
1357                         jstring peer_msg_conv = str_ref_to_ts(peer_msg_str.chars, peer_msg_str.len);
1358         return peer_msg_conv;
1359 }
1360 jstring __attribute__((export_name("TS_LDKClosureReason_ProcessingError_get_err"))) TS_LDKClosureReason_ProcessingError_get_err(uint64_t ptr) {
1361         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
1362         assert(obj->tag == LDKClosureReason_ProcessingError);
1363                         LDKStr err_str = obj->processing_error.err;
1364                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
1365         return err_conv;
1366 }
1367 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_ty_from_ptr"))) TS_LDKCOption_ClosureReasonZ_ty_from_ptr(uint64_t ptr) {
1368         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
1369         switch(obj->tag) {
1370                 case LDKCOption_ClosureReasonZ_Some: return 0;
1371                 case LDKCOption_ClosureReasonZ_None: return 1;
1372                 default: abort();
1373         }
1374 }
1375 uint64_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_Some_get_some"))) TS_LDKCOption_ClosureReasonZ_Some_get_some(uint64_t ptr) {
1376         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
1377         assert(obj->tag == LDKCOption_ClosureReasonZ_Some);
1378                         uint64_t some_ref = tag_ptr(&obj->some, false);
1379         return some_ref;
1380 }
1381 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
1382 CHECK(owner->result_ok);
1383         return COption_ClosureReasonZ_clone(&*owner->contents.result);
1384 }
1385 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint64_t owner) {
1386         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
1387         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
1388         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
1389         uint64_t ret_ref = tag_ptr(ret_copy, true);
1390         return ret_ref;
1391 }
1392
1393 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
1394 CHECK(!owner->result_ok);
1395         return DecodeError_clone(&*owner->contents.err);
1396 }
1397 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint64_t owner) {
1398         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
1399         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1400         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
1401         uint64_t ret_ref = tag_ptr(ret_copy, true);
1402         return ret_ref;
1403 }
1404
1405 uint32_t __attribute__((export_name("TS_LDKHTLCDestination_ty_from_ptr"))) TS_LDKHTLCDestination_ty_from_ptr(uint64_t ptr) {
1406         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1407         switch(obj->tag) {
1408                 case LDKHTLCDestination_NextHopChannel: return 0;
1409                 case LDKHTLCDestination_UnknownNextHop: return 1;
1410                 case LDKHTLCDestination_InvalidForward: return 2;
1411                 case LDKHTLCDestination_FailedPayment: return 3;
1412                 default: abort();
1413         }
1414 }
1415 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_node_id"))) TS_LDKHTLCDestination_NextHopChannel_get_node_id(uint64_t ptr) {
1416         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1417         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
1418                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
1419                         memcpy(node_id_arr->elems, obj->next_hop_channel.node_id.compressed_form, 33);
1420         return node_id_arr;
1421 }
1422 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_channel_id"))) TS_LDKHTLCDestination_NextHopChannel_get_channel_id(uint64_t ptr) {
1423         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1424         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
1425                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
1426                         memcpy(channel_id_arr->elems, obj->next_hop_channel.channel_id.data, 32);
1427         return channel_id_arr;
1428 }
1429 int64_t __attribute__((export_name("TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid"))) TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid(uint64_t ptr) {
1430         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1431         assert(obj->tag == LDKHTLCDestination_UnknownNextHop);
1432                         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
1433         return requested_forward_scid_conv;
1434 }
1435 int64_t __attribute__((export_name("TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid"))) TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid(uint64_t ptr) {
1436         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1437         assert(obj->tag == LDKHTLCDestination_InvalidForward);
1438                         int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid;
1439         return requested_forward_scid_conv;
1440 }
1441 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_FailedPayment_get_payment_hash"))) TS_LDKHTLCDestination_FailedPayment_get_payment_hash(uint64_t ptr) {
1442         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1443         assert(obj->tag == LDKHTLCDestination_FailedPayment);
1444                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1445                         memcpy(payment_hash_arr->elems, obj->failed_payment.payment_hash.data, 32);
1446         return payment_hash_arr;
1447 }
1448 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_ty_from_ptr"))) TS_LDKCOption_HTLCDestinationZ_ty_from_ptr(uint64_t ptr) {
1449         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
1450         switch(obj->tag) {
1451                 case LDKCOption_HTLCDestinationZ_Some: return 0;
1452                 case LDKCOption_HTLCDestinationZ_None: return 1;
1453                 default: abort();
1454         }
1455 }
1456 uint64_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_Some_get_some"))) TS_LDKCOption_HTLCDestinationZ_Some_get_some(uint64_t ptr) {
1457         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
1458         assert(obj->tag == LDKCOption_HTLCDestinationZ_Some);
1459                         uint64_t some_ref = tag_ptr(&obj->some, false);
1460         return some_ref;
1461 }
1462 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
1463 CHECK(owner->result_ok);
1464         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
1465 }
1466 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(uint64_t owner) {
1467         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
1468         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
1469         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
1470         uint64_t ret_ref = tag_ptr(ret_copy, true);
1471         return ret_ref;
1472 }
1473
1474 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
1475 CHECK(!owner->result_ok);
1476         return DecodeError_clone(&*owner->contents.err);
1477 }
1478 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(uint64_t owner) {
1479         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
1480         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1481         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
1482         uint64_t ret_ref = tag_ptr(ret_copy, true);
1483         return ret_ref;
1484 }
1485
1486 uint32_t __attribute__((export_name("TS_LDKCOption_u128Z_ty_from_ptr"))) TS_LDKCOption_u128Z_ty_from_ptr(uint64_t ptr) {
1487         LDKCOption_u128Z *obj = (LDKCOption_u128Z*)untag_ptr(ptr);
1488         switch(obj->tag) {
1489                 case LDKCOption_u128Z_Some: return 0;
1490                 case LDKCOption_u128Z_None: return 1;
1491                 default: abort();
1492         }
1493 }
1494 int8_tArray __attribute__((export_name("TS_LDKCOption_u128Z_Some_get_some"))) TS_LDKCOption_u128Z_Some_get_some(uint64_t ptr) {
1495         LDKCOption_u128Z *obj = (LDKCOption_u128Z*)untag_ptr(ptr);
1496         assert(obj->tag == LDKCOption_u128Z_Some);
1497                         int8_tArray some_arr = init_int8_tArray(16, __LINE__);
1498                         memcpy(some_arr->elems, obj->some.le_bytes, 16);
1499         return some_arr;
1500 }
1501 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ty_from_ptr"))) TS_LDKNetworkUpdate_ty_from_ptr(uint64_t ptr) {
1502         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1503         switch(obj->tag) {
1504                 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
1505                 case LDKNetworkUpdate_ChannelFailure: return 1;
1506                 case LDKNetworkUpdate_NodeFailure: return 2;
1507                 default: abort();
1508         }
1509 }
1510 uint64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg"))) TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(uint64_t ptr) {
1511         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1512         assert(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
1513                         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1514                         uint64_t msg_ref = 0;
1515                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1516                         msg_ref = tag_ptr(msg_var.inner, false);
1517         return msg_ref;
1518 }
1519 int64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id"))) TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id(uint64_t ptr) {
1520         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1521         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
1522                         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
1523         return short_channel_id_conv;
1524 }
1525 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent"))) TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent(uint64_t ptr) {
1526         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1527         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
1528                         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
1529         return is_permanent_conv;
1530 }
1531 int8_tArray __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_node_id"))) TS_LDKNetworkUpdate_NodeFailure_get_node_id(uint64_t ptr) {
1532         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1533         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1534                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
1535                         memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
1536         return node_id_arr;
1537 }
1538 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_is_permanent"))) TS_LDKNetworkUpdate_NodeFailure_get_is_permanent(uint64_t ptr) {
1539         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1540         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1541                         jboolean is_permanent_conv = obj->node_failure.is_permanent;
1542         return is_permanent_conv;
1543 }
1544 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_ty_from_ptr"))) TS_LDKCOption_NetworkUpdateZ_ty_from_ptr(uint64_t ptr) {
1545         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
1546         switch(obj->tag) {
1547                 case LDKCOption_NetworkUpdateZ_Some: return 0;
1548                 case LDKCOption_NetworkUpdateZ_None: return 1;
1549                 default: abort();
1550         }
1551 }
1552 uint64_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_Some_get_some"))) TS_LDKCOption_NetworkUpdateZ_Some_get_some(uint64_t ptr) {
1553         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
1554         assert(obj->tag == LDKCOption_NetworkUpdateZ_Some);
1555                         uint64_t some_ref = tag_ptr(&obj->some, false);
1556         return some_ref;
1557 }
1558 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_ty_from_ptr"))) TS_LDKSpendableOutputDescriptor_ty_from_ptr(uint64_t ptr) {
1559         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1560         switch(obj->tag) {
1561                 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
1562                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
1563                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
1564                 default: abort();
1565         }
1566 }
1567 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(uint64_t ptr) {
1568         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1569         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1570                         LDKOutPoint outpoint_var = obj->static_output.outpoint;
1571                         uint64_t outpoint_ref = 0;
1572                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1573                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
1574         return outpoint_ref;
1575 }
1576 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_output"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_output(uint64_t ptr) {
1577         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1578         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1579                         LDKTxOut* output_ref = &obj->static_output.output;
1580         return tag_ptr(output_ref, false);
1581 }
1582 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output"))) TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(uint64_t ptr) {
1583         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1584         assert(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
1585                         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1586                         uint64_t delayed_payment_output_ref = 0;
1587                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1588                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
1589         return delayed_payment_output_ref;
1590 }
1591 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output"))) TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(uint64_t ptr) {
1592         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1593         assert(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
1594                         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1595                         uint64_t static_payment_output_ref = 0;
1596                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1597                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
1598         return static_payment_output_ref;
1599 }
1600 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1601         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1602         for (size_t i = 0; i < ret.datalen; i++) {
1603                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1604         }
1605         return ret;
1606 }
1607 uint32_t __attribute__((export_name("TS_LDKEvent_ty_from_ptr"))) TS_LDKEvent_ty_from_ptr(uint64_t ptr) {
1608         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1609         switch(obj->tag) {
1610                 case LDKEvent_FundingGenerationReady: return 0;
1611                 case LDKEvent_PaymentClaimable: return 1;
1612                 case LDKEvent_PaymentClaimed: return 2;
1613                 case LDKEvent_PaymentSent: return 3;
1614                 case LDKEvent_PaymentFailed: return 4;
1615                 case LDKEvent_PaymentPathSuccessful: return 5;
1616                 case LDKEvent_PaymentPathFailed: return 6;
1617                 case LDKEvent_ProbeSuccessful: return 7;
1618                 case LDKEvent_ProbeFailed: return 8;
1619                 case LDKEvent_PendingHTLCsForwardable: return 9;
1620                 case LDKEvent_HTLCIntercepted: return 10;
1621                 case LDKEvent_SpendableOutputs: return 11;
1622                 case LDKEvent_PaymentForwarded: return 12;
1623                 case LDKEvent_ChannelReady: return 13;
1624                 case LDKEvent_ChannelClosed: return 14;
1625                 case LDKEvent_DiscardFunding: return 15;
1626                 case LDKEvent_OpenChannelRequest: return 16;
1627                 case LDKEvent_HTLCHandlingFailed: return 17;
1628                 default: abort();
1629         }
1630 }
1631 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id(uint64_t ptr) {
1632         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1633         assert(obj->tag == LDKEvent_FundingGenerationReady);
1634                         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
1635                         memcpy(temporary_channel_id_arr->elems, obj->funding_generation_ready.temporary_channel_id.data, 32);
1636         return temporary_channel_id_arr;
1637 }
1638 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id"))) TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id(uint64_t ptr) {
1639         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1640         assert(obj->tag == LDKEvent_FundingGenerationReady);
1641                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
1642                         memcpy(counterparty_node_id_arr->elems, obj->funding_generation_ready.counterparty_node_id.compressed_form, 33);
1643         return counterparty_node_id_arr;
1644 }
1645 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis"))) TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(uint64_t ptr) {
1646         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1647         assert(obj->tag == LDKEvent_FundingGenerationReady);
1648                         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
1649         return channel_value_satoshis_conv;
1650 }
1651 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_output_script"))) TS_LDKEvent_FundingGenerationReady_get_output_script(uint64_t ptr) {
1652         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1653         assert(obj->tag == LDKEvent_FundingGenerationReady);
1654                         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1655                         int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen, __LINE__);
1656                         memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
1657         return output_script_arr;
1658 }
1659 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_user_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_user_channel_id(uint64_t ptr) {
1660         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1661         assert(obj->tag == LDKEvent_FundingGenerationReady);
1662                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
1663                         memcpy(user_channel_id_arr->elems, obj->funding_generation_ready.user_channel_id.le_bytes, 16);
1664         return user_channel_id_arr;
1665 }
1666 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimable_get_receiver_node_id(uint64_t ptr) {
1667         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1668         assert(obj->tag == LDKEvent_PaymentClaimable);
1669                         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
1670                         memcpy(receiver_node_id_arr->elems, obj->payment_claimable.receiver_node_id.compressed_form, 33);
1671         return receiver_node_id_arr;
1672 }
1673 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_payment_hash"))) TS_LDKEvent_PaymentClaimable_get_payment_hash(uint64_t ptr) {
1674         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1675         assert(obj->tag == LDKEvent_PaymentClaimable);
1676                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1677                         memcpy(payment_hash_arr->elems, obj->payment_claimable.payment_hash.data, 32);
1678         return payment_hash_arr;
1679 }
1680 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_amount_msat"))) TS_LDKEvent_PaymentClaimable_get_amount_msat(uint64_t ptr) {
1681         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1682         assert(obj->tag == LDKEvent_PaymentClaimable);
1683                         int64_t amount_msat_conv = obj->payment_claimable.amount_msat;
1684         return amount_msat_conv;
1685 }
1686 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_purpose"))) TS_LDKEvent_PaymentClaimable_get_purpose(uint64_t ptr) {
1687         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1688         assert(obj->tag == LDKEvent_PaymentClaimable);
1689                         uint64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false);
1690         return purpose_ref;
1691 }
1692 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_channel_id(uint64_t ptr) {
1693         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1694         assert(obj->tag == LDKEvent_PaymentClaimable);
1695                         int8_tArray via_channel_id_arr = init_int8_tArray(32, __LINE__);
1696                         memcpy(via_channel_id_arr->elems, obj->payment_claimable.via_channel_id.data, 32);
1697         return via_channel_id_arr;
1698 }
1699 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_user_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_user_channel_id(uint64_t ptr) {
1700         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1701         assert(obj->tag == LDKEvent_PaymentClaimable);
1702                         uint64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false);
1703         return via_user_channel_id_ref;
1704 }
1705 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimed_get_receiver_node_id(uint64_t ptr) {
1706         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1707         assert(obj->tag == LDKEvent_PaymentClaimed);
1708                         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
1709                         memcpy(receiver_node_id_arr->elems, obj->payment_claimed.receiver_node_id.compressed_form, 33);
1710         return receiver_node_id_arr;
1711 }
1712 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_payment_hash"))) TS_LDKEvent_PaymentClaimed_get_payment_hash(uint64_t ptr) {
1713         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1714         assert(obj->tag == LDKEvent_PaymentClaimed);
1715                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1716                         memcpy(payment_hash_arr->elems, obj->payment_claimed.payment_hash.data, 32);
1717         return payment_hash_arr;
1718 }
1719 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_amount_msat"))) TS_LDKEvent_PaymentClaimed_get_amount_msat(uint64_t ptr) {
1720         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1721         assert(obj->tag == LDKEvent_PaymentClaimed);
1722                         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
1723         return amount_msat_conv;
1724 }
1725 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_purpose"))) TS_LDKEvent_PaymentClaimed_get_purpose(uint64_t ptr) {
1726         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1727         assert(obj->tag == LDKEvent_PaymentClaimed);
1728                         uint64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
1729         return purpose_ref;
1730 }
1731 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_id"))) TS_LDKEvent_PaymentSent_get_payment_id(uint64_t ptr) {
1732         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1733         assert(obj->tag == LDKEvent_PaymentSent);
1734                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1735                         memcpy(payment_id_arr->elems, obj->payment_sent.payment_id.data, 32);
1736         return payment_id_arr;
1737 }
1738 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_preimage"))) TS_LDKEvent_PaymentSent_get_payment_preimage(uint64_t ptr) {
1739         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1740         assert(obj->tag == LDKEvent_PaymentSent);
1741                         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
1742                         memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
1743         return payment_preimage_arr;
1744 }
1745 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_hash"))) TS_LDKEvent_PaymentSent_get_payment_hash(uint64_t ptr) {
1746         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1747         assert(obj->tag == LDKEvent_PaymentSent);
1748                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1749                         memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
1750         return payment_hash_arr;
1751 }
1752 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_fee_paid_msat"))) TS_LDKEvent_PaymentSent_get_fee_paid_msat(uint64_t ptr) {
1753         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1754         assert(obj->tag == LDKEvent_PaymentSent);
1755                         uint64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
1756         return fee_paid_msat_ref;
1757 }
1758 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_id"))) TS_LDKEvent_PaymentFailed_get_payment_id(uint64_t ptr) {
1759         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1760         assert(obj->tag == LDKEvent_PaymentFailed);
1761                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1762                         memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
1763         return payment_id_arr;
1764 }
1765 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_hash"))) TS_LDKEvent_PaymentFailed_get_payment_hash(uint64_t ptr) {
1766         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1767         assert(obj->tag == LDKEvent_PaymentFailed);
1768                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1769                         memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
1770         return payment_hash_arr;
1771 }
1772 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_id"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_id(uint64_t ptr) {
1773         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1774         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1775                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1776                         memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
1777         return payment_id_arr;
1778 }
1779 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_hash"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_hash(uint64_t ptr) {
1780         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1781         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1782                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1783                         memcpy(payment_hash_arr->elems, obj->payment_path_successful.payment_hash.data, 32);
1784         return payment_hash_arr;
1785 }
1786 uint64_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_path"))) TS_LDKEvent_PaymentPathSuccessful_get_path(uint64_t ptr) {
1787         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1788         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1789                         LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
1790                         uint64_tArray path_arr = NULL;
1791                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1792                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1793                         for (size_t k = 0; k < path_var.datalen; k++) {
1794                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1795                                 uint64_t path_conv_10_ref = 0;
1796                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1797                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1798                                 path_arr_ptr[k] = path_conv_10_ref;
1799                         }
1800                         
1801         return path_arr;
1802 }
1803 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_id"))) TS_LDKEvent_PaymentPathFailed_get_payment_id(uint64_t ptr) {
1804         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1805         assert(obj->tag == LDKEvent_PaymentPathFailed);
1806                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1807                         memcpy(payment_id_arr->elems, obj->payment_path_failed.payment_id.data, 32);
1808         return payment_id_arr;
1809 }
1810 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_hash"))) TS_LDKEvent_PaymentPathFailed_get_payment_hash(uint64_t ptr) {
1811         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1812         assert(obj->tag == LDKEvent_PaymentPathFailed);
1813                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1814                         memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
1815         return payment_hash_arr;
1816 }
1817 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently"))) TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently(uint64_t ptr) {
1818         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1819         assert(obj->tag == LDKEvent_PaymentPathFailed);
1820                         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
1821         return payment_failed_permanently_conv;
1822 }
1823 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_network_update"))) TS_LDKEvent_PaymentPathFailed_get_network_update(uint64_t ptr) {
1824         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1825         assert(obj->tag == LDKEvent_PaymentPathFailed);
1826                         uint64_t network_update_ref = tag_ptr(&obj->payment_path_failed.network_update, false);
1827         return network_update_ref;
1828 }
1829 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_all_paths_failed"))) TS_LDKEvent_PaymentPathFailed_get_all_paths_failed(uint64_t ptr) {
1830         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1831         assert(obj->tag == LDKEvent_PaymentPathFailed);
1832                         jboolean all_paths_failed_conv = obj->payment_path_failed.all_paths_failed;
1833         return all_paths_failed_conv;
1834 }
1835 uint64_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_path"))) TS_LDKEvent_PaymentPathFailed_get_path(uint64_t ptr) {
1836         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1837         assert(obj->tag == LDKEvent_PaymentPathFailed);
1838                         LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
1839                         uint64_tArray path_arr = NULL;
1840                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1841                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1842                         for (size_t k = 0; k < path_var.datalen; k++) {
1843                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1844                                 uint64_t path_conv_10_ref = 0;
1845                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1846                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1847                                 path_arr_ptr[k] = path_conv_10_ref;
1848                         }
1849                         
1850         return path_arr;
1851 }
1852 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_short_channel_id"))) TS_LDKEvent_PaymentPathFailed_get_short_channel_id(uint64_t ptr) {
1853         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1854         assert(obj->tag == LDKEvent_PaymentPathFailed);
1855                         uint64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
1856         return short_channel_id_ref;
1857 }
1858 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_retry"))) TS_LDKEvent_PaymentPathFailed_get_retry(uint64_t ptr) {
1859         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1860         assert(obj->tag == LDKEvent_PaymentPathFailed);
1861                         LDKRouteParameters retry_var = obj->payment_path_failed.retry;
1862                         uint64_t retry_ref = 0;
1863                         CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
1864                         retry_ref = tag_ptr(retry_var.inner, false);
1865         return retry_ref;
1866 }
1867 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_id"))) TS_LDKEvent_ProbeSuccessful_get_payment_id(uint64_t ptr) {
1868         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1869         assert(obj->tag == LDKEvent_ProbeSuccessful);
1870                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1871                         memcpy(payment_id_arr->elems, obj->probe_successful.payment_id.data, 32);
1872         return payment_id_arr;
1873 }
1874 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_hash"))) TS_LDKEvent_ProbeSuccessful_get_payment_hash(uint64_t ptr) {
1875         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1876         assert(obj->tag == LDKEvent_ProbeSuccessful);
1877                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1878                         memcpy(payment_hash_arr->elems, obj->probe_successful.payment_hash.data, 32);
1879         return payment_hash_arr;
1880 }
1881 uint64_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_path"))) TS_LDKEvent_ProbeSuccessful_get_path(uint64_t ptr) {
1882         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1883         assert(obj->tag == LDKEvent_ProbeSuccessful);
1884                         LDKCVec_RouteHopZ path_var = obj->probe_successful.path;
1885                         uint64_tArray path_arr = NULL;
1886                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1887                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1888                         for (size_t k = 0; k < path_var.datalen; k++) {
1889                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1890                                 uint64_t path_conv_10_ref = 0;
1891                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1892                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1893                                 path_arr_ptr[k] = path_conv_10_ref;
1894                         }
1895                         
1896         return path_arr;
1897 }
1898 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_id"))) TS_LDKEvent_ProbeFailed_get_payment_id(uint64_t ptr) {
1899         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1900         assert(obj->tag == LDKEvent_ProbeFailed);
1901                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1902                         memcpy(payment_id_arr->elems, obj->probe_failed.payment_id.data, 32);
1903         return payment_id_arr;
1904 }
1905 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_hash"))) TS_LDKEvent_ProbeFailed_get_payment_hash(uint64_t ptr) {
1906         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1907         assert(obj->tag == LDKEvent_ProbeFailed);
1908                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1909                         memcpy(payment_hash_arr->elems, obj->probe_failed.payment_hash.data, 32);
1910         return payment_hash_arr;
1911 }
1912 uint64_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_path"))) TS_LDKEvent_ProbeFailed_get_path(uint64_t ptr) {
1913         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1914         assert(obj->tag == LDKEvent_ProbeFailed);
1915                         LDKCVec_RouteHopZ path_var = obj->probe_failed.path;
1916                         uint64_tArray path_arr = NULL;
1917                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1918                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1919                         for (size_t k = 0; k < path_var.datalen; k++) {
1920                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1921                                 uint64_t path_conv_10_ref = 0;
1922                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1923                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1924                                 path_arr_ptr[k] = path_conv_10_ref;
1925                         }
1926                         
1927         return path_arr;
1928 }
1929 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_short_channel_id"))) TS_LDKEvent_ProbeFailed_get_short_channel_id(uint64_t ptr) {
1930         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1931         assert(obj->tag == LDKEvent_ProbeFailed);
1932                         uint64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
1933         return short_channel_id_ref;
1934 }
1935 int64_t __attribute__((export_name("TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable"))) TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(uint64_t ptr) {
1936         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1937         assert(obj->tag == LDKEvent_PendingHTLCsForwardable);
1938                         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
1939         return time_forwardable_conv;
1940 }
1941 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_intercept_id"))) TS_LDKEvent_HTLCIntercepted_get_intercept_id(uint64_t ptr) {
1942         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1943         assert(obj->tag == LDKEvent_HTLCIntercepted);
1944                         int8_tArray intercept_id_arr = init_int8_tArray(32, __LINE__);
1945                         memcpy(intercept_id_arr->elems, obj->htlc_intercepted.intercept_id.data, 32);
1946         return intercept_id_arr;
1947 }
1948 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid"))) TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid(uint64_t ptr) {
1949         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1950         assert(obj->tag == LDKEvent_HTLCIntercepted);
1951                         int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid;
1952         return requested_next_hop_scid_conv;
1953 }
1954 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_payment_hash"))) TS_LDKEvent_HTLCIntercepted_get_payment_hash(uint64_t ptr) {
1955         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1956         assert(obj->tag == LDKEvent_HTLCIntercepted);
1957                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1958                         memcpy(payment_hash_arr->elems, obj->htlc_intercepted.payment_hash.data, 32);
1959         return payment_hash_arr;
1960 }
1961 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat(uint64_t ptr) {
1962         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1963         assert(obj->tag == LDKEvent_HTLCIntercepted);
1964                         int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat;
1965         return inbound_amount_msat_conv;
1966 }
1967 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat(uint64_t ptr) {
1968         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1969         assert(obj->tag == LDKEvent_HTLCIntercepted);
1970                         int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat;
1971         return expected_outbound_amount_msat_conv;
1972 }
1973 uint64_tArray __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_outputs"))) TS_LDKEvent_SpendableOutputs_get_outputs(uint64_t ptr) {
1974         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1975         assert(obj->tag == LDKEvent_SpendableOutputs);
1976                         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1977                         uint64_tArray outputs_arr = NULL;
1978                         outputs_arr = init_uint64_tArray(outputs_var.datalen, __LINE__);
1979                         uint64_t *outputs_arr_ptr = (uint64_t*)(((uint8_t*)outputs_arr) + 8);
1980                         for (size_t b = 0; b < outputs_var.datalen; b++) {
1981                                 uint64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
1982                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
1983                         }
1984                         
1985         return outputs_arr;
1986 }
1987 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_prev_channel_id"))) TS_LDKEvent_PaymentForwarded_get_prev_channel_id(uint64_t ptr) {
1988         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1989         assert(obj->tag == LDKEvent_PaymentForwarded);
1990                         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
1991                         memcpy(prev_channel_id_arr->elems, obj->payment_forwarded.prev_channel_id.data, 32);
1992         return prev_channel_id_arr;
1993 }
1994 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_next_channel_id"))) TS_LDKEvent_PaymentForwarded_get_next_channel_id(uint64_t ptr) {
1995         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1996         assert(obj->tag == LDKEvent_PaymentForwarded);
1997                         int8_tArray next_channel_id_arr = init_int8_tArray(32, __LINE__);
1998                         memcpy(next_channel_id_arr->elems, obj->payment_forwarded.next_channel_id.data, 32);
1999         return next_channel_id_arr;
2000 }
2001 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_fee_earned_msat"))) TS_LDKEvent_PaymentForwarded_get_fee_earned_msat(uint64_t ptr) {
2002         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2003         assert(obj->tag == LDKEvent_PaymentForwarded);
2004                         uint64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
2005         return fee_earned_msat_ref;
2006 }
2007 jboolean __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx"))) TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(uint64_t ptr) {
2008         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2009         assert(obj->tag == LDKEvent_PaymentForwarded);
2010                         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
2011         return claim_from_onchain_tx_conv;
2012 }
2013 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_id"))) TS_LDKEvent_ChannelReady_get_channel_id(uint64_t ptr) {
2014         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2015         assert(obj->tag == LDKEvent_ChannelReady);
2016                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
2017                         memcpy(channel_id_arr->elems, obj->channel_ready.channel_id.data, 32);
2018         return channel_id_arr;
2019 }
2020 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_user_channel_id"))) TS_LDKEvent_ChannelReady_get_user_channel_id(uint64_t ptr) {
2021         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2022         assert(obj->tag == LDKEvent_ChannelReady);
2023                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
2024                         memcpy(user_channel_id_arr->elems, obj->channel_ready.user_channel_id.le_bytes, 16);
2025         return user_channel_id_arr;
2026 }
2027 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_counterparty_node_id"))) TS_LDKEvent_ChannelReady_get_counterparty_node_id(uint64_t ptr) {
2028         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2029         assert(obj->tag == LDKEvent_ChannelReady);
2030                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
2031                         memcpy(counterparty_node_id_arr->elems, obj->channel_ready.counterparty_node_id.compressed_form, 33);
2032         return counterparty_node_id_arr;
2033 }
2034 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_type"))) TS_LDKEvent_ChannelReady_get_channel_type(uint64_t ptr) {
2035         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2036         assert(obj->tag == LDKEvent_ChannelReady);
2037                         LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type;
2038                         uint64_t channel_type_ref = 0;
2039                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
2040                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
2041         return channel_type_ref;
2042 }
2043 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_id"))) TS_LDKEvent_ChannelClosed_get_channel_id(uint64_t ptr) {
2044         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2045         assert(obj->tag == LDKEvent_ChannelClosed);
2046                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
2047                         memcpy(channel_id_arr->elems, obj->channel_closed.channel_id.data, 32);
2048         return channel_id_arr;
2049 }
2050 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_user_channel_id"))) TS_LDKEvent_ChannelClosed_get_user_channel_id(uint64_t ptr) {
2051         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2052         assert(obj->tag == LDKEvent_ChannelClosed);
2053                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
2054                         memcpy(user_channel_id_arr->elems, obj->channel_closed.user_channel_id.le_bytes, 16);
2055         return user_channel_id_arr;
2056 }
2057 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_reason"))) TS_LDKEvent_ChannelClosed_get_reason(uint64_t ptr) {
2058         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2059         assert(obj->tag == LDKEvent_ChannelClosed);
2060                         uint64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
2061         return reason_ref;
2062 }
2063 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_channel_id"))) TS_LDKEvent_DiscardFunding_get_channel_id(uint64_t ptr) {
2064         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2065         assert(obj->tag == LDKEvent_DiscardFunding);
2066                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
2067                         memcpy(channel_id_arr->elems, obj->discard_funding.channel_id.data, 32);
2068         return channel_id_arr;
2069 }
2070 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_transaction"))) TS_LDKEvent_DiscardFunding_get_transaction(uint64_t ptr) {
2071         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2072         assert(obj->tag == LDKEvent_DiscardFunding);
2073                         LDKTransaction transaction_var = obj->discard_funding.transaction;
2074                         int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen, __LINE__);
2075                         memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
2076         return transaction_arr;
2077 }
2078 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id"))) TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id(uint64_t ptr) {
2079         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2080         assert(obj->tag == LDKEvent_OpenChannelRequest);
2081                         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
2082                         memcpy(temporary_channel_id_arr->elems, obj->open_channel_request.temporary_channel_id.data, 32);
2083         return temporary_channel_id_arr;
2084 }
2085 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id"))) TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id(uint64_t ptr) {
2086         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2087         assert(obj->tag == LDKEvent_OpenChannelRequest);
2088                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
2089                         memcpy(counterparty_node_id_arr->elems, obj->open_channel_request.counterparty_node_id.compressed_form, 33);
2090         return counterparty_node_id_arr;
2091 }
2092 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_funding_satoshis"))) TS_LDKEvent_OpenChannelRequest_get_funding_satoshis(uint64_t ptr) {
2093         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2094         assert(obj->tag == LDKEvent_OpenChannelRequest);
2095                         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
2096         return funding_satoshis_conv;
2097 }
2098 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_push_msat"))) TS_LDKEvent_OpenChannelRequest_get_push_msat(uint64_t ptr) {
2099         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2100         assert(obj->tag == LDKEvent_OpenChannelRequest);
2101                         int64_t push_msat_conv = obj->open_channel_request.push_msat;
2102         return push_msat_conv;
2103 }
2104 uint64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_channel_type"))) TS_LDKEvent_OpenChannelRequest_get_channel_type(uint64_t ptr) {
2105         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2106         assert(obj->tag == LDKEvent_OpenChannelRequest);
2107                         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
2108                         uint64_t channel_type_ref = 0;
2109                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
2110                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
2111         return channel_type_ref;
2112 }
2113 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id"))) TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id(uint64_t ptr) {
2114         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2115         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
2116                         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
2117                         memcpy(prev_channel_id_arr->elems, obj->htlc_handling_failed.prev_channel_id.data, 32);
2118         return prev_channel_id_arr;
2119 }
2120 uint64_t __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination"))) TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination(uint64_t ptr) {
2121         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2122         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
2123                         uint64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
2124         return failed_next_destination_ref;
2125 }
2126 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_ty_from_ptr"))) TS_LDKCOption_EventZ_ty_from_ptr(uint64_t ptr) {
2127         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
2128         switch(obj->tag) {
2129                 case LDKCOption_EventZ_Some: return 0;
2130                 case LDKCOption_EventZ_None: return 1;
2131                 default: abort();
2132         }
2133 }
2134 uint64_t __attribute__((export_name("TS_LDKCOption_EventZ_Some_get_some"))) TS_LDKCOption_EventZ_Some_get_some(uint64_t ptr) {
2135         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
2136         assert(obj->tag == LDKCOption_EventZ_Some);
2137                         uint64_t some_ref = tag_ptr(&obj->some, false);
2138         return some_ref;
2139 }
2140 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2141 CHECK(owner->result_ok);
2142         return COption_EventZ_clone(&*owner->contents.result);
2143 }
2144 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_ok"))) TS_CResult_COption_EventZDecodeErrorZ_get_ok(uint64_t owner) {
2145         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
2146         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
2147         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
2148         uint64_t ret_ref = tag_ptr(ret_copy, true);
2149         return ret_ref;
2150 }
2151
2152 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2153 CHECK(!owner->result_ok);
2154         return DecodeError_clone(&*owner->contents.err);
2155 }
2156 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_err"))) TS_CResult_COption_EventZDecodeErrorZ_get_err(uint64_t owner) {
2157         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
2158         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2159         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
2160         uint64_t ret_ref = tag_ptr(ret_copy, true);
2161         return ret_ref;
2162 }
2163
2164 uint32_t __attribute__((export_name("TS_LDKErrorAction_ty_from_ptr"))) TS_LDKErrorAction_ty_from_ptr(uint64_t ptr) {
2165         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2166         switch(obj->tag) {
2167                 case LDKErrorAction_DisconnectPeer: return 0;
2168                 case LDKErrorAction_IgnoreError: return 1;
2169                 case LDKErrorAction_IgnoreAndLog: return 2;
2170                 case LDKErrorAction_IgnoreDuplicateGossip: return 3;
2171                 case LDKErrorAction_SendErrorMessage: return 4;
2172                 case LDKErrorAction_SendWarningMessage: return 5;
2173                 default: abort();
2174         }
2175 }
2176 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeer_get_msg"))) TS_LDKErrorAction_DisconnectPeer_get_msg(uint64_t ptr) {
2177         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2178         assert(obj->tag == LDKErrorAction_DisconnectPeer);
2179                         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
2180                         uint64_t msg_ref = 0;
2181                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2182                         msg_ref = tag_ptr(msg_var.inner, false);
2183         return msg_ref;
2184 }
2185 uint32_t __attribute__((export_name("TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log"))) TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(uint64_t ptr) {
2186         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2187         assert(obj->tag == LDKErrorAction_IgnoreAndLog);
2188                         uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
2189         return ignore_and_log_conv;
2190 }
2191 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendErrorMessage_get_msg"))) TS_LDKErrorAction_SendErrorMessage_get_msg(uint64_t ptr) {
2192         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2193         assert(obj->tag == LDKErrorAction_SendErrorMessage);
2194                         LDKErrorMessage msg_var = obj->send_error_message.msg;
2195                         uint64_t msg_ref = 0;
2196                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2197                         msg_ref = tag_ptr(msg_var.inner, false);
2198         return msg_ref;
2199 }
2200 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_msg"))) TS_LDKErrorAction_SendWarningMessage_get_msg(uint64_t ptr) {
2201         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2202         assert(obj->tag == LDKErrorAction_SendWarningMessage);
2203                         LDKWarningMessage msg_var = obj->send_warning_message.msg;
2204                         uint64_t msg_ref = 0;
2205                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2206                         msg_ref = tag_ptr(msg_var.inner, false);
2207         return msg_ref;
2208 }
2209 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_log_level"))) TS_LDKErrorAction_SendWarningMessage_get_log_level(uint64_t ptr) {
2210         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2211         assert(obj->tag == LDKErrorAction_SendWarningMessage);
2212                         uint32_t log_level_conv = LDKLevel_to_js(obj->send_warning_message.log_level);
2213         return log_level_conv;
2214 }
2215 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_ty_from_ptr"))) TS_LDKMessageSendEvent_ty_from_ptr(uint64_t ptr) {
2216         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2217         switch(obj->tag) {
2218                 case LDKMessageSendEvent_SendAcceptChannel: return 0;
2219                 case LDKMessageSendEvent_SendOpenChannel: return 1;
2220                 case LDKMessageSendEvent_SendFundingCreated: return 2;
2221                 case LDKMessageSendEvent_SendFundingSigned: return 3;
2222                 case LDKMessageSendEvent_SendChannelReady: return 4;
2223                 case LDKMessageSendEvent_SendAnnouncementSignatures: return 5;
2224                 case LDKMessageSendEvent_UpdateHTLCs: return 6;
2225                 case LDKMessageSendEvent_SendRevokeAndACK: return 7;
2226                 case LDKMessageSendEvent_SendClosingSigned: return 8;
2227                 case LDKMessageSendEvent_SendShutdown: return 9;
2228                 case LDKMessageSendEvent_SendChannelReestablish: return 10;
2229                 case LDKMessageSendEvent_SendChannelAnnouncement: return 11;
2230                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 12;
2231                 case LDKMessageSendEvent_BroadcastChannelUpdate: return 13;
2232                 case LDKMessageSendEvent_SendChannelUpdate: return 14;
2233                 case LDKMessageSendEvent_HandleError: return 15;
2234                 case LDKMessageSendEvent_SendChannelRangeQuery: return 16;
2235                 case LDKMessageSendEvent_SendShortIdsQuery: return 17;
2236                 case LDKMessageSendEvent_SendReplyChannelRange: return 18;
2237                 case LDKMessageSendEvent_SendGossipTimestampFilter: return 19;
2238                 default: abort();
2239         }
2240 }
2241 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id(uint64_t ptr) {
2242         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2243         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2244                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2245                         memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
2246         return node_id_arr;
2247 }
2248 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_msg(uint64_t ptr) {
2249         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2250         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2251                         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
2252                         uint64_t msg_ref = 0;
2253                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2254                         msg_ref = tag_ptr(msg_var.inner, false);
2255         return msg_ref;
2256 }
2257 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannel_get_node_id(uint64_t ptr) {
2258         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2259         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2260                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2261                         memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
2262         return node_id_arr;
2263 }
2264 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannel_get_msg(uint64_t ptr) {
2265         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2266         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2267                         LDKOpenChannel msg_var = obj->send_open_channel.msg;
2268                         uint64_t msg_ref = 0;
2269                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2270                         msg_ref = tag_ptr(msg_var.inner, false);
2271         return msg_ref;
2272 }
2273 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_node_id"))) TS_LDKMessageSendEvent_SendFundingCreated_get_node_id(uint64_t ptr) {
2274         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2275         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2276                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2277                         memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
2278         return node_id_arr;
2279 }
2280 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_msg"))) TS_LDKMessageSendEvent_SendFundingCreated_get_msg(uint64_t ptr) {
2281         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2282         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2283                         LDKFundingCreated msg_var = obj->send_funding_created.msg;
2284                         uint64_t msg_ref = 0;
2285                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2286                         msg_ref = tag_ptr(msg_var.inner, false);
2287         return msg_ref;
2288 }
2289 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendFundingSigned_get_node_id(uint64_t ptr) {
2290         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2291         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2292                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2293                         memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
2294         return node_id_arr;
2295 }
2296 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_msg"))) TS_LDKMessageSendEvent_SendFundingSigned_get_msg(uint64_t ptr) {
2297         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2298         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2299                         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
2300                         uint64_t msg_ref = 0;
2301                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2302                         msg_ref = tag_ptr(msg_var.inner, false);
2303         return msg_ref;
2304 }
2305 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReady_get_node_id(uint64_t ptr) {
2306         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2307         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
2308                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2309                         memcpy(node_id_arr->elems, obj->send_channel_ready.node_id.compressed_form, 33);
2310         return node_id_arr;
2311 }
2312 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_msg"))) TS_LDKMessageSendEvent_SendChannelReady_get_msg(uint64_t ptr) {
2313         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2314         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
2315                         LDKChannelReady msg_var = obj->send_channel_ready.msg;
2316                         uint64_t msg_ref = 0;
2317                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2318                         msg_ref = tag_ptr(msg_var.inner, false);
2319         return msg_ref;
2320 }
2321 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(uint64_t ptr) {
2322         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2323         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2324                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2325                         memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
2326         return node_id_arr;
2327 }
2328 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(uint64_t ptr) {
2329         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2330         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2331                         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
2332                         uint64_t msg_ref = 0;
2333                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2334                         msg_ref = tag_ptr(msg_var.inner, false);
2335         return msg_ref;
2336 }
2337 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id(uint64_t ptr) {
2338         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2339         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
2340                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2341                         memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
2342         return node_id_arr;
2343 }
2344 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_updates"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_updates(uint64_t ptr) {
2345         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2346         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
2347                         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
2348                         uint64_t updates_ref = 0;
2349                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
2350                         updates_ref = tag_ptr(updates_var.inner, false);
2351         return updates_ref;
2352 }
2353 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(uint64_t ptr) {
2354         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2355         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
2356                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2357                         memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
2358         return node_id_arr;
2359 }
2360 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg(uint64_t ptr) {
2361         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2362         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
2363                         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
2364                         uint64_t msg_ref = 0;
2365                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2366                         msg_ref = tag_ptr(msg_var.inner, false);
2367         return msg_ref;
2368 }
2369 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendClosingSigned_get_node_id(uint64_t ptr) {
2370         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2371         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
2372                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2373                         memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
2374         return node_id_arr;
2375 }
2376 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_msg"))) TS_LDKMessageSendEvent_SendClosingSigned_get_msg(uint64_t ptr) {
2377         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2378         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
2379                         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
2380                         uint64_t msg_ref = 0;
2381                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2382                         msg_ref = tag_ptr(msg_var.inner, false);
2383         return msg_ref;
2384 }
2385 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_node_id"))) TS_LDKMessageSendEvent_SendShutdown_get_node_id(uint64_t ptr) {
2386         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2387         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
2388                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2389                         memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
2390         return node_id_arr;
2391 }
2392 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_msg"))) TS_LDKMessageSendEvent_SendShutdown_get_msg(uint64_t ptr) {
2393         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2394         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
2395                         LDKShutdown msg_var = obj->send_shutdown.msg;
2396                         uint64_t msg_ref = 0;
2397                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2398                         msg_ref = tag_ptr(msg_var.inner, false);
2399         return msg_ref;
2400 }
2401 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id(uint64_t ptr) {
2402         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2403         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
2404                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2405                         memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
2406         return node_id_arr;
2407 }
2408 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_msg"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_msg(uint64_t ptr) {
2409         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2410         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
2411                         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
2412                         uint64_t msg_ref = 0;
2413                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2414                         msg_ref = tag_ptr(msg_var.inner, false);
2415         return msg_ref;
2416 }
2417 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id(uint64_t ptr) {
2418         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2419         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
2420                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2421                         memcpy(node_id_arr->elems, obj->send_channel_announcement.node_id.compressed_form, 33);
2422         return node_id_arr;
2423 }
2424 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg(uint64_t ptr) {
2425         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2426         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
2427                         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
2428                         uint64_t msg_ref = 0;
2429                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2430                         msg_ref = tag_ptr(msg_var.inner, false);
2431         return msg_ref;
2432 }
2433 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg(uint64_t ptr) {
2434         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2435         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
2436                         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
2437                         uint64_t update_msg_ref = 0;
2438                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
2439                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
2440         return update_msg_ref;
2441 }
2442 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(uint64_t ptr) {
2443         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2444         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
2445                         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
2446                         uint64_t msg_ref = 0;
2447                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2448                         msg_ref = tag_ptr(msg_var.inner, false);
2449         return msg_ref;
2450 }
2451 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(uint64_t ptr) {
2452         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2453         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
2454                         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
2455                         uint64_t update_msg_ref = 0;
2456                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
2457                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
2458         return update_msg_ref;
2459 }
2460 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(uint64_t ptr) {
2461         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2462         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
2463                         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
2464                         uint64_t msg_ref = 0;
2465                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2466                         msg_ref = tag_ptr(msg_var.inner, false);
2467         return msg_ref;
2468 }
2469 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id(uint64_t ptr) {
2470         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2471         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
2472                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2473                         memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
2474         return node_id_arr;
2475 }
2476 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_msg(uint64_t ptr) {
2477         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2478         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
2479                         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
2480                         uint64_t msg_ref = 0;
2481                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2482                         msg_ref = tag_ptr(msg_var.inner, false);
2483         return msg_ref;
2484 }
2485 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_node_id"))) TS_LDKMessageSendEvent_HandleError_get_node_id(uint64_t ptr) {
2486         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2487         assert(obj->tag == LDKMessageSendEvent_HandleError);
2488                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2489                         memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
2490         return node_id_arr;
2491 }
2492 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_action"))) TS_LDKMessageSendEvent_HandleError_get_action(uint64_t ptr) {
2493         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2494         assert(obj->tag == LDKMessageSendEvent_HandleError);
2495                         uint64_t action_ref = tag_ptr(&obj->handle_error.action, false);
2496         return action_ref;
2497 }
2498 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(uint64_t ptr) {
2499         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2500         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
2501                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2502                         memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
2503         return node_id_arr;
2504 }
2505 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(uint64_t ptr) {
2506         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2507         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
2508                         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
2509                         uint64_t msg_ref = 0;
2510                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2511                         msg_ref = tag_ptr(msg_var.inner, false);
2512         return msg_ref;
2513 }
2514 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(uint64_t ptr) {
2515         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2516         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
2517                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2518                         memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
2519         return node_id_arr;
2520 }
2521 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg(uint64_t ptr) {
2522         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2523         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
2524                         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
2525                         uint64_t msg_ref = 0;
2526                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2527                         msg_ref = tag_ptr(msg_var.inner, false);
2528         return msg_ref;
2529 }
2530 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(uint64_t ptr) {
2531         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2532         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
2533                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2534                         memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
2535         return node_id_arr;
2536 }
2537 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg(uint64_t ptr) {
2538         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2539         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
2540                         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
2541                         uint64_t msg_ref = 0;
2542                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2543                         msg_ref = tag_ptr(msg_var.inner, false);
2544         return msg_ref;
2545 }
2546 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id(uint64_t ptr) {
2547         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2548         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
2549                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2550                         memcpy(node_id_arr->elems, obj->send_gossip_timestamp_filter.node_id.compressed_form, 33);
2551         return node_id_arr;
2552 }
2553 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg(uint64_t ptr) {
2554         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2555         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
2556                         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
2557                         uint64_t msg_ref = 0;
2558                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2559                         msg_ref = tag_ptr(msg_var.inner, false);
2560         return msg_ref;
2561 }
2562 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
2563         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
2564         for (size_t i = 0; i < ret.datalen; i++) {
2565                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
2566         }
2567         return ret;
2568 }
2569 static inline struct LDKTxOut CResult_TxOutAccessErrorZ_get_ok(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
2570 CHECK(owner->result_ok);
2571         return TxOut_clone(&*owner->contents.result);
2572 }
2573 uint64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_get_ok"))) TS_CResult_TxOutAccessErrorZ_get_ok(uint64_t owner) {
2574         LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(owner);
2575         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
2576         *ret_ref = CResult_TxOutAccessErrorZ_get_ok(owner_conv);
2577         return tag_ptr(ret_ref, true);
2578 }
2579
2580 static inline enum LDKAccessError CResult_TxOutAccessErrorZ_get_err(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
2581 CHECK(!owner->result_ok);
2582         return AccessError_clone(&*owner->contents.err);
2583 }
2584 uint32_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_get_err"))) TS_CResult_TxOutAccessErrorZ_get_err(uint64_t owner) {
2585         LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(owner);
2586         uint32_t ret_conv = LDKAccessError_to_js(CResult_TxOutAccessErrorZ_get_err(owner_conv));
2587         return ret_conv;
2588 }
2589
2590 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2591         return owner->a;
2592 }
2593 uint32_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_a"))) TS_C2Tuple_usizeTransactionZ_get_a(uint64_t owner) {
2594         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2595         uint32_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
2596         return ret_conv;
2597 }
2598
2599 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2600         return owner->b;
2601 }
2602 int8_tArray  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_b"))) TS_C2Tuple_usizeTransactionZ_get_b(uint64_t owner) {
2603         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2604         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
2605         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2606         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2607         return ret_arr;
2608 }
2609
2610 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
2611         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
2612         for (size_t i = 0; i < ret.datalen; i++) {
2613                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
2614         }
2615         return ret;
2616 }
2617 static inline struct LDKThirtyTwoBytes C2Tuple_TxidBlockHashZ_get_a(LDKC2Tuple_TxidBlockHashZ *NONNULL_PTR owner){
2618         return ThirtyTwoBytes_clone(&owner->a);
2619 }
2620 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_get_a"))) TS_C2Tuple_TxidBlockHashZ_get_a(uint64_t owner) {
2621         LDKC2Tuple_TxidBlockHashZ* owner_conv = (LDKC2Tuple_TxidBlockHashZ*)untag_ptr(owner);
2622         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
2623         memcpy(ret_arr->elems, C2Tuple_TxidBlockHashZ_get_a(owner_conv).data, 32);
2624         return ret_arr;
2625 }
2626
2627 static inline struct LDKThirtyTwoBytes C2Tuple_TxidBlockHashZ_get_b(LDKC2Tuple_TxidBlockHashZ *NONNULL_PTR owner){
2628         return ThirtyTwoBytes_clone(&owner->b);
2629 }
2630 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_get_b"))) TS_C2Tuple_TxidBlockHashZ_get_b(uint64_t owner) {
2631         LDKC2Tuple_TxidBlockHashZ* owner_conv = (LDKC2Tuple_TxidBlockHashZ*)untag_ptr(owner);
2632         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
2633         memcpy(ret_arr->elems, C2Tuple_TxidBlockHashZ_get_b(owner_conv).data, 32);
2634         return ret_arr;
2635 }
2636
2637 static inline LDKCVec_C2Tuple_TxidBlockHashZZ CVec_C2Tuple_TxidBlockHashZZ_clone(const LDKCVec_C2Tuple_TxidBlockHashZZ *orig) {
2638         LDKCVec_C2Tuple_TxidBlockHashZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ) * orig->datalen, "LDKCVec_C2Tuple_TxidBlockHashZZ clone bytes"), .datalen = orig->datalen };
2639         for (size_t i = 0; i < ret.datalen; i++) {
2640                 ret.data[i] = C2Tuple_TxidBlockHashZ_clone(&orig->data[i]);
2641         }
2642         return ret;
2643 }
2644 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_ty_from_ptr"))) TS_LDKMonitorEvent_ty_from_ptr(uint64_t ptr) {
2645         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2646         switch(obj->tag) {
2647                 case LDKMonitorEvent_HTLCEvent: return 0;
2648                 case LDKMonitorEvent_CommitmentTxConfirmed: return 1;
2649                 case LDKMonitorEvent_Completed: return 2;
2650                 case LDKMonitorEvent_UpdateFailed: return 3;
2651                 default: abort();
2652         }
2653 }
2654 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HTLCEvent_get_htlc_event"))) TS_LDKMonitorEvent_HTLCEvent_get_htlc_event(uint64_t ptr) {
2655         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2656         assert(obj->tag == LDKMonitorEvent_HTLCEvent);
2657                         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
2658                         uint64_t htlc_event_ref = 0;
2659                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
2660                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
2661         return htlc_event_ref;
2662 }
2663 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed"))) TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed(uint64_t ptr) {
2664         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2665         assert(obj->tag == LDKMonitorEvent_CommitmentTxConfirmed);
2666                         LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
2667                         uint64_t commitment_tx_confirmed_ref = 0;
2668                         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
2669                         commitment_tx_confirmed_ref = tag_ptr(commitment_tx_confirmed_var.inner, false);
2670         return commitment_tx_confirmed_ref;
2671 }
2672 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_funding_txo"))) TS_LDKMonitorEvent_Completed_get_funding_txo(uint64_t ptr) {
2673         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2674         assert(obj->tag == LDKMonitorEvent_Completed);
2675                         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
2676                         uint64_t funding_txo_ref = 0;
2677                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
2678                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
2679         return funding_txo_ref;
2680 }
2681 int64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_monitor_update_id"))) TS_LDKMonitorEvent_Completed_get_monitor_update_id(uint64_t ptr) {
2682         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2683         assert(obj->tag == LDKMonitorEvent_Completed);
2684                         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
2685         return monitor_update_id_conv;
2686 }
2687 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateFailed_get_update_failed"))) TS_LDKMonitorEvent_UpdateFailed_get_update_failed(uint64_t ptr) {
2688         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2689         assert(obj->tag == LDKMonitorEvent_UpdateFailed);
2690                         LDKOutPoint update_failed_var = obj->update_failed;
2691                         uint64_t update_failed_ref = 0;
2692                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
2693                         update_failed_ref = tag_ptr(update_failed_var.inner, false);
2694         return update_failed_ref;
2695 }
2696 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
2697         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
2698         for (size_t i = 0; i < ret.datalen; i++) {
2699                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
2700         }
2701         return ret;
2702 }
2703 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2704         LDKOutPoint ret = owner->a;
2705         ret.is_owned = false;
2706         return ret;
2707 }
2708 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(uint64_t owner) {
2709         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2710         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
2711         uint64_t ret_ref = 0;
2712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2714         return ret_ref;
2715 }
2716
2717 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2718         return CVec_MonitorEventZ_clone(&owner->b);
2719 }
2720 uint64_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(uint64_t owner) {
2721         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2722         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
2723         uint64_tArray ret_arr = NULL;
2724         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
2725         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
2726         for (size_t o = 0; o < ret_var.datalen; o++) {
2727                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
2728                 *ret_conv_14_copy = ret_var.data[o];
2729                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
2730                 ret_arr_ptr[o] = ret_conv_14_ref;
2731         }
2732         
2733         FREE(ret_var.data);
2734         return ret_arr;
2735 }
2736
2737 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2738         return owner->c;
2739 }
2740 int8_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(uint64_t owner) {
2741         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2742         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
2743         memcpy(ret_arr->elems, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form, 33);
2744         return ret_arr;
2745 }
2746
2747 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
2748         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
2749         for (size_t i = 0; i < ret.datalen; i++) {
2750                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
2751         }
2752         return ret;
2753 }
2754 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2755         LDKFixedPenaltyScorer ret = *owner->contents.result;
2756         ret.is_owned = false;
2757         return ret;
2758 }
2759 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(uint64_t owner) {
2760         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2761         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
2762         uint64_t ret_ref = 0;
2763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2765         return ret_ref;
2766 }
2767
2768 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2769 CHECK(!owner->result_ok);
2770         return DecodeError_clone(&*owner->contents.err);
2771 }
2772 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err(uint64_t owner) {
2773         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2774         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2775         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
2776         uint64_t ret_ref = tag_ptr(ret_copy, true);
2777         return ret_ref;
2778 }
2779
2780 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2781         return owner->a;
2782 }
2783 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_a"))) TS_C2Tuple_u64u64Z_get_a(uint64_t owner) {
2784         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2785         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
2786         return ret_conv;
2787 }
2788
2789 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2790         return owner->b;
2791 }
2792 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_b"))) TS_C2Tuple_u64u64Z_get_b(uint64_t owner) {
2793         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2794         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
2795         return ret_conv;
2796 }
2797
2798 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr(uint64_t ptr) {
2799         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2800         switch(obj->tag) {
2801                 case LDKCOption_C2Tuple_u64u64ZZ_Some: return 0;
2802                 case LDKCOption_C2Tuple_u64u64ZZ_None: return 1;
2803                 default: abort();
2804         }
2805 }
2806 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some(uint64_t ptr) {
2807         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2808         assert(obj->tag == LDKCOption_C2Tuple_u64u64ZZ_Some);
2809                         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
2810                         *some_conv = obj->some;
2811                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
2812         return tag_ptr(some_conv, true);
2813 }
2814 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
2815         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
2816         for (size_t i = 0; i < ret.datalen; i++) {
2817                 ret.data[i] = NodeId_clone(&orig->data[i]);
2818         }
2819         return ret;
2820 }
2821 typedef struct LDKLogger_JCalls {
2822         atomic_size_t refcnt;
2823         uint32_t instance_ptr;
2824 } LDKLogger_JCalls;
2825 static void LDKLogger_JCalls_free(void* this_arg) {
2826         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2827         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2828                 FREE(j_calls);
2829         }
2830 }
2831 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
2832         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2833         LDKRecord record_var = *record;
2834         uint64_t record_ref = 0;
2835         record_var = Record_clone(&record_var);
2836         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
2837         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
2838         js_invoke_function_buuuuu(j_calls->instance_ptr, 0, record_ref, 0, 0, 0, 0, 0);
2839 }
2840 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
2841         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
2842         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2843 }
2844 static inline LDKLogger LDKLogger_init (JSValue o) {
2845         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2846         atomic_init(&calls->refcnt, 1);
2847         calls->instance_ptr = o;
2848
2849         LDKLogger ret = {
2850                 .this_arg = (void*) calls,
2851                 .log = log_LDKLogger_jcall,
2852                 .free = LDKLogger_JCalls_free,
2853         };
2854         return ret;
2855 }
2856 uint64_t  __attribute__((export_name("TS_LDKLogger_new"))) TS_LDKLogger_new(JSValue o) {
2857         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2858         *res_ptr = LDKLogger_init(o);
2859         return tag_ptr(res_ptr, true);
2860 }
2861 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2862         LDKProbabilisticScorer ret = *owner->contents.result;
2863         ret.is_owned = false;
2864         return ret;
2865 }
2866 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok(uint64_t owner) {
2867         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
2868         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
2869         uint64_t ret_ref = 0;
2870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2872         return ret_ref;
2873 }
2874
2875 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2876 CHECK(!owner->result_ok);
2877         return DecodeError_clone(&*owner->contents.err);
2878 }
2879 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err(uint64_t owner) {
2880         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
2881         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2882         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
2883         uint64_t ret_ref = tag_ptr(ret_copy, true);
2884         return ret_ref;
2885 }
2886
2887 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
2888         LDKInitFeatures ret = *owner->contents.result;
2889         ret.is_owned = false;
2890         return ret;
2891 }
2892 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2893         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
2894         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
2895         uint64_t ret_ref = 0;
2896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2898         return ret_ref;
2899 }
2900
2901 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
2902 CHECK(!owner->result_ok);
2903         return DecodeError_clone(&*owner->contents.err);
2904 }
2905 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_err"))) TS_CResult_InitFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2906         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
2907         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2908         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
2909         uint64_t ret_ref = tag_ptr(ret_copy, true);
2910         return ret_ref;
2911 }
2912
2913 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
2914         LDKChannelFeatures ret = *owner->contents.result;
2915         ret.is_owned = false;
2916         return ret;
2917 }
2918 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2919         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
2920         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
2921         uint64_t ret_ref = 0;
2922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2924         return ret_ref;
2925 }
2926
2927 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
2928 CHECK(!owner->result_ok);
2929         return DecodeError_clone(&*owner->contents.err);
2930 }
2931 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2932         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
2933         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2934         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
2935         uint64_t ret_ref = tag_ptr(ret_copy, true);
2936         return ret_ref;
2937 }
2938
2939 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2940         LDKNodeFeatures ret = *owner->contents.result;
2941         ret.is_owned = false;
2942         return ret;
2943 }
2944 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2945         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
2946         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
2947         uint64_t ret_ref = 0;
2948         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2949         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2950         return ret_ref;
2951 }
2952
2953 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2954 CHECK(!owner->result_ok);
2955         return DecodeError_clone(&*owner->contents.err);
2956 }
2957 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2958         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
2959         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2960         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
2961         uint64_t ret_ref = tag_ptr(ret_copy, true);
2962         return ret_ref;
2963 }
2964
2965 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
2966         LDKInvoiceFeatures ret = *owner->contents.result;
2967         ret.is_owned = false;
2968         return ret;
2969 }
2970 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2971         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
2972         LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
2973         uint64_t ret_ref = 0;
2974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2976         return ret_ref;
2977 }
2978
2979 static inline struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
2980 CHECK(!owner->result_ok);
2981         return DecodeError_clone(&*owner->contents.err);
2982 }
2983 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2984         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
2985         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2986         *ret_copy = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
2987         uint64_t ret_ref = tag_ptr(ret_copy, true);
2988         return ret_ref;
2989 }
2990
2991 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2992         LDKChannelTypeFeatures ret = *owner->contents.result;
2993         ret.is_owned = false;
2994         return ret;
2995 }
2996 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2997         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
2998         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
2999         uint64_t ret_ref = 0;
3000         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3001         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3002         return ret_ref;
3003 }
3004
3005 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3006 CHECK(!owner->result_ok);
3007         return DecodeError_clone(&*owner->contents.err);
3008 }
3009 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3010         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3011         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3012         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
3013         uint64_t ret_ref = tag_ptr(ret_copy, true);
3014         return ret_ref;
3015 }
3016
3017 static inline struct LDKOfferFeatures CResult_OfferFeaturesDecodeErrorZ_get_ok(LDKCResult_OfferFeaturesDecodeErrorZ *NONNULL_PTR owner){
3018         LDKOfferFeatures ret = *owner->contents.result;
3019         ret.is_owned = false;
3020         return ret;
3021 }
3022 uint64_t  __attribute__((export_name("TS_CResult_OfferFeaturesDecodeErrorZ_get_ok"))) TS_CResult_OfferFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3023         LDKCResult_OfferFeaturesDecodeErrorZ* owner_conv = (LDKCResult_OfferFeaturesDecodeErrorZ*)untag_ptr(owner);
3024         LDKOfferFeatures ret_var = CResult_OfferFeaturesDecodeErrorZ_get_ok(owner_conv);
3025         uint64_t ret_ref = 0;
3026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3028         return ret_ref;
3029 }
3030
3031 static inline struct LDKDecodeError CResult_OfferFeaturesDecodeErrorZ_get_err(LDKCResult_OfferFeaturesDecodeErrorZ *NONNULL_PTR owner){
3032 CHECK(!owner->result_ok);
3033         return DecodeError_clone(&*owner->contents.err);
3034 }
3035 uint64_t  __attribute__((export_name("TS_CResult_OfferFeaturesDecodeErrorZ_get_err"))) TS_CResult_OfferFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3036         LDKCResult_OfferFeaturesDecodeErrorZ* owner_conv = (LDKCResult_OfferFeaturesDecodeErrorZ*)untag_ptr(owner);
3037         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3038         *ret_copy = CResult_OfferFeaturesDecodeErrorZ_get_err(owner_conv);
3039         uint64_t ret_ref = tag_ptr(ret_copy, true);
3040         return ret_ref;
3041 }
3042
3043 static inline struct LDKInvoiceRequestFeatures CResult_InvoiceRequestFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ *NONNULL_PTR owner){
3044         LDKInvoiceRequestFeatures ret = *owner->contents.result;
3045         ret.is_owned = false;
3046         return ret;
3047 }
3048 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3049         LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceRequestFeaturesDecodeErrorZ*)untag_ptr(owner);
3050         LDKInvoiceRequestFeatures ret_var = CResult_InvoiceRequestFeaturesDecodeErrorZ_get_ok(owner_conv);
3051         uint64_t ret_ref = 0;
3052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3054         return ret_ref;
3055 }
3056
3057 static inline struct LDKDecodeError CResult_InvoiceRequestFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ *NONNULL_PTR owner){
3058 CHECK(!owner->result_ok);
3059         return DecodeError_clone(&*owner->contents.err);
3060 }
3061 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_get_err"))) TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3062         LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceRequestFeaturesDecodeErrorZ*)untag_ptr(owner);
3063         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3064         *ret_copy = CResult_InvoiceRequestFeaturesDecodeErrorZ_get_err(owner_conv);
3065         uint64_t ret_ref = tag_ptr(ret_copy, true);
3066         return ret_ref;
3067 }
3068
3069 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3070         LDKNodeId ret = *owner->contents.result;
3071         ret.is_owned = false;
3072         return ret;
3073 }
3074 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_ok"))) TS_CResult_NodeIdDecodeErrorZ_get_ok(uint64_t owner) {
3075         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3076         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
3077         uint64_t ret_ref = 0;
3078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3080         return ret_ref;
3081 }
3082
3083 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
3084 CHECK(!owner->result_ok);
3085         return DecodeError_clone(&*owner->contents.err);
3086 }
3087 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_err"))) TS_CResult_NodeIdDecodeErrorZ_get_err(uint64_t owner) {
3088         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
3089         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3090         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
3091         uint64_t ret_ref = tag_ptr(ret_copy, true);
3092         return ret_ref;
3093 }
3094
3095 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3096 CHECK(owner->result_ok);
3097         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
3098 }
3099 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint64_t owner) {
3100         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3101         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
3102         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
3103         uint64_t ret_ref = tag_ptr(ret_copy, true);
3104         return ret_ref;
3105 }
3106
3107 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
3108 CHECK(!owner->result_ok);
3109         return DecodeError_clone(&*owner->contents.err);
3110 }
3111 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint64_t owner) {
3112         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
3113         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3114         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
3115         uint64_t ret_ref = tag_ptr(ret_copy, true);
3116         return ret_ref;
3117 }
3118
3119 typedef struct LDKAccess_JCalls {
3120         atomic_size_t refcnt;
3121         uint32_t instance_ptr;
3122 } LDKAccess_JCalls;
3123 static void LDKAccess_JCalls_free(void* this_arg) {
3124         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3125         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3126                 FREE(j_calls);
3127         }
3128 }
3129 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
3130         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3131         int8_tArray genesis_hash_arr = init_int8_tArray(32, __LINE__);
3132         memcpy(genesis_hash_arr->elems, *genesis_hash, 32);
3133         int64_t short_channel_id_conv = short_channel_id;
3134         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);
3135         void* ret_ptr = untag_ptr(ret);
3136         CHECK_ACCESS(ret_ptr);
3137         LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
3138         FREE(untag_ptr(ret));
3139         return ret_conv;
3140 }
3141 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
3142         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
3143         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3144 }
3145 static inline LDKAccess LDKAccess_init (JSValue o) {
3146         LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
3147         atomic_init(&calls->refcnt, 1);
3148         calls->instance_ptr = o;
3149
3150         LDKAccess ret = {
3151                 .this_arg = (void*) calls,
3152                 .get_utxo = get_utxo_LDKAccess_jcall,
3153                 .free = LDKAccess_JCalls_free,
3154         };
3155         return ret;
3156 }
3157 uint64_t  __attribute__((export_name("TS_LDKAccess_new"))) TS_LDKAccess_new(JSValue o) {
3158         LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
3159         *res_ptr = LDKAccess_init(o);
3160         return tag_ptr(res_ptr, true);
3161 }
3162 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) {
3163         void* this_arg_ptr = untag_ptr(this_arg);
3164         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3165         LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
3166         unsigned char genesis_hash_arr[32];
3167         CHECK(genesis_hash->arr_len == 32);
3168         memcpy(genesis_hash_arr, genesis_hash->elems, 32); FREE(genesis_hash);
3169         unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
3170         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
3171         *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
3172         return tag_ptr(ret_conv, true);
3173 }
3174
3175 uint32_t __attribute__((export_name("TS_LDKCOption_AccessZ_ty_from_ptr"))) TS_LDKCOption_AccessZ_ty_from_ptr(uint64_t ptr) {
3176         LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)untag_ptr(ptr);
3177         switch(obj->tag) {
3178                 case LDKCOption_AccessZ_Some: return 0;
3179                 case LDKCOption_AccessZ_None: return 1;
3180                 default: abort();
3181         }
3182 }
3183 uint64_t __attribute__((export_name("TS_LDKCOption_AccessZ_Some_get_some"))) TS_LDKCOption_AccessZ_Some_get_some(uint64_t ptr) {
3184         LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)untag_ptr(ptr);
3185         assert(obj->tag == LDKCOption_AccessZ_Some);
3186                         LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
3187                         *some_ret = obj->some;
3188                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
3189                         if ((*some_ret).free == LDKAccess_JCalls_free) {
3190                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3191                                 LDKAccess_JCalls_cloned(&(*some_ret));
3192                         }
3193         return tag_ptr(some_ret, true);
3194 }
3195 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3196 CHECK(owner->result_ok);
3197         return *owner->contents.result;
3198 }
3199 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_ok"))) TS_CResult_boolLightningErrorZ_get_ok(uint64_t owner) {
3200         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3201         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
3202         return ret_conv;
3203 }
3204
3205 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3206         LDKLightningError ret = *owner->contents.err;
3207         ret.is_owned = false;
3208         return ret;
3209 }
3210 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_err"))) TS_CResult_boolLightningErrorZ_get_err(uint64_t owner) {
3211         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3212         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
3213         uint64_t ret_ref = 0;
3214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3216         return ret_ref;
3217 }
3218
3219 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3220         LDKChannelAnnouncement ret = owner->a;
3221         ret.is_owned = false;
3222         return ret;
3223 }
3224 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint64_t owner) {
3225         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3226         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
3227         uint64_t ret_ref = 0;
3228         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3229         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3230         return ret_ref;
3231 }
3232
3233 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3234         LDKChannelUpdate ret = owner->b;
3235         ret.is_owned = false;
3236         return ret;
3237 }
3238 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint64_t owner) {
3239         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3240         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
3241         uint64_t ret_ref = 0;
3242         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3243         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3244         return ret_ref;
3245 }
3246
3247 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3248         LDKChannelUpdate ret = owner->c;
3249         ret.is_owned = false;
3250         return ret;
3251 }
3252 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint64_t owner) {
3253         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3254         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
3255         uint64_t ret_ref = 0;
3256         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3257         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3258         return ret_ref;
3259 }
3260
3261 uint32_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr(uint64_t ptr) {
3262         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
3263         switch(obj->tag) {
3264                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: return 0;
3265                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: return 1;
3266                 default: abort();
3267         }
3268 }
3269 uint64_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some(uint64_t ptr) {
3270         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
3271         assert(obj->tag == LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some);
3272                         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
3273                         *some_conv = obj->some;
3274                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
3275         return tag_ptr(some_conv, true);
3276 }
3277 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3278 CHECK(owner->result_ok);
3279         return *owner->contents.result;
3280 }
3281 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_ok"))) TS_CResult_NoneLightningErrorZ_get_ok(uint64_t owner) {
3282         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3283         CResult_NoneLightningErrorZ_get_ok(owner_conv);
3284 }
3285
3286 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3287         LDKLightningError ret = *owner->contents.err;
3288         ret.is_owned = false;
3289         return ret;
3290 }
3291 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_err"))) TS_CResult_NoneLightningErrorZ_get_err(uint64_t owner) {
3292         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3293         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
3294         uint64_t ret_ref = 0;
3295         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3296         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3297         return ret_ref;
3298 }
3299
3300 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3301         LDKChannelUpdateInfo ret = *owner->contents.result;
3302         ret.is_owned = false;
3303         return ret;
3304 }
3305 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(uint64_t owner) {
3306         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
3307         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
3308         uint64_t ret_ref = 0;
3309         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3310         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3311         return ret_ref;
3312 }
3313
3314 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3315 CHECK(!owner->result_ok);
3316         return DecodeError_clone(&*owner->contents.err);
3317 }
3318 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err(uint64_t owner) {
3319         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
3320         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3321         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
3322         uint64_t ret_ref = tag_ptr(ret_copy, true);
3323         return ret_ref;
3324 }
3325
3326 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3327         LDKChannelInfo ret = *owner->contents.result;
3328         ret.is_owned = false;
3329         return ret;
3330 }
3331 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_get_ok(uint64_t owner) {
3332         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
3333         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
3334         uint64_t ret_ref = 0;
3335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3337         return ret_ref;
3338 }
3339
3340 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3341 CHECK(!owner->result_ok);
3342         return DecodeError_clone(&*owner->contents.err);
3343 }
3344 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelInfoDecodeErrorZ_get_err(uint64_t owner) {
3345         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
3346         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3347         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
3348         uint64_t ret_ref = tag_ptr(ret_copy, true);
3349         return ret_ref;
3350 }
3351
3352 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3353         LDKRoutingFees ret = *owner->contents.result;
3354         ret.is_owned = false;
3355         return ret;
3356 }
3357 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_get_ok(uint64_t owner) {
3358         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
3359         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
3360         uint64_t ret_ref = 0;
3361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3363         return ret_ref;
3364 }
3365
3366 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3367 CHECK(!owner->result_ok);
3368         return DecodeError_clone(&*owner->contents.err);
3369 }
3370 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_err"))) TS_CResult_RoutingFeesDecodeErrorZ_get_err(uint64_t owner) {
3371         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
3372         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3373         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
3374         uint64_t ret_ref = tag_ptr(ret_copy, true);
3375         return ret_ref;
3376 }
3377
3378 uint32_t __attribute__((export_name("TS_LDKNetAddress_ty_from_ptr"))) TS_LDKNetAddress_ty_from_ptr(uint64_t ptr) {
3379         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3380         switch(obj->tag) {
3381                 case LDKNetAddress_IPv4: return 0;
3382                 case LDKNetAddress_IPv6: return 1;
3383                 case LDKNetAddress_OnionV2: return 2;
3384                 case LDKNetAddress_OnionV3: return 3;
3385                 case LDKNetAddress_Hostname: return 4;
3386                 default: abort();
3387         }
3388 }
3389 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv4_get_addr"))) TS_LDKNetAddress_IPv4_get_addr(uint64_t ptr) {
3390         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3391         assert(obj->tag == LDKNetAddress_IPv4);
3392                         int8_tArray addr_arr = init_int8_tArray(4, __LINE__);
3393                         memcpy(addr_arr->elems, obj->i_pv4.addr.data, 4);
3394         return addr_arr;
3395 }
3396 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv4_get_port"))) TS_LDKNetAddress_IPv4_get_port(uint64_t ptr) {
3397         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3398         assert(obj->tag == LDKNetAddress_IPv4);
3399                         int16_t port_conv = obj->i_pv4.port;
3400         return port_conv;
3401 }
3402 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv6_get_addr"))) TS_LDKNetAddress_IPv6_get_addr(uint64_t ptr) {
3403         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3404         assert(obj->tag == LDKNetAddress_IPv6);
3405                         int8_tArray addr_arr = init_int8_tArray(16, __LINE__);
3406                         memcpy(addr_arr->elems, obj->i_pv6.addr.data, 16);
3407         return addr_arr;
3408 }
3409 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv6_get_port"))) TS_LDKNetAddress_IPv6_get_port(uint64_t ptr) {
3410         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3411         assert(obj->tag == LDKNetAddress_IPv6);
3412                         int16_t port_conv = obj->i_pv6.port;
3413         return port_conv;
3414 }
3415 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV2_get_onion_v2"))) TS_LDKNetAddress_OnionV2_get_onion_v2(uint64_t ptr) {
3416         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3417         assert(obj->tag == LDKNetAddress_OnionV2);
3418                         int8_tArray onion_v2_arr = init_int8_tArray(12, __LINE__);
3419                         memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
3420         return onion_v2_arr;
3421 }
3422 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_ed25519_pubkey"))) TS_LDKNetAddress_OnionV3_get_ed25519_pubkey(uint64_t ptr) {
3423         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3424         assert(obj->tag == LDKNetAddress_OnionV3);
3425                         int8_tArray ed25519_pubkey_arr = init_int8_tArray(32, __LINE__);
3426                         memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
3427         return ed25519_pubkey_arr;
3428 }
3429 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_checksum"))) TS_LDKNetAddress_OnionV3_get_checksum(uint64_t ptr) {
3430         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3431         assert(obj->tag == LDKNetAddress_OnionV3);
3432                         int16_t checksum_conv = obj->onion_v3.checksum;
3433         return checksum_conv;
3434 }
3435 int8_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_version"))) TS_LDKNetAddress_OnionV3_get_version(uint64_t ptr) {
3436         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3437         assert(obj->tag == LDKNetAddress_OnionV3);
3438                         int8_t version_conv = obj->onion_v3.version;
3439         return version_conv;
3440 }
3441 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_port"))) TS_LDKNetAddress_OnionV3_get_port(uint64_t ptr) {
3442         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3443         assert(obj->tag == LDKNetAddress_OnionV3);
3444                         int16_t port_conv = obj->onion_v3.port;
3445         return port_conv;
3446 }
3447 uint64_t __attribute__((export_name("TS_LDKNetAddress_Hostname_get_hostname"))) TS_LDKNetAddress_Hostname_get_hostname(uint64_t ptr) {
3448         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3449         assert(obj->tag == LDKNetAddress_Hostname);
3450                         LDKHostname hostname_var = obj->hostname.hostname;
3451                         uint64_t hostname_ref = 0;
3452                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
3453                         hostname_ref = tag_ptr(hostname_var.inner, false);
3454         return hostname_ref;
3455 }
3456 int16_t __attribute__((export_name("TS_LDKNetAddress_Hostname_get_port"))) TS_LDKNetAddress_Hostname_get_port(uint64_t ptr) {
3457         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3458         assert(obj->tag == LDKNetAddress_Hostname);
3459                         int16_t port_conv = obj->hostname.port;
3460         return port_conv;
3461 }
3462 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3463         LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3464         for (size_t i = 0; i < ret.datalen; i++) {
3465                 ret.data[i] = NetAddress_clone(&orig->data[i]);
3466         }
3467         return ret;
3468 }
3469 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3470         LDKNodeAnnouncementInfo ret = *owner->contents.result;
3471         ret.is_owned = false;
3472         return ret;
3473 }
3474 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint64_t owner) {
3475         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
3476         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
3477         uint64_t ret_ref = 0;
3478         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3479         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3480         return ret_ref;
3481 }
3482
3483 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3484 CHECK(!owner->result_ok);
3485         return DecodeError_clone(&*owner->contents.err);
3486 }
3487 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint64_t owner) {
3488         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
3489         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3490         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
3491         uint64_t ret_ref = tag_ptr(ret_copy, true);
3492         return ret_ref;
3493 }
3494
3495 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
3496         LDKNodeAlias ret = *owner->contents.result;
3497         ret.is_owned = false;
3498         return ret;
3499 }
3500 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_ok"))) TS_CResult_NodeAliasDecodeErrorZ_get_ok(uint64_t owner) {
3501         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
3502         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
3503         uint64_t ret_ref = 0;
3504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3506         return ret_ref;
3507 }
3508
3509 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
3510 CHECK(!owner->result_ok);
3511         return DecodeError_clone(&*owner->contents.err);
3512 }
3513 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_err"))) TS_CResult_NodeAliasDecodeErrorZ_get_err(uint64_t owner) {
3514         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
3515         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3516         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
3517         uint64_t ret_ref = tag_ptr(ret_copy, true);
3518         return ret_ref;
3519 }
3520
3521 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3522         LDKNodeInfo ret = *owner->contents.result;
3523         ret.is_owned = false;
3524         return ret;
3525 }
3526 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeInfoDecodeErrorZ_get_ok(uint64_t owner) {
3527         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
3528         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
3529         uint64_t ret_ref = 0;
3530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3532         return ret_ref;
3533 }
3534
3535 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3536 CHECK(!owner->result_ok);
3537         return DecodeError_clone(&*owner->contents.err);
3538 }
3539 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_err"))) TS_CResult_NodeInfoDecodeErrorZ_get_err(uint64_t owner) {
3540         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
3541         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3542         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
3543         uint64_t ret_ref = tag_ptr(ret_copy, true);
3544         return ret_ref;
3545 }
3546
3547 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3548         LDKNetworkGraph ret = *owner->contents.result;
3549         ret.is_owned = false;
3550         return ret;
3551 }
3552 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_get_ok(uint64_t owner) {
3553         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
3554         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
3555         uint64_t ret_ref = 0;
3556         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3557         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3558         return ret_ref;
3559 }
3560
3561 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3562 CHECK(!owner->result_ok);
3563         return DecodeError_clone(&*owner->contents.err);
3564 }
3565 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_err"))) TS_CResult_NetworkGraphDecodeErrorZ_get_err(uint64_t owner) {
3566         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
3567         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3568         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
3569         uint64_t ret_ref = tag_ptr(ret_copy, true);
3570         return ret_ref;
3571 }
3572
3573 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr"))) TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr(uint64_t ptr) {
3574         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
3575         switch(obj->tag) {
3576                 case LDKCOption_CVec_NetAddressZZ_Some: return 0;
3577                 case LDKCOption_CVec_NetAddressZZ_None: return 1;
3578                 default: abort();
3579         }
3580 }
3581 uint64_tArray __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_Some_get_some"))) TS_LDKCOption_CVec_NetAddressZZ_Some_get_some(uint64_t ptr) {
3582         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
3583         assert(obj->tag == LDKCOption_CVec_NetAddressZZ_Some);
3584                         LDKCVec_NetAddressZ some_var = obj->some;
3585                         uint64_tArray some_arr = NULL;
3586                         some_arr = init_uint64_tArray(some_var.datalen, __LINE__);
3587                         uint64_t *some_arr_ptr = (uint64_t*)(((uint8_t*)some_arr) + 8);
3588                         for (size_t m = 0; m < some_var.datalen; m++) {
3589                                 uint64_t some_conv_12_ref = tag_ptr(&some_var.data[m], false);
3590                                 some_arr_ptr[m] = some_conv_12_ref;
3591                         }
3592                         
3593         return some_arr;
3594 }
3595 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3596         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
3597         ret.is_owned = false;
3598         return ret;
3599 }
3600 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
3601         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3602         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3603         uint64_t ret_ref = 0;
3604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3606         return ret_ref;
3607 }
3608
3609 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3610 CHECK(!owner->result_ok);
3611         return DecodeError_clone(&*owner->contents.err);
3612 }
3613 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
3614         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3615         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3616         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3617         uint64_t ret_ref = tag_ptr(ret_copy, true);
3618         return ret_ref;
3619 }
3620
3621 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3622         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
3623         ret.is_owned = false;
3624         return ret;
3625 }
3626 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
3627         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3628         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3629         uint64_t ret_ref = 0;
3630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3632         return ret_ref;
3633 }
3634
3635 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3636 CHECK(!owner->result_ok);
3637         return DecodeError_clone(&*owner->contents.err);
3638 }
3639 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
3640         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3641         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3642         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3643         uint64_t ret_ref = tag_ptr(ret_copy, true);
3644         return ret_ref;
3645 }
3646
3647 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3648 CHECK(owner->result_ok);
3649         return SpendableOutputDescriptor_clone(&*owner->contents.result);
3650 }
3651 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
3652         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3653         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
3654         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3655         uint64_t ret_ref = tag_ptr(ret_copy, true);
3656         return ret_ref;
3657 }
3658
3659 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3660 CHECK(!owner->result_ok);
3661         return DecodeError_clone(&*owner->contents.err);
3662 }
3663 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
3664         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3665         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3666         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3667         uint64_t ret_ref = tag_ptr(ret_copy, true);
3668         return ret_ref;
3669 }
3670
3671 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
3672         LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
3673         for (size_t i = 0; i < ret.datalen; i++) {
3674                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
3675         }
3676         return ret;
3677 }
3678 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3679         return owner->a;
3680 }
3681 int8_tArray  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_a"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_a(uint64_t owner) {
3682         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
3683         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3684         memcpy(ret_arr->elems, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form, 64);
3685         return ret_arr;
3686 }
3687
3688 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3689         return owner->b;
3690 }
3691 ptrArray  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_b"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_b(uint64_t owner) {
3692         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
3693         LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
3694         ptrArray ret_arr = NULL;
3695         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
3696         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
3697         for (size_t m = 0; m < ret_var.datalen; m++) {
3698                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
3699                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
3700                 ret_arr_ptr[m] = ret_conv_12_arr;
3701         }
3702         
3703         return ret_arr;
3704 }
3705
3706 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3707 CHECK(owner->result_ok);
3708         return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
3709 }
3710 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint64_t owner) {
3711         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
3712         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
3713         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
3714         return tag_ptr(ret_conv, true);
3715 }
3716
3717 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3718 CHECK(!owner->result_ok);
3719         return *owner->contents.err;
3720 }
3721 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint64_t owner) {
3722         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
3723         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
3724 }
3725
3726 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3727 CHECK(owner->result_ok);
3728         return *owner->contents.result;
3729 }
3730 int8_tArray  __attribute__((export_name("TS_CResult_SignatureNoneZ_get_ok"))) TS_CResult_SignatureNoneZ_get_ok(uint64_t owner) {
3731         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
3732         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3733         memcpy(ret_arr->elems, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form, 64);
3734         return ret_arr;
3735 }
3736
3737 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3738 CHECK(!owner->result_ok);
3739         return *owner->contents.err;
3740 }
3741 void  __attribute__((export_name("TS_CResult_SignatureNoneZ_get_err"))) TS_CResult_SignatureNoneZ_get_err(uint64_t owner) {
3742         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
3743         CResult_SignatureNoneZ_get_err(owner_conv);
3744 }
3745
3746 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_a(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
3747         return owner->a;
3748 }
3749 int8_tArray  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_get_a"))) TS_C2Tuple_SignatureSignatureZ_get_a(uint64_t owner) {
3750         LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(owner);
3751         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3752         memcpy(ret_arr->elems, C2Tuple_SignatureSignatureZ_get_a(owner_conv).compact_form, 64);
3753         return ret_arr;
3754 }
3755
3756 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_b(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
3757         return owner->b;
3758 }
3759 int8_tArray  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_get_b"))) TS_C2Tuple_SignatureSignatureZ_get_b(uint64_t owner) {
3760         LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(owner);
3761         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3762         memcpy(ret_arr->elems, C2Tuple_SignatureSignatureZ_get_b(owner_conv).compact_form, 64);
3763         return ret_arr;
3764 }
3765
3766 static inline struct LDKC2Tuple_SignatureSignatureZ CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
3767 CHECK(owner->result_ok);
3768         return C2Tuple_SignatureSignatureZ_clone(&*owner->contents.result);
3769 }
3770 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(uint64_t owner) {
3771         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(owner);
3772         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
3773         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(owner_conv);
3774         return tag_ptr(ret_conv, true);
3775 }
3776
3777 static inline void CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
3778 CHECK(!owner->result_ok);
3779         return *owner->contents.err;
3780 }
3781 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(uint64_t owner) {
3782         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(owner);
3783         CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(owner_conv);
3784 }
3785
3786 static inline struct LDKSecretKey CResult_SecretKeyNoneZ_get_ok(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
3787 CHECK(owner->result_ok);
3788         return *owner->contents.result;
3789 }
3790 int8_tArray  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_get_ok"))) TS_CResult_SecretKeyNoneZ_get_ok(uint64_t owner) {
3791         LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(owner);
3792         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3793         memcpy(ret_arr->elems, CResult_SecretKeyNoneZ_get_ok(owner_conv).bytes, 32);
3794         return ret_arr;
3795 }
3796
3797 static inline void CResult_SecretKeyNoneZ_get_err(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
3798 CHECK(!owner->result_ok);
3799         return *owner->contents.err;
3800 }
3801 void  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_get_err"))) TS_CResult_SecretKeyNoneZ_get_err(uint64_t owner) {
3802         LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(owner);
3803         CResult_SecretKeyNoneZ_get_err(owner_conv);
3804 }
3805
3806 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
3807 CHECK(owner->result_ok);
3808         return *owner->contents.result;
3809 }
3810 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_ok"))) TS_CResult_PublicKeyNoneZ_get_ok(uint64_t owner) {
3811         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
3812         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3813         memcpy(ret_arr->elems, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form, 33);
3814         return ret_arr;
3815 }
3816
3817 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
3818 CHECK(!owner->result_ok);
3819         return *owner->contents.err;
3820 }
3821 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_err"))) TS_CResult_PublicKeyNoneZ_get_err(uint64_t owner) {
3822         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
3823         CResult_PublicKeyNoneZ_get_err(owner_conv);
3824 }
3825
3826 uint32_t __attribute__((export_name("TS_LDKCOption_ScalarZ_ty_from_ptr"))) TS_LDKCOption_ScalarZ_ty_from_ptr(uint64_t ptr) {
3827         LDKCOption_ScalarZ *obj = (LDKCOption_ScalarZ*)untag_ptr(ptr);
3828         switch(obj->tag) {
3829                 case LDKCOption_ScalarZ_Some: return 0;
3830                 case LDKCOption_ScalarZ_None: return 1;
3831                 default: abort();
3832         }
3833 }
3834 uint64_t __attribute__((export_name("TS_LDKCOption_ScalarZ_Some_get_some"))) TS_LDKCOption_ScalarZ_Some_get_some(uint64_t ptr) {
3835         LDKCOption_ScalarZ *obj = (LDKCOption_ScalarZ*)untag_ptr(ptr);
3836         assert(obj->tag == LDKCOption_ScalarZ_Some);
3837                         LDKBigEndianScalar* some_ref = &obj->some;
3838         return tag_ptr(some_ref, false);
3839 }
3840 static inline struct LDKThirtyTwoBytes CResult_SharedSecretNoneZ_get_ok(LDKCResult_SharedSecretNoneZ *NONNULL_PTR owner){
3841 CHECK(owner->result_ok);
3842         return ThirtyTwoBytes_clone(&*owner->contents.result);
3843 }
3844 int8_tArray  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_get_ok"))) TS_CResult_SharedSecretNoneZ_get_ok(uint64_t owner) {
3845         LDKCResult_SharedSecretNoneZ* owner_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(owner);
3846         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3847         memcpy(ret_arr->elems, CResult_SharedSecretNoneZ_get_ok(owner_conv).data, 32);
3848         return ret_arr;
3849 }
3850
3851 static inline void CResult_SharedSecretNoneZ_get_err(LDKCResult_SharedSecretNoneZ *NONNULL_PTR owner){
3852 CHECK(!owner->result_ok);
3853         return *owner->contents.err;
3854 }
3855 void  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_get_err"))) TS_CResult_SharedSecretNoneZ_get_err(uint64_t owner) {
3856         LDKCResult_SharedSecretNoneZ* owner_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(owner);
3857         CResult_SharedSecretNoneZ_get_err(owner_conv);
3858 }
3859
3860 typedef struct LDKBaseSign_JCalls {
3861         atomic_size_t refcnt;
3862         uint32_t instance_ptr;
3863 } LDKBaseSign_JCalls;
3864 static void LDKBaseSign_JCalls_free(void* this_arg) {
3865         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3866         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3867                 FREE(j_calls);
3868         }
3869 }
3870 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3871         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3872         int64_t idx_conv = idx;
3873         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 2, idx_conv, 0, 0, 0, 0, 0);
3874         LDKPublicKey ret_ref;
3875         CHECK(ret->arr_len == 33);
3876         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
3877         return ret_ref;
3878 }
3879 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3880         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3881         int64_t idx_conv = idx;
3882         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 3, idx_conv, 0, 0, 0, 0, 0);
3883         LDKThirtyTwoBytes ret_ref;
3884         CHECK(ret->arr_len == 32);
3885         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
3886         return ret_ref;
3887 }
3888 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
3889         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3890         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
3891         uint64_t holder_tx_ref = 0;
3892         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
3893         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
3894         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
3895         LDKCVec_PaymentPreimageZ preimages_var = preimages;
3896         ptrArray preimages_arr = NULL;
3897         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
3898         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
3899         for (size_t m = 0; m < preimages_var.datalen; m++) {
3900                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
3901                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
3902                 preimages_arr_ptr[m] = preimages_conv_12_arr;
3903         }
3904         
3905         FREE(preimages_var.data);
3906         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 4, holder_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
3907         void* ret_ptr = untag_ptr(ret);
3908         CHECK_ACCESS(ret_ptr);
3909         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3910         FREE(untag_ptr(ret));
3911         return ret_conv;
3912 }
3913 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
3914         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3915         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 5, 0, 0, 0, 0, 0, 0);
3916         LDKThirtyTwoBytes ret_ref;
3917         CHECK(ret->arr_len == 32);
3918         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
3919         return ret_ref;
3920 }
3921 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
3922         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3923         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
3924         uint64_t commitment_tx_ref = 0;
3925         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
3926         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3927         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
3928         LDKCVec_PaymentPreimageZ preimages_var = preimages;
3929         ptrArray preimages_arr = NULL;
3930         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
3931         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
3932         for (size_t m = 0; m < preimages_var.datalen; m++) {
3933                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
3934                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
3935                 preimages_arr_ptr[m] = preimages_conv_12_arr;
3936         }
3937         
3938         FREE(preimages_var.data);
3939         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 6, commitment_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
3940         void* ret_ptr = untag_ptr(ret);
3941         CHECK_ACCESS(ret_ptr);
3942         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3943         FREE(untag_ptr(ret));
3944         return ret_conv;
3945 }
3946 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
3947         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3948         int64_t idx_conv = idx;
3949         int8_tArray secret_arr = init_int8_tArray(32, __LINE__);
3950         memcpy(secret_arr->elems, *secret, 32);
3951         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 7, idx_conv, (uint32_t)secret_arr, 0, 0, 0, 0);
3952         void* ret_ptr = untag_ptr(ret);
3953         CHECK_ACCESS(ret_ptr);
3954         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3955         FREE(untag_ptr(ret));
3956         return ret_conv;
3957 }
3958 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
3959         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3960         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
3961         uint64_t commitment_tx_ref = 0;
3962         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
3963         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3964         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
3965         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 8, commitment_tx_ref, 0, 0, 0, 0, 0);
3966         void* ret_ptr = untag_ptr(ret);
3967         CHECK_ACCESS(ret_ptr);
3968         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3969         FREE(untag_ptr(ret));
3970         return ret_conv;
3971 }
3972 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]) {
3973         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3974         LDKTransaction justice_tx_var = justice_tx;
3975         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
3976         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
3977         Transaction_free(justice_tx_var);
3978         uint32_t input_conv = input;
3979         int64_t amount_conv = amount;
3980         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
3981         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
3982         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);
3983         void* ret_ptr = untag_ptr(ret);
3984         CHECK_ACCESS(ret_ptr);
3985         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3986         FREE(untag_ptr(ret));
3987         return ret_conv;
3988 }
3989 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) {
3990         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3991         LDKTransaction justice_tx_var = justice_tx;
3992         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
3993         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
3994         Transaction_free(justice_tx_var);
3995         uint32_t input_conv = input;
3996         int64_t amount_conv = amount;
3997         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
3998         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
3999         LDKHTLCOutputInCommitment htlc_var = *htlc;
4000         uint64_t htlc_ref = 0;
4001         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
4002         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
4003         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
4004         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);
4005         void* ret_ptr = untag_ptr(ret);
4006         CHECK_ACCESS(ret_ptr);
4007         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4008         FREE(untag_ptr(ret));
4009         return ret_conv;
4010 }
4011 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) {
4012         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4013         LDKTransaction htlc_tx_var = htlc_tx;
4014         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
4015         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
4016         Transaction_free(htlc_tx_var);
4017         uint32_t input_conv = input;
4018         int64_t amount_conv = amount;
4019         int8_tArray per_commitment_point_arr = init_int8_tArray(33, __LINE__);
4020         memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
4021         LDKHTLCOutputInCommitment htlc_var = *htlc;
4022         uint64_t htlc_ref = 0;
4023         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
4024         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
4025         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
4026         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);
4027         void* ret_ptr = untag_ptr(ret);
4028         CHECK_ACCESS(ret_ptr);
4029         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4030         FREE(untag_ptr(ret));
4031         return ret_conv;
4032 }
4033 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
4034         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4035         LDKClosingTransaction closing_tx_var = *closing_tx;
4036         uint64_t closing_tx_ref = 0;
4037         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
4038         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
4039         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
4040         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 12, closing_tx_ref, 0, 0, 0, 0, 0);
4041         void* ret_ptr = untag_ptr(ret);
4042         CHECK_ACCESS(ret_ptr);
4043         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4044         FREE(untag_ptr(ret));
4045         return ret_conv;
4046 }
4047 LDKCResult_SignatureNoneZ sign_holder_anchor_input_LDKBaseSign_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
4048         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4049         LDKTransaction anchor_tx_var = anchor_tx;
4050         int8_tArray anchor_tx_arr = init_int8_tArray(anchor_tx_var.datalen, __LINE__);
4051         memcpy(anchor_tx_arr->elems, anchor_tx_var.data, anchor_tx_var.datalen);
4052         Transaction_free(anchor_tx_var);
4053         uint32_t input_conv = input;
4054         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 13, (uint32_t)anchor_tx_arr, input_conv, 0, 0, 0, 0);
4055         void* ret_ptr = untag_ptr(ret);
4056         CHECK_ACCESS(ret_ptr);
4057         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
4058         FREE(untag_ptr(ret));
4059         return ret_conv;
4060 }
4061 LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
4062         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4063         LDKUnsignedChannelAnnouncement msg_var = *msg;
4064         uint64_t msg_ref = 0;
4065         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
4066         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4067         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
4068         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 14, msg_ref, 0, 0, 0, 0, 0);
4069         void* ret_ptr = untag_ptr(ret);
4070         CHECK_ACCESS(ret_ptr);
4071         LDKCResult_C2Tuple_SignatureSignatureZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(ret_ptr);
4072         FREE(untag_ptr(ret));
4073         return ret_conv;
4074 }
4075 void provide_channel_parameters_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
4076         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
4077         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
4078         uint64_t channel_parameters_ref = 0;
4079         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
4080         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
4081         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
4082         js_invoke_function_buuuuu(j_calls->instance_ptr, 15, channel_parameters_ref, 0, 0, 0, 0, 0);
4083 }
4084 static void LDKBaseSign_JCalls_cloned(LDKBaseSign* new_obj) {
4085         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) new_obj->this_arg;
4086         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4087 }
4088 static inline LDKBaseSign LDKBaseSign_init (JSValue o, uint64_t pubkeys) {
4089         LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
4090         atomic_init(&calls->refcnt, 1);
4091         calls->instance_ptr = o;
4092
4093         LDKChannelPublicKeys pubkeys_conv;
4094         pubkeys_conv.inner = untag_ptr(pubkeys);
4095         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
4096         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4097
4098         LDKBaseSign ret = {
4099                 .this_arg = (void*) calls,
4100                 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
4101                 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
4102                 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
4103                 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
4104                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
4105                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
4106                 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
4107                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
4108                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
4109                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
4110                 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
4111                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKBaseSign_jcall,
4112                 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
4113                 .provide_channel_parameters = provide_channel_parameters_LDKBaseSign_jcall,
4114                 .free = LDKBaseSign_JCalls_free,
4115                 .pubkeys = pubkeys_conv,
4116                 .set_pubkeys = NULL,
4117         };
4118         return ret;
4119 }
4120 uint64_t  __attribute__((export_name("TS_LDKBaseSign_new"))) TS_LDKBaseSign_new(JSValue o, uint64_t pubkeys) {
4121         LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
4122         *res_ptr = LDKBaseSign_init(o, pubkeys);
4123         return tag_ptr(res_ptr, true);
4124 }
4125 int8_tArray  __attribute__((export_name("TS_BaseSign_get_per_commitment_point"))) TS_BaseSign_get_per_commitment_point(uint64_t this_arg, int64_t idx) {
4126         void* this_arg_ptr = untag_ptr(this_arg);
4127         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4128         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4129         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
4130         memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
4131         return ret_arr;
4132 }
4133
4134 int8_tArray  __attribute__((export_name("TS_BaseSign_release_commitment_secret"))) TS_BaseSign_release_commitment_secret(uint64_t this_arg, int64_t idx) {
4135         void* this_arg_ptr = untag_ptr(this_arg);
4136         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4137         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4138         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4139         memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
4140         return ret_arr;
4141 }
4142
4143 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) {
4144         void* this_arg_ptr = untag_ptr(this_arg);
4145         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4146         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4147         LDKHolderCommitmentTransaction holder_tx_conv;
4148         holder_tx_conv.inner = untag_ptr(holder_tx);
4149         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
4150         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
4151         holder_tx_conv.is_owned = false;
4152         LDKCVec_PaymentPreimageZ preimages_constr;
4153         preimages_constr.datalen = preimages->arr_len;
4154         if (preimages_constr.datalen > 0)
4155                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4156         else
4157                 preimages_constr.data = NULL;
4158         int8_tArray* preimages_vals = (void*) preimages->elems;
4159         for (size_t m = 0; m < preimages_constr.datalen; m++) {
4160                 int8_tArray preimages_conv_12 = preimages_vals[m];
4161                 LDKThirtyTwoBytes preimages_conv_12_ref;
4162                 CHECK(preimages_conv_12->arr_len == 32);
4163                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
4164                 preimages_constr.data[m] = preimages_conv_12_ref;
4165         }
4166         FREE(preimages);
4167         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4168         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
4169         return tag_ptr(ret_conv, true);
4170 }
4171
4172 int8_tArray  __attribute__((export_name("TS_BaseSign_channel_keys_id"))) TS_BaseSign_channel_keys_id(uint64_t this_arg) {
4173         void* this_arg_ptr = untag_ptr(this_arg);
4174         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4175         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4176         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4177         memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
4178         return ret_arr;
4179 }
4180
4181 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) {
4182         void* this_arg_ptr = untag_ptr(this_arg);
4183         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4184         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4185         LDKCommitmentTransaction commitment_tx_conv;
4186         commitment_tx_conv.inner = untag_ptr(commitment_tx);
4187         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
4188         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4189         commitment_tx_conv.is_owned = false;
4190         LDKCVec_PaymentPreimageZ preimages_constr;
4191         preimages_constr.datalen = preimages->arr_len;
4192         if (preimages_constr.datalen > 0)
4193                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4194         else
4195                 preimages_constr.data = NULL;
4196         int8_tArray* preimages_vals = (void*) preimages->elems;
4197         for (size_t m = 0; m < preimages_constr.datalen; m++) {
4198                 int8_tArray preimages_conv_12 = preimages_vals[m];
4199                 LDKThirtyTwoBytes preimages_conv_12_ref;
4200                 CHECK(preimages_conv_12->arr_len == 32);
4201                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
4202                 preimages_constr.data[m] = preimages_conv_12_ref;
4203         }
4204         FREE(preimages);
4205         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4206         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
4207         return tag_ptr(ret_conv, true);
4208 }
4209
4210 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) {
4211         void* this_arg_ptr = untag_ptr(this_arg);
4212         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4213         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4214         unsigned char secret_arr[32];
4215         CHECK(secret->arr_len == 32);
4216         memcpy(secret_arr, secret->elems, 32); FREE(secret);
4217         unsigned char (*secret_ref)[32] = &secret_arr;
4218         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4219         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
4220         return tag_ptr(ret_conv, true);
4221 }
4222
4223 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) {
4224         void* this_arg_ptr = untag_ptr(this_arg);
4225         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4226         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4227         LDKHolderCommitmentTransaction commitment_tx_conv;
4228         commitment_tx_conv.inner = untag_ptr(commitment_tx);
4229         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
4230         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4231         commitment_tx_conv.is_owned = false;
4232         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4233         *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
4234         return tag_ptr(ret_conv, true);
4235 }
4236
4237 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) {
4238         void* this_arg_ptr = untag_ptr(this_arg);
4239         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4240         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4241         LDKTransaction justice_tx_ref;
4242         justice_tx_ref.datalen = justice_tx->arr_len;
4243         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4244         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
4245         justice_tx_ref.data_is_owned = true;
4246         unsigned char per_commitment_key_arr[32];
4247         CHECK(per_commitment_key->arr_len == 32);
4248         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
4249         unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4250         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4251         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
4252         return tag_ptr(ret_conv, true);
4253 }
4254
4255 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) {
4256         void* this_arg_ptr = untag_ptr(this_arg);
4257         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4258         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4259         LDKTransaction justice_tx_ref;
4260         justice_tx_ref.datalen = justice_tx->arr_len;
4261         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4262         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
4263         justice_tx_ref.data_is_owned = true;
4264         unsigned char per_commitment_key_arr[32];
4265         CHECK(per_commitment_key->arr_len == 32);
4266         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
4267         unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4268         LDKHTLCOutputInCommitment htlc_conv;
4269         htlc_conv.inner = untag_ptr(htlc);
4270         htlc_conv.is_owned = ptr_is_owned(htlc);
4271         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4272         htlc_conv.is_owned = false;
4273         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4274         *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);
4275         return tag_ptr(ret_conv, true);
4276 }
4277
4278 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) {
4279         void* this_arg_ptr = untag_ptr(this_arg);
4280         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4281         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4282         LDKTransaction htlc_tx_ref;
4283         htlc_tx_ref.datalen = htlc_tx->arr_len;
4284         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
4285         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
4286         htlc_tx_ref.data_is_owned = true;
4287         LDKPublicKey per_commitment_point_ref;
4288         CHECK(per_commitment_point->arr_len == 33);
4289         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
4290         LDKHTLCOutputInCommitment htlc_conv;
4291         htlc_conv.inner = untag_ptr(htlc);
4292         htlc_conv.is_owned = ptr_is_owned(htlc);
4293         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4294         htlc_conv.is_owned = false;
4295         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4296         *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);
4297         return tag_ptr(ret_conv, true);
4298 }
4299
4300 uint64_t  __attribute__((export_name("TS_BaseSign_sign_closing_transaction"))) TS_BaseSign_sign_closing_transaction(uint64_t this_arg, uint64_t closing_tx) {
4301         void* this_arg_ptr = untag_ptr(this_arg);
4302         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4303         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4304         LDKClosingTransaction closing_tx_conv;
4305         closing_tx_conv.inner = untag_ptr(closing_tx);
4306         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
4307         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
4308         closing_tx_conv.is_owned = false;
4309         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4310         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
4311         return tag_ptr(ret_conv, true);
4312 }
4313
4314 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) {
4315         void* this_arg_ptr = untag_ptr(this_arg);
4316         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4317         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4318         LDKTransaction anchor_tx_ref;
4319         anchor_tx_ref.datalen = anchor_tx->arr_len;
4320         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
4321         memcpy(anchor_tx_ref.data, anchor_tx->elems, anchor_tx_ref.datalen); FREE(anchor_tx);
4322         anchor_tx_ref.data_is_owned = true;
4323         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4324         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
4325         return tag_ptr(ret_conv, true);
4326 }
4327
4328 uint64_t  __attribute__((export_name("TS_BaseSign_sign_channel_announcement"))) TS_BaseSign_sign_channel_announcement(uint64_t this_arg, uint64_t msg) {
4329         void* this_arg_ptr = untag_ptr(this_arg);
4330         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4331         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4332         LDKUnsignedChannelAnnouncement msg_conv;
4333         msg_conv.inner = untag_ptr(msg);
4334         msg_conv.is_owned = ptr_is_owned(msg);
4335         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
4336         msg_conv.is_owned = false;
4337         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
4338         *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
4339         return tag_ptr(ret_conv, true);
4340 }
4341
4342 void  __attribute__((export_name("TS_BaseSign_provide_channel_parameters"))) TS_BaseSign_provide_channel_parameters(uint64_t this_arg, uint64_t channel_parameters) {
4343         void* this_arg_ptr = untag_ptr(this_arg);
4344         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4345         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4346         LDKChannelTransactionParameters channel_parameters_conv;
4347         channel_parameters_conv.inner = untag_ptr(channel_parameters);
4348         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
4349         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
4350         channel_parameters_conv.is_owned = false;
4351         (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv);
4352 }
4353
4354 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
4355         if (this_arg->set_pubkeys != NULL)
4356                 this_arg->set_pubkeys(this_arg);
4357         return this_arg->pubkeys;
4358 }
4359 uint64_t  __attribute__((export_name("TS_BaseSign_get_pubkeys"))) TS_BaseSign_get_pubkeys(uint64_t this_arg) {
4360         void* this_arg_ptr = untag_ptr(this_arg);
4361         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4362         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4363         LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
4364         uint64_t ret_ref = 0;
4365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4367         return ret_ref;
4368 }
4369
4370 typedef struct LDKSign_JCalls {
4371         atomic_size_t refcnt;
4372         uint32_t instance_ptr;
4373         LDKBaseSign_JCalls* BaseSign;
4374 } LDKSign_JCalls;
4375 static void LDKSign_JCalls_free(void* this_arg) {
4376         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
4377         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4378                 FREE(j_calls);
4379         }
4380 }
4381 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
4382         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
4383         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 16, 0, 0, 0, 0, 0, 0);
4384         LDKCVec_u8Z ret_ref;
4385         ret_ref.datalen = ret->arr_len;
4386         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4387         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
4388         return ret_ref;
4389 }
4390 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
4391         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
4392         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4393         atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
4394 }
4395 static inline LDKSign LDKSign_init (JSValue o, JSValue BaseSign, uint64_t pubkeys) {
4396         LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
4397         atomic_init(&calls->refcnt, 1);
4398         calls->instance_ptr = o;
4399
4400         LDKChannelPublicKeys pubkeys_conv;
4401         pubkeys_conv.inner = untag_ptr(pubkeys);
4402         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
4403         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4404
4405         LDKSign ret = {
4406                 .this_arg = (void*) calls,
4407                 .write = write_LDKSign_jcall,
4408                 .cloned = LDKSign_JCalls_cloned,
4409                 .free = LDKSign_JCalls_free,
4410                 .BaseSign = LDKBaseSign_init(BaseSign, pubkeys),
4411         };
4412         calls->BaseSign = ret.BaseSign.this_arg;
4413         return ret;
4414 }
4415 uint64_t  __attribute__((export_name("TS_LDKSign_new"))) TS_LDKSign_new(JSValue o, JSValue BaseSign, uint64_t pubkeys) {
4416         LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
4417         *res_ptr = LDKSign_init(o, BaseSign, pubkeys);
4418         return tag_ptr(res_ptr, true);
4419 }
4420 int8_tArray  __attribute__((export_name("TS_Sign_write"))) TS_Sign_write(uint64_t this_arg) {
4421         void* this_arg_ptr = untag_ptr(this_arg);
4422         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4423         LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
4424         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4425         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
4426         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
4427         CVec_u8Z_free(ret_var);
4428         return ret_arr;
4429 }
4430
4431 static inline struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
4432 CHECK(owner->result_ok);
4433         return Sign_clone(&*owner->contents.result);
4434 }
4435 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_get_ok"))) TS_CResult_SignDecodeErrorZ_get_ok(uint64_t owner) {
4436         LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(owner);
4437         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
4438         *ret_ret = CResult_SignDecodeErrorZ_get_ok(owner_conv);
4439         return tag_ptr(ret_ret, true);
4440 }
4441
4442 static inline struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
4443 CHECK(!owner->result_ok);
4444         return DecodeError_clone(&*owner->contents.err);
4445 }
4446 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_get_err"))) TS_CResult_SignDecodeErrorZ_get_err(uint64_t owner) {
4447         LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(owner);
4448         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4449         *ret_copy = CResult_SignDecodeErrorZ_get_err(owner_conv);
4450         uint64_t ret_ref = tag_ptr(ret_copy, true);
4451         return ret_ref;
4452 }
4453
4454 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4455 CHECK(owner->result_ok);
4456         return *owner->contents.result;
4457 }
4458 int8_tArray  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_ok"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint64_t owner) {
4459         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
4460         int8_tArray ret_arr = init_int8_tArray(68, __LINE__);
4461         memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
4462         return ret_arr;
4463 }
4464
4465 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4466 CHECK(!owner->result_ok);
4467         return *owner->contents.err;
4468 }
4469 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_err"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint64_t owner) {
4470         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
4471         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
4472 }
4473
4474 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
4475         LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
4476         for (size_t i = 0; i < ret.datalen; i++) {
4477                 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
4478         }
4479         return ret;
4480 }
4481 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4482 CHECK(owner->result_ok);
4483         return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
4484 }
4485 ptrArray  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok(uint64_t owner) {
4486         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
4487         LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
4488         ptrArray ret_arr = NULL;
4489         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
4490         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
4491         for (size_t m = 0; m < ret_var.datalen; m++) {
4492                 LDKCVec_u8Z ret_conv_12_var = ret_var.data[m];
4493                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
4494                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
4495                 CVec_u8Z_free(ret_conv_12_var);
4496                 ret_arr_ptr[m] = ret_conv_12_arr;
4497         }
4498         
4499         FREE(ret_var.data);
4500         return ret_arr;
4501 }
4502
4503 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4504 CHECK(!owner->result_ok);
4505         return *owner->contents.err;
4506 }
4507 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_err(uint64_t owner) {
4508         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
4509         CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
4510 }
4511
4512 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4513         LDKInMemorySigner ret = *owner->contents.result;
4514         ret.is_owned = false;
4515         return ret;
4516 }
4517 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_get_ok(uint64_t owner) {
4518         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
4519         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
4520         uint64_t ret_ref = 0;
4521         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4522         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4523         return ret_ref;
4524 }
4525
4526 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4527 CHECK(!owner->result_ok);
4528         return DecodeError_clone(&*owner->contents.err);
4529 }
4530 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_err"))) TS_CResult_InMemorySignerDecodeErrorZ_get_err(uint64_t owner) {
4531         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
4532         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4533         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
4534         uint64_t ret_ref = tag_ptr(ret_copy, true);
4535         return ret_ref;
4536 }
4537
4538 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
4539         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
4540         for (size_t i = 0; i < ret.datalen; i++) {
4541                 ret.data[i] = TxOut_clone(&orig->data[i]);
4542         }
4543         return ret;
4544 }
4545 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4546 CHECK(owner->result_ok);
4547         return *owner->contents.result;
4548 }
4549 int8_tArray  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_ok"))) TS_CResult_TransactionNoneZ_get_ok(uint64_t owner) {
4550         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
4551         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
4552         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
4553         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
4554         return ret_arr;
4555 }
4556
4557 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4558 CHECK(!owner->result_ok);
4559         return *owner->contents.err;
4560 }
4561 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_err"))) TS_CResult_TransactionNoneZ_get_err(uint64_t owner) {
4562         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
4563         CResult_TransactionNoneZ_get_err(owner_conv);
4564 }
4565
4566 uint32_t __attribute__((export_name("TS_LDKCOption_u16Z_ty_from_ptr"))) TS_LDKCOption_u16Z_ty_from_ptr(uint64_t ptr) {
4567         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
4568         switch(obj->tag) {
4569                 case LDKCOption_u16Z_Some: return 0;
4570                 case LDKCOption_u16Z_None: return 1;
4571                 default: abort();
4572         }
4573 }
4574 int16_t __attribute__((export_name("TS_LDKCOption_u16Z_Some_get_some"))) TS_LDKCOption_u16Z_Some_get_some(uint64_t ptr) {
4575         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
4576         assert(obj->tag == LDKCOption_u16Z_Some);
4577                         int16_t some_conv = obj->some;
4578         return some_conv;
4579 }
4580 uint32_t __attribute__((export_name("TS_LDKAPIError_ty_from_ptr"))) TS_LDKAPIError_ty_from_ptr(uint64_t ptr) {
4581         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4582         switch(obj->tag) {
4583                 case LDKAPIError_APIMisuseError: return 0;
4584                 case LDKAPIError_FeeRateTooHigh: return 1;
4585                 case LDKAPIError_InvalidRoute: return 2;
4586                 case LDKAPIError_ChannelUnavailable: return 3;
4587                 case LDKAPIError_MonitorUpdateInProgress: return 4;
4588                 case LDKAPIError_IncompatibleShutdownScript: return 5;
4589                 default: abort();
4590         }
4591 }
4592 jstring __attribute__((export_name("TS_LDKAPIError_APIMisuseError_get_err"))) TS_LDKAPIError_APIMisuseError_get_err(uint64_t ptr) {
4593         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4594         assert(obj->tag == LDKAPIError_APIMisuseError);
4595                         LDKStr err_str = obj->api_misuse_error.err;
4596                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4597         return err_conv;
4598 }
4599 jstring __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_err"))) TS_LDKAPIError_FeeRateTooHigh_get_err(uint64_t ptr) {
4600         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4601         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
4602                         LDKStr err_str = obj->fee_rate_too_high.err;
4603                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4604         return err_conv;
4605 }
4606 int32_t __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_feerate"))) TS_LDKAPIError_FeeRateTooHigh_get_feerate(uint64_t ptr) {
4607         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4608         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
4609                         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
4610         return feerate_conv;
4611 }
4612 jstring __attribute__((export_name("TS_LDKAPIError_InvalidRoute_get_err"))) TS_LDKAPIError_InvalidRoute_get_err(uint64_t ptr) {
4613         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4614         assert(obj->tag == LDKAPIError_InvalidRoute);
4615                         LDKStr err_str = obj->invalid_route.err;
4616                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4617         return err_conv;
4618 }
4619 jstring __attribute__((export_name("TS_LDKAPIError_ChannelUnavailable_get_err"))) TS_LDKAPIError_ChannelUnavailable_get_err(uint64_t ptr) {
4620         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4621         assert(obj->tag == LDKAPIError_ChannelUnavailable);
4622                         LDKStr err_str = obj->channel_unavailable.err;
4623                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4624         return err_conv;
4625 }
4626 uint64_t __attribute__((export_name("TS_LDKAPIError_IncompatibleShutdownScript_get_script"))) TS_LDKAPIError_IncompatibleShutdownScript_get_script(uint64_t ptr) {
4627         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4628         assert(obj->tag == LDKAPIError_IncompatibleShutdownScript);
4629                         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
4630                         uint64_t script_ref = 0;
4631                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
4632                         script_ref = tag_ptr(script_var.inner, false);
4633         return script_ref;
4634 }
4635 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
4636 CHECK(owner->result_ok);
4637         return *owner->contents.result;
4638 }
4639 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_ok"))) TS_CResult_NoneAPIErrorZ_get_ok(uint64_t owner) {
4640         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
4641         CResult_NoneAPIErrorZ_get_ok(owner_conv);
4642 }
4643
4644 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
4645 CHECK(!owner->result_ok);
4646         return APIError_clone(&*owner->contents.err);
4647 }
4648 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_err"))) TS_CResult_NoneAPIErrorZ_get_err(uint64_t owner) {
4649         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
4650         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4651         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
4652         uint64_t ret_ref = tag_ptr(ret_copy, true);
4653         return ret_ref;
4654 }
4655
4656 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
4657         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
4658         for (size_t i = 0; i < ret.datalen; i++) {
4659                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
4660         }
4661         return ret;
4662 }
4663 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
4664         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
4665         for (size_t i = 0; i < ret.datalen; i++) {
4666                 ret.data[i] = APIError_clone(&orig->data[i]);
4667         }
4668         return ret;
4669 }
4670 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4671 CHECK(owner->result_ok);
4672         return ThirtyTwoBytes_clone(&*owner->contents.result);
4673 }
4674 int8_tArray  __attribute__((export_name("TS_CResult__u832APIErrorZ_get_ok"))) TS_CResult__u832APIErrorZ_get_ok(uint64_t owner) {
4675         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
4676         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4677         memcpy(ret_arr->elems, CResult__u832APIErrorZ_get_ok(owner_conv).data, 32);
4678         return ret_arr;
4679 }
4680
4681 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4682 CHECK(!owner->result_ok);
4683         return APIError_clone(&*owner->contents.err);
4684 }
4685 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_get_err"))) TS_CResult__u832APIErrorZ_get_err(uint64_t owner) {
4686         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
4687         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4688         *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
4689         uint64_t ret_ref = tag_ptr(ret_copy, true);
4690         return ret_ref;
4691 }
4692
4693 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ty_from_ptr"))) TS_LDKPaymentSendFailure_ty_from_ptr(uint64_t ptr) {
4694         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4695         switch(obj->tag) {
4696                 case LDKPaymentSendFailure_ParameterError: return 0;
4697                 case LDKPaymentSendFailure_PathParameterError: return 1;
4698                 case LDKPaymentSendFailure_AllFailedResendSafe: return 2;
4699                 case LDKPaymentSendFailure_DuplicatePayment: return 3;
4700                 case LDKPaymentSendFailure_PartialFailure: return 4;
4701                 default: abort();
4702         }
4703 }
4704 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_ParameterError_get_parameter_error"))) TS_LDKPaymentSendFailure_ParameterError_get_parameter_error(uint64_t ptr) {
4705         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4706         assert(obj->tag == LDKPaymentSendFailure_ParameterError);
4707                         uint64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
4708         return parameter_error_ref;
4709 }
4710 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error"))) TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(uint64_t ptr) {
4711         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4712         assert(obj->tag == LDKPaymentSendFailure_PathParameterError);
4713                         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
4714                         uint64_tArray path_parameter_error_arr = NULL;
4715                         path_parameter_error_arr = init_uint64_tArray(path_parameter_error_var.datalen, __LINE__);
4716                         uint64_t *path_parameter_error_arr_ptr = (uint64_t*)(((uint8_t*)path_parameter_error_arr) + 8);
4717                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
4718                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4719                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
4720                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
4721                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
4722                         }
4723                         
4724         return path_parameter_error_arr;
4725 }
4726 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe"))) TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe(uint64_t ptr) {
4727         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4728         assert(obj->tag == LDKPaymentSendFailure_AllFailedResendSafe);
4729                         LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe;
4730                         uint64_tArray all_failed_resend_safe_arr = NULL;
4731                         all_failed_resend_safe_arr = init_uint64_tArray(all_failed_resend_safe_var.datalen, __LINE__);
4732                         uint64_t *all_failed_resend_safe_arr_ptr = (uint64_t*)(((uint8_t*)all_failed_resend_safe_arr) + 8);
4733                         for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) {
4734                                 uint64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false);
4735                                 all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref;
4736                         }
4737                         
4738         return all_failed_resend_safe_arr;
4739 }
4740 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_results"))) TS_LDKPaymentSendFailure_PartialFailure_get_results(uint64_t ptr) {
4741         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4742         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4743                         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
4744                         uint64_tArray results_arr = NULL;
4745                         results_arr = init_uint64_tArray(results_var.datalen, __LINE__);
4746                         uint64_t *results_arr_ptr = (uint64_t*)(((uint8_t*)results_arr) + 8);
4747                         for (size_t w = 0; w < results_var.datalen; w++) {
4748                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4749                                 *results_conv_22_conv = results_var.data[w];
4750                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
4751                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
4752                         }
4753                         
4754         return results_arr;
4755 }
4756 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry"))) TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(uint64_t ptr) {
4757         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4758         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4759                         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
4760                         uint64_t failed_paths_retry_ref = 0;
4761                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
4762                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
4763         return failed_paths_retry_ref;
4764 }
4765 int8_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_payment_id"))) TS_LDKPaymentSendFailure_PartialFailure_get_payment_id(uint64_t ptr) {
4766         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4767         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4768                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4769                         memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
4770         return payment_id_arr;
4771 }
4772 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4773 CHECK(owner->result_ok);
4774         return *owner->contents.result;
4775 }
4776 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_ok"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint64_t owner) {
4777         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
4778         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
4779 }
4780
4781 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4782 CHECK(!owner->result_ok);
4783         return PaymentSendFailure_clone(&*owner->contents.err);
4784 }
4785 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_err"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint64_t owner) {
4786         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
4787         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4788         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
4789         uint64_t ret_ref = tag_ptr(ret_copy, true);
4790         return ret_ref;
4791 }
4792
4793 static inline struct LDKThirtyTwoBytes CResult_PaymentHashPaymentSendFailureZ_get_ok(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR owner){
4794 CHECK(owner->result_ok);
4795         return ThirtyTwoBytes_clone(&*owner->contents.result);
4796 }
4797 int8_tArray  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_get_ok"))) TS_CResult_PaymentHashPaymentSendFailureZ_get_ok(uint64_t owner) {
4798         LDKCResult_PaymentHashPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(owner);
4799         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4800         memcpy(ret_arr->elems, CResult_PaymentHashPaymentSendFailureZ_get_ok(owner_conv).data, 32);
4801         return ret_arr;
4802 }
4803
4804 static inline struct LDKPaymentSendFailure CResult_PaymentHashPaymentSendFailureZ_get_err(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR owner){
4805 CHECK(!owner->result_ok);
4806         return PaymentSendFailure_clone(&*owner->contents.err);
4807 }
4808 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_get_err"))) TS_CResult_PaymentHashPaymentSendFailureZ_get_err(uint64_t owner) {
4809         LDKCResult_PaymentHashPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(owner);
4810         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4811         *ret_copy = CResult_PaymentHashPaymentSendFailureZ_get_err(owner_conv);
4812         uint64_t ret_ref = tag_ptr(ret_copy, true);
4813         return ret_ref;
4814 }
4815
4816 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
4817         return ThirtyTwoBytes_clone(&owner->a);
4818 }
4819 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_a"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_a(uint64_t owner) {
4820         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
4821         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4822         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data, 32);
4823         return ret_arr;
4824 }
4825
4826 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
4827         return ThirtyTwoBytes_clone(&owner->b);
4828 }
4829 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_b"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_b(uint64_t owner) {
4830         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
4831         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4832         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data, 32);
4833         return ret_arr;
4834 }
4835
4836 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
4837 CHECK(owner->result_ok);
4838         return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
4839 }
4840 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(uint64_t owner) {
4841         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
4842         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
4843         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
4844         return tag_ptr(ret_conv, true);
4845 }
4846
4847 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
4848 CHECK(!owner->result_ok);
4849         return PaymentSendFailure_clone(&*owner->contents.err);
4850 }
4851 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(uint64_t owner) {
4852         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
4853         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4854         *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
4855         uint64_t ret_ref = tag_ptr(ret_copy, true);
4856         return ret_ref;
4857 }
4858
4859 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
4860         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
4861         for (size_t i = 0; i < ret.datalen; i++) {
4862                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
4863         }
4864         return ret;
4865 }
4866 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
4867         return ThirtyTwoBytes_clone(&owner->a);
4868 }
4869 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_a"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_a(uint64_t owner) {
4870         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
4871         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4872         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data, 32);
4873         return ret_arr;
4874 }
4875
4876 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
4877         return ThirtyTwoBytes_clone(&owner->b);
4878 }
4879 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_b"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_b(uint64_t owner) {
4880         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
4881         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4882         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data, 32);
4883         return ret_arr;
4884 }
4885
4886 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
4887 CHECK(owner->result_ok);
4888         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
4889 }
4890 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(uint64_t owner) {
4891         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
4892         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
4893         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
4894         return tag_ptr(ret_conv, true);
4895 }
4896
4897 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
4898 CHECK(!owner->result_ok);
4899         return *owner->contents.err;
4900 }
4901 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(uint64_t owner) {
4902         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
4903         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
4904 }
4905
4906 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
4907 CHECK(owner->result_ok);
4908         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
4909 }
4910 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(uint64_t owner) {
4911         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
4912         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
4913         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
4914         return tag_ptr(ret_conv, true);
4915 }
4916
4917 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
4918 CHECK(!owner->result_ok);
4919         return APIError_clone(&*owner->contents.err);
4920 }
4921 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(uint64_t owner) {
4922         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
4923         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4924         *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
4925         uint64_t ret_ref = tag_ptr(ret_copy, true);
4926         return ret_ref;
4927 }
4928
4929 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
4930 CHECK(owner->result_ok);
4931         return ThirtyTwoBytes_clone(&*owner->contents.result);
4932 }
4933 int8_tArray  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_ok"))) TS_CResult_PaymentSecretNoneZ_get_ok(uint64_t owner) {
4934         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
4935         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4936         memcpy(ret_arr->elems, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data, 32);
4937         return ret_arr;
4938 }
4939
4940 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
4941 CHECK(!owner->result_ok);
4942         return *owner->contents.err;
4943 }
4944 void  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_err"))) TS_CResult_PaymentSecretNoneZ_get_err(uint64_t owner) {
4945         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
4946         CResult_PaymentSecretNoneZ_get_err(owner_conv);
4947 }
4948
4949 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
4950 CHECK(owner->result_ok);
4951         return ThirtyTwoBytes_clone(&*owner->contents.result);
4952 }
4953 int8_tArray  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_ok"))) TS_CResult_PaymentSecretAPIErrorZ_get_ok(uint64_t owner) {
4954         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
4955         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4956         memcpy(ret_arr->elems, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data, 32);
4957         return ret_arr;
4958 }
4959
4960 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
4961 CHECK(!owner->result_ok);
4962         return APIError_clone(&*owner->contents.err);
4963 }
4964 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_err"))) TS_CResult_PaymentSecretAPIErrorZ_get_err(uint64_t owner) {
4965         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
4966         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4967         *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
4968         uint64_t ret_ref = tag_ptr(ret_copy, true);
4969         return ret_ref;
4970 }
4971
4972 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
4973 CHECK(owner->result_ok);
4974         return ThirtyTwoBytes_clone(&*owner->contents.result);
4975 }
4976 int8_tArray  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_get_ok(uint64_t owner) {
4977         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
4978         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4979         memcpy(ret_arr->elems, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data, 32);
4980         return ret_arr;
4981 }
4982
4983 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
4984 CHECK(!owner->result_ok);
4985         return APIError_clone(&*owner->contents.err);
4986 }
4987 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_err"))) TS_CResult_PaymentPreimageAPIErrorZ_get_err(uint64_t owner) {
4988         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
4989         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4990         *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
4991         uint64_t ret_ref = tag_ptr(ret_copy, true);
4992         return ret_ref;
4993 }
4994
4995 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
4996         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
4997         ret.is_owned = false;
4998         return ret;
4999 }
5000 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(uint64_t owner) {
5001         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5002         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
5003         uint64_t ret_ref = 0;
5004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5006         return ret_ref;
5007 }
5008
5009 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
5010 CHECK(!owner->result_ok);
5011         return DecodeError_clone(&*owner->contents.err);
5012 }
5013 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(uint64_t owner) {
5014         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
5015         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5016         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
5017         uint64_t ret_ref = tag_ptr(ret_copy, true);
5018         return ret_ref;
5019 }
5020
5021 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5022         LDKChannelCounterparty ret = *owner->contents.result;
5023         ret.is_owned = false;
5024         return ret;
5025 }
5026 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok(uint64_t owner) {
5027         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5028         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
5029         uint64_t ret_ref = 0;
5030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5031         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5032         return ret_ref;
5033 }
5034
5035 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
5036 CHECK(!owner->result_ok);
5037         return DecodeError_clone(&*owner->contents.err);
5038 }
5039 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err(uint64_t owner) {
5040         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
5041         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5042         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
5043         uint64_t ret_ref = tag_ptr(ret_copy, true);
5044         return ret_ref;
5045 }
5046
5047 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5048         LDKChannelDetails ret = *owner->contents.result;
5049         ret.is_owned = false;
5050         return ret;
5051 }
5052 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_ok(uint64_t owner) {
5053         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5054         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
5055         uint64_t ret_ref = 0;
5056         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5057         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5058         return ret_ref;
5059 }
5060
5061 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
5062 CHECK(!owner->result_ok);
5063         return DecodeError_clone(&*owner->contents.err);
5064 }
5065 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_err(uint64_t owner) {
5066         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
5067         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5068         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
5069         uint64_t ret_ref = tag_ptr(ret_copy, true);
5070         return ret_ref;
5071 }
5072
5073 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5074         LDKPhantomRouteHints ret = *owner->contents.result;
5075         ret.is_owned = false;
5076         return ret;
5077 }
5078 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok(uint64_t owner) {
5079         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
5080         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
5081         uint64_t ret_ref = 0;
5082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5084         return ret_ref;
5085 }
5086
5087 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
5088 CHECK(!owner->result_ok);
5089         return DecodeError_clone(&*owner->contents.err);
5090 }
5091 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err(uint64_t owner) {
5092         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
5093         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5094         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
5095         uint64_t ret_ref = tag_ptr(ret_copy, true);
5096         return ret_ref;
5097 }
5098
5099 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
5100         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
5101         for (size_t i = 0; i < ret.datalen; i++) {
5102                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
5103         }
5104         return ret;
5105 }
5106 typedef struct LDKWatch_JCalls {
5107         atomic_size_t refcnt;
5108         uint32_t instance_ptr;
5109 } LDKWatch_JCalls;
5110 static void LDKWatch_JCalls_free(void* this_arg) {
5111         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5112         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5113                 FREE(j_calls);
5114         }
5115 }
5116 LDKChannelMonitorUpdateStatus watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
5117         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5118         LDKOutPoint funding_txo_var = funding_txo;
5119         uint64_t funding_txo_ref = 0;
5120         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5121         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
5122         LDKChannelMonitor monitor_var = monitor;
5123         uint64_t monitor_ref = 0;
5124         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
5125         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
5126         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 17, funding_txo_ref, monitor_ref, 0, 0, 0, 0);
5127         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
5128         return ret_conv;
5129 }
5130 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
5131         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5132         LDKOutPoint funding_txo_var = funding_txo;
5133         uint64_t funding_txo_ref = 0;
5134         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5135         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
5136         LDKChannelMonitorUpdate update_var = update;
5137         uint64_t update_ref = 0;
5138         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
5139         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
5140         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 18, funding_txo_ref, update_ref, 0, 0, 0, 0);
5141         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
5142         return ret_conv;
5143 }
5144 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
5145         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5146         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 19, 0, 0, 0, 0, 0, 0);
5147         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
5148         ret_constr.datalen = ret->arr_len;
5149         if (ret_constr.datalen > 0)
5150                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
5151         else
5152                 ret_constr.data = NULL;
5153         uint64_t* ret_vals = ret->elems;
5154         for (size_t x = 0; x < ret_constr.datalen; x++) {
5155                 uint64_t ret_conv_49 = ret_vals[x];
5156                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
5157                 CHECK_ACCESS(ret_conv_49_ptr);
5158                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
5159                 FREE(untag_ptr(ret_conv_49));
5160                 ret_constr.data[x] = ret_conv_49_conv;
5161         }
5162         FREE(ret);
5163         return ret_constr;
5164 }
5165 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
5166         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
5167         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5168 }
5169 static inline LDKWatch LDKWatch_init (JSValue o) {
5170         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
5171         atomic_init(&calls->refcnt, 1);
5172         calls->instance_ptr = o;
5173
5174         LDKWatch ret = {
5175                 .this_arg = (void*) calls,
5176                 .watch_channel = watch_channel_LDKWatch_jcall,
5177                 .update_channel = update_channel_LDKWatch_jcall,
5178                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
5179                 .free = LDKWatch_JCalls_free,
5180         };
5181         return ret;
5182 }
5183 uint64_t  __attribute__((export_name("TS_LDKWatch_new"))) TS_LDKWatch_new(JSValue o) {
5184         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
5185         *res_ptr = LDKWatch_init(o);
5186         return tag_ptr(res_ptr, true);
5187 }
5188 uint32_t  __attribute__((export_name("TS_Watch_watch_channel"))) TS_Watch_watch_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t monitor) {
5189         void* this_arg_ptr = untag_ptr(this_arg);
5190         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5191         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5192         LDKOutPoint funding_txo_conv;
5193         funding_txo_conv.inner = untag_ptr(funding_txo);
5194         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
5195         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5196         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5197         LDKChannelMonitor monitor_conv;
5198         monitor_conv.inner = untag_ptr(monitor);
5199         monitor_conv.is_owned = ptr_is_owned(monitor);
5200         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
5201         monitor_conv = ChannelMonitor_clone(&monitor_conv);
5202         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv));
5203         return ret_conv;
5204 }
5205
5206 uint32_t  __attribute__((export_name("TS_Watch_update_channel"))) TS_Watch_update_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t update) {
5207         void* this_arg_ptr = untag_ptr(this_arg);
5208         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5209         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5210         LDKOutPoint funding_txo_conv;
5211         funding_txo_conv.inner = untag_ptr(funding_txo);
5212         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
5213         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5214         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5215         LDKChannelMonitorUpdate update_conv;
5216         update_conv.inner = untag_ptr(update);
5217         update_conv.is_owned = ptr_is_owned(update);
5218         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
5219         update_conv = ChannelMonitorUpdate_clone(&update_conv);
5220         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv));
5221         return ret_conv;
5222 }
5223
5224 uint64_tArray  __attribute__((export_name("TS_Watch_release_pending_monitor_events"))) TS_Watch_release_pending_monitor_events(uint64_t this_arg) {
5225         void* this_arg_ptr = untag_ptr(this_arg);
5226         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5227         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5228         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
5229         uint64_tArray ret_arr = NULL;
5230         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
5231         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
5232         for (size_t x = 0; x < ret_var.datalen; x++) {
5233                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
5234                 *ret_conv_49_conv = ret_var.data[x];
5235                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
5236         }
5237         
5238         FREE(ret_var.data);
5239         return ret_arr;
5240 }
5241
5242 typedef struct LDKBroadcasterInterface_JCalls {
5243         atomic_size_t refcnt;
5244         uint32_t instance_ptr;
5245 } LDKBroadcasterInterface_JCalls;
5246 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
5247         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5248         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5249                 FREE(j_calls);
5250         }
5251 }
5252 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
5253         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5254         LDKTransaction tx_var = tx;
5255         int8_tArray tx_arr = init_int8_tArray(tx_var.datalen, __LINE__);
5256         memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
5257         Transaction_free(tx_var);
5258         js_invoke_function_uuuuuu(j_calls->instance_ptr, 20, (uint32_t)tx_arr, 0, 0, 0, 0, 0);
5259 }
5260 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
5261         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
5262         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5263 }
5264 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JSValue o) {
5265         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
5266         atomic_init(&calls->refcnt, 1);
5267         calls->instance_ptr = o;
5268
5269         LDKBroadcasterInterface ret = {
5270                 .this_arg = (void*) calls,
5271                 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
5272                 .free = LDKBroadcasterInterface_JCalls_free,
5273         };
5274         return ret;
5275 }
5276 uint64_t  __attribute__((export_name("TS_LDKBroadcasterInterface_new"))) TS_LDKBroadcasterInterface_new(JSValue o) {
5277         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
5278         *res_ptr = LDKBroadcasterInterface_init(o);
5279         return tag_ptr(res_ptr, true);
5280 }
5281 void  __attribute__((export_name("TS_BroadcasterInterface_broadcast_transaction"))) TS_BroadcasterInterface_broadcast_transaction(uint64_t this_arg, int8_tArray tx) {
5282         void* this_arg_ptr = untag_ptr(this_arg);
5283         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5284         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
5285         LDKTransaction tx_ref;
5286         tx_ref.datalen = tx->arr_len;
5287         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
5288         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
5289         tx_ref.data_is_owned = true;
5290         (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
5291 }
5292
5293 typedef struct LDKKeysInterface_JCalls {
5294         atomic_size_t refcnt;
5295         uint32_t instance_ptr;
5296 } LDKKeysInterface_JCalls;
5297 static void LDKKeysInterface_JCalls_free(void* this_arg) {
5298         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5299         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5300                 FREE(j_calls);
5301         }
5302 }
5303 LDKCResult_SecretKeyNoneZ get_node_secret_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) {
5304         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5305         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5306         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 21, recipient_conv, 0, 0, 0, 0, 0);
5307         void* ret_ptr = untag_ptr(ret);
5308         CHECK_ACCESS(ret_ptr);
5309         LDKCResult_SecretKeyNoneZ ret_conv = *(LDKCResult_SecretKeyNoneZ*)(ret_ptr);
5310         FREE(untag_ptr(ret));
5311         return ret_conv;
5312 }
5313 LDKCResult_PublicKeyNoneZ get_node_id_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) {
5314         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5315         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5316         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 22, recipient_conv, 0, 0, 0, 0, 0);
5317         void* ret_ptr = untag_ptr(ret);
5318         CHECK_ACCESS(ret_ptr);
5319         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
5320         FREE(untag_ptr(ret));
5321         return ret_conv;
5322 }
5323 LDKCResult_SharedSecretNoneZ ecdh_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_ScalarZ tweak) {
5324         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5325         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5326         int8_tArray other_key_arr = init_int8_tArray(33, __LINE__);
5327         memcpy(other_key_arr->elems, other_key.compressed_form, 33);
5328         LDKCOption_ScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
5329         *tweak_copy = tweak;
5330         uint64_t tweak_ref = tag_ptr(tweak_copy, true);
5331         uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 23, recipient_conv, (uint32_t)other_key_arr, tweak_ref, 0, 0, 0);
5332         void* ret_ptr = untag_ptr(ret);
5333         CHECK_ACCESS(ret_ptr);
5334         LDKCResult_SharedSecretNoneZ ret_conv = *(LDKCResult_SharedSecretNoneZ*)(ret_ptr);
5335         FREE(untag_ptr(ret));
5336         return ret_conv;
5337 }
5338 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
5339         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5340         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 24, 0, 0, 0, 0, 0, 0);
5341         LDKCVec_u8Z ret_ref;
5342         ret_ref.datalen = ret->arr_len;
5343         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5344         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
5345         return ret_ref;
5346 }
5347 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
5348         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5349         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 25, 0, 0, 0, 0, 0, 0);
5350         LDKShutdownScript ret_conv;
5351         ret_conv.inner = untag_ptr(ret);
5352         ret_conv.is_owned = ptr_is_owned(ret);
5353         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
5354         return ret_conv;
5355 }
5356 LDKThirtyTwoBytes generate_channel_keys_id_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) {
5357         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5358         jboolean inbound_conv = inbound;
5359         int64_t channel_value_satoshis_conv = channel_value_satoshis;
5360         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
5361         memcpy(user_channel_id_arr->elems, user_channel_id.le_bytes, 16);
5362         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);
5363         LDKThirtyTwoBytes ret_ref;
5364         CHECK(ret->arr_len == 32);
5365         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5366         return ret_ref;
5367 }
5368 LDKSign derive_channel_signer_LDKKeysInterface_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) {
5369         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5370         int64_t channel_value_satoshis_conv = channel_value_satoshis;
5371         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
5372         memcpy(channel_keys_id_arr->elems, channel_keys_id.data, 32);
5373         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);
5374         void* ret_ptr = untag_ptr(ret);
5375         CHECK_ACCESS(ret_ptr);
5376         LDKSign ret_conv = *(LDKSign*)(ret_ptr);
5377         FREE(untag_ptr(ret));
5378         return ret_conv;
5379 }
5380 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
5381         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5382         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 28, 0, 0, 0, 0, 0, 0);
5383         LDKThirtyTwoBytes ret_ref;
5384         CHECK(ret->arr_len == 32);
5385         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5386         return ret_ref;
5387 }
5388 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
5389         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5390         LDKu8slice reader_var = reader;
5391         int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__);
5392         memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
5393         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 29, (uint32_t)reader_arr, 0, 0, 0, 0, 0);
5394         void* ret_ptr = untag_ptr(ret);
5395         CHECK_ACCESS(ret_ptr);
5396         LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
5397         FREE(untag_ptr(ret));
5398         return ret_conv;
5399 }
5400 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient receipient) {
5401         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5402         LDKu8slice hrp_bytes_var = hrp_bytes;
5403         int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__);
5404         memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen);
5405         LDKCVec_U5Z invoice_data_var = invoice_data;
5406         ptrArray invoice_data_arr = NULL;
5407         invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__);
5408         int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 8);
5409         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
5410                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
5411                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
5412         }
5413         
5414         FREE(invoice_data_var.data);
5415         uint32_t receipient_conv = LDKRecipient_to_js(receipient);
5416         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);
5417         void* ret_ptr = untag_ptr(ret);
5418         CHECK_ACCESS(ret_ptr);
5419         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
5420         FREE(untag_ptr(ret));
5421         return ret_conv;
5422 }
5423 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) {
5424         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5425         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 31, 0, 0, 0, 0, 0, 0);
5426         LDKThirtyTwoBytes ret_ref;
5427         CHECK(ret->arr_len == 32);
5428         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5429         return ret_ref;
5430 }
5431 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
5432         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
5433         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5434 }
5435 static inline LDKKeysInterface LDKKeysInterface_init (JSValue o) {
5436         LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
5437         atomic_init(&calls->refcnt, 1);
5438         calls->instance_ptr = o;
5439
5440         LDKKeysInterface ret = {
5441                 .this_arg = (void*) calls,
5442                 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
5443                 .get_node_id = get_node_id_LDKKeysInterface_jcall,
5444                 .ecdh = ecdh_LDKKeysInterface_jcall,
5445                 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
5446                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
5447                 .generate_channel_keys_id = generate_channel_keys_id_LDKKeysInterface_jcall,
5448                 .derive_channel_signer = derive_channel_signer_LDKKeysInterface_jcall,
5449                 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
5450                 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
5451                 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
5452                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall,
5453                 .free = LDKKeysInterface_JCalls_free,
5454         };
5455         return ret;
5456 }
5457 uint64_t  __attribute__((export_name("TS_LDKKeysInterface_new"))) TS_LDKKeysInterface_new(JSValue o) {
5458         LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
5459         *res_ptr = LDKKeysInterface_init(o);
5460         return tag_ptr(res_ptr, true);
5461 }
5462 uint64_t  __attribute__((export_name("TS_KeysInterface_get_node_secret"))) TS_KeysInterface_get_node_secret(uint64_t this_arg, uint32_t recipient) {
5463         void* this_arg_ptr = untag_ptr(this_arg);
5464         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5465         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5466         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5467         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
5468         *ret_conv = (this_arg_conv->get_node_secret)(this_arg_conv->this_arg, recipient_conv);
5469         return tag_ptr(ret_conv, true);
5470 }
5471
5472 uint64_t  __attribute__((export_name("TS_KeysInterface_get_node_id"))) TS_KeysInterface_get_node_id(uint64_t this_arg, uint32_t recipient) {
5473         void* this_arg_ptr = untag_ptr(this_arg);
5474         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5475         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5476         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5477         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
5478         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
5479         return tag_ptr(ret_conv, true);
5480 }
5481
5482 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) {
5483         void* this_arg_ptr = untag_ptr(this_arg);
5484         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5485         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5486         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5487         LDKPublicKey other_key_ref;
5488         CHECK(other_key->arr_len == 33);
5489         memcpy(other_key_ref.compressed_form, other_key->elems, 33); FREE(other_key);
5490         void* tweak_ptr = untag_ptr(tweak);
5491         CHECK_ACCESS(tweak_ptr);
5492         LDKCOption_ScalarZ tweak_conv = *(LDKCOption_ScalarZ*)(tweak_ptr);
5493         // WARNING: we may need a move here but no clone is available for LDKCOption_ScalarZ
5494         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
5495         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
5496         return tag_ptr(ret_conv, true);
5497 }
5498
5499 int8_tArray  __attribute__((export_name("TS_KeysInterface_get_destination_script"))) TS_KeysInterface_get_destination_script(uint64_t this_arg) {
5500         void* this_arg_ptr = untag_ptr(this_arg);
5501         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5502         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5503         LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
5504         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5505         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5506         CVec_u8Z_free(ret_var);
5507         return ret_arr;
5508 }
5509
5510 uint64_t  __attribute__((export_name("TS_KeysInterface_get_shutdown_scriptpubkey"))) TS_KeysInterface_get_shutdown_scriptpubkey(uint64_t this_arg) {
5511         void* this_arg_ptr = untag_ptr(this_arg);
5512         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5513         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5514         LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
5515         uint64_t ret_ref = 0;
5516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5517         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5518         return ret_ref;
5519 }
5520
5521 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) {
5522         void* this_arg_ptr = untag_ptr(this_arg);
5523         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5524         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5525         LDKU128 user_channel_id_ref;
5526         CHECK(user_channel_id->arr_len == 16);
5527         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
5528         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5529         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);
5530         return ret_arr;
5531 }
5532
5533 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) {
5534         void* this_arg_ptr = untag_ptr(this_arg);
5535         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5536         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5537         LDKThirtyTwoBytes channel_keys_id_ref;
5538         CHECK(channel_keys_id->arr_len == 32);
5539         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
5540         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
5541         *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref);
5542         return tag_ptr(ret_ret, true);
5543 }
5544
5545 int8_tArray  __attribute__((export_name("TS_KeysInterface_get_secure_random_bytes"))) TS_KeysInterface_get_secure_random_bytes(uint64_t this_arg) {
5546         void* this_arg_ptr = untag_ptr(this_arg);
5547         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5548         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5549         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5550         memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
5551         return ret_arr;
5552 }
5553
5554 uint64_t  __attribute__((export_name("TS_KeysInterface_read_chan_signer"))) TS_KeysInterface_read_chan_signer(uint64_t this_arg, int8_tArray reader) {
5555         void* this_arg_ptr = untag_ptr(this_arg);
5556         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5557         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5558         LDKu8slice reader_ref;
5559         reader_ref.datalen = reader->arr_len;
5560         reader_ref.data = reader->elems;
5561         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
5562         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
5563         FREE(reader);
5564         return tag_ptr(ret_conv, true);
5565 }
5566
5567 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) {
5568         void* this_arg_ptr = untag_ptr(this_arg);
5569         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5570         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5571         LDKu8slice hrp_bytes_ref;
5572         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
5573         hrp_bytes_ref.data = hrp_bytes->elems;
5574         LDKCVec_U5Z invoice_data_constr;
5575         invoice_data_constr.datalen = invoice_data->arr_len;
5576         if (invoice_data_constr.datalen > 0)
5577                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
5578         else
5579                 invoice_data_constr.data = NULL;
5580         int8_t* invoice_data_vals = (void*) invoice_data->elems;
5581         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
5582                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
5583                 
5584                 invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 };
5585         }
5586         FREE(invoice_data);
5587         LDKRecipient receipient_conv = LDKRecipient_from_js(receipient);
5588         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
5589         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, receipient_conv);
5590         FREE(hrp_bytes);
5591         return tag_ptr(ret_conv, true);
5592 }
5593
5594 int8_tArray  __attribute__((export_name("TS_KeysInterface_get_inbound_payment_key_material"))) TS_KeysInterface_get_inbound_payment_key_material(uint64_t this_arg) {
5595         void* this_arg_ptr = untag_ptr(this_arg);
5596         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5597         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5598         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5599         memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
5600         return ret_arr;
5601 }
5602
5603 typedef struct LDKFeeEstimator_JCalls {
5604         atomic_size_t refcnt;
5605         uint32_t instance_ptr;
5606 } LDKFeeEstimator_JCalls;
5607 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
5608         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5609         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5610                 FREE(j_calls);
5611         }
5612 }
5613 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
5614         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5615         uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
5616         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 32, confirmation_target_conv, 0, 0, 0, 0, 0);
5617 }
5618 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
5619         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
5620         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5621 }
5622 static inline LDKFeeEstimator LDKFeeEstimator_init (JSValue o) {
5623         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
5624         atomic_init(&calls->refcnt, 1);
5625         calls->instance_ptr = o;
5626
5627         LDKFeeEstimator ret = {
5628                 .this_arg = (void*) calls,
5629                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
5630                 .free = LDKFeeEstimator_JCalls_free,
5631         };
5632         return ret;
5633 }
5634 uint64_t  __attribute__((export_name("TS_LDKFeeEstimator_new"))) TS_LDKFeeEstimator_new(JSValue o) {
5635         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
5636         *res_ptr = LDKFeeEstimator_init(o);
5637         return tag_ptr(res_ptr, true);
5638 }
5639 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) {
5640         void* this_arg_ptr = untag_ptr(this_arg);
5641         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5642         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
5643         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
5644         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
5645         return ret_conv;
5646 }
5647
5648 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
5649         return ThirtyTwoBytes_clone(&owner->a);
5650 }
5651 int8_tArray  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_a"))) TS_C2Tuple_BlockHashChannelManagerZ_get_a(uint64_t owner) {
5652         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
5653         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5654         memcpy(ret_arr->elems, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data, 32);
5655         return ret_arr;
5656 }
5657
5658 static inline struct LDKChannelManager C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
5659         LDKChannelManager ret = owner->b;
5660         ret.is_owned = false;
5661         return ret;
5662 }
5663 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_b"))) TS_C2Tuple_BlockHashChannelManagerZ_get_b(uint64_t owner) {
5664         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
5665         LDKChannelManager ret_var = C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
5666         uint64_t ret_ref = 0;
5667         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5668         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5669         return ret_ref;
5670 }
5671
5672 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
5673 CHECK(owner->result_ok);
5674         return &*owner->contents.result;
5675 }
5676 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint64_t owner) {
5677         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
5678         uint64_t ret_ret = tag_ptr(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
5679         return ret_ret;
5680 }
5681
5682 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
5683 CHECK(!owner->result_ok);
5684         return DecodeError_clone(&*owner->contents.err);
5685 }
5686 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint64_t owner) {
5687         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
5688         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5689         *ret_copy = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
5690         uint64_t ret_ref = tag_ptr(ret_copy, true);
5691         return ret_ref;
5692 }
5693
5694 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
5695         LDKChannelConfig ret = *owner->contents.result;
5696         ret.is_owned = false;
5697         return ret;
5698 }
5699 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_get_ok(uint64_t owner) {
5700         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
5701         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
5702         uint64_t ret_ref = 0;
5703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5705         return ret_ref;
5706 }
5707
5708 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
5709 CHECK(!owner->result_ok);
5710         return DecodeError_clone(&*owner->contents.err);
5711 }
5712 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_err"))) TS_CResult_ChannelConfigDecodeErrorZ_get_err(uint64_t owner) {
5713         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
5714         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5715         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
5716         uint64_t ret_ref = tag_ptr(ret_copy, true);
5717         return ret_ref;
5718 }
5719
5720 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
5721         LDKOutPoint ret = *owner->contents.result;
5722         ret.is_owned = false;
5723         return ret;
5724 }
5725 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_ok"))) TS_CResult_OutPointDecodeErrorZ_get_ok(uint64_t owner) {
5726         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
5727         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
5728         uint64_t ret_ref = 0;
5729         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5730         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5731         return ret_ref;
5732 }
5733
5734 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
5735 CHECK(!owner->result_ok);
5736         return DecodeError_clone(&*owner->contents.err);
5737 }
5738 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_err"))) TS_CResult_OutPointDecodeErrorZ_get_err(uint64_t owner) {
5739         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
5740         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5741         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
5742         uint64_t ret_ref = tag_ptr(ret_copy, true);
5743         return ret_ref;
5744 }
5745
5746 typedef struct LDKType_JCalls {
5747         atomic_size_t refcnt;
5748         uint32_t instance_ptr;
5749 } LDKType_JCalls;
5750 static void LDKType_JCalls_free(void* this_arg) {
5751         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5752         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5753                 FREE(j_calls);
5754         }
5755 }
5756 uint16_t type_id_LDKType_jcall(const void* this_arg) {
5757         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5758         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 33, 0, 0, 0, 0, 0, 0);
5759 }
5760 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
5761         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5762         jstring ret = (jstring)js_invoke_function_uuuuuu(j_calls->instance_ptr, 34, 0, 0, 0, 0, 0, 0);
5763         LDKStr ret_conv = str_ref_to_owned_c(ret);
5764         return ret_conv;
5765 }
5766 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
5767         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5768         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 35, 0, 0, 0, 0, 0, 0);
5769         LDKCVec_u8Z ret_ref;
5770         ret_ref.datalen = ret->arr_len;
5771         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5772         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
5773         return ret_ref;
5774 }
5775 static void LDKType_JCalls_cloned(LDKType* new_obj) {
5776         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
5777         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5778 }
5779 static inline LDKType LDKType_init (JSValue o) {
5780         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
5781         atomic_init(&calls->refcnt, 1);
5782         calls->instance_ptr = o;
5783
5784         LDKType ret = {
5785                 .this_arg = (void*) calls,
5786                 .type_id = type_id_LDKType_jcall,
5787                 .debug_str = debug_str_LDKType_jcall,
5788                 .write = write_LDKType_jcall,
5789                 .cloned = LDKType_JCalls_cloned,
5790                 .free = LDKType_JCalls_free,
5791         };
5792         return ret;
5793 }
5794 uint64_t  __attribute__((export_name("TS_LDKType_new"))) TS_LDKType_new(JSValue o) {
5795         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
5796         *res_ptr = LDKType_init(o);
5797         return tag_ptr(res_ptr, true);
5798 }
5799 int16_t  __attribute__((export_name("TS_Type_type_id"))) TS_Type_type_id(uint64_t this_arg) {
5800         void* this_arg_ptr = untag_ptr(this_arg);
5801         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5802         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5803         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
5804         return ret_conv;
5805 }
5806
5807 jstring  __attribute__((export_name("TS_Type_debug_str"))) TS_Type_debug_str(uint64_t this_arg) {
5808         void* this_arg_ptr = untag_ptr(this_arg);
5809         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5810         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5811         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
5812         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
5813         Str_free(ret_str);
5814         return ret_conv;
5815 }
5816
5817 int8_tArray  __attribute__((export_name("TS_Type_write"))) TS_Type_write(uint64_t this_arg) {
5818         void* this_arg_ptr = untag_ptr(this_arg);
5819         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5820         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5821         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
5822         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5823         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5824         CVec_u8Z_free(ret_var);
5825         return ret_arr;
5826 }
5827
5828 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_ty_from_ptr"))) TS_LDKCOption_TypeZ_ty_from_ptr(uint64_t ptr) {
5829         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
5830         switch(obj->tag) {
5831                 case LDKCOption_TypeZ_Some: return 0;
5832                 case LDKCOption_TypeZ_None: return 1;
5833                 default: abort();
5834         }
5835 }
5836 uint64_t __attribute__((export_name("TS_LDKCOption_TypeZ_Some_get_some"))) TS_LDKCOption_TypeZ_Some_get_some(uint64_t ptr) {
5837         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
5838         assert(obj->tag == LDKCOption_TypeZ_Some);
5839                         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
5840                         *some_ret = Type_clone(&obj->some);
5841         return tag_ptr(some_ret, true);
5842 }
5843 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
5844 CHECK(owner->result_ok);
5845         return COption_TypeZ_clone(&*owner->contents.result);
5846 }
5847 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_get_ok(uint64_t owner) {
5848         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
5849         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
5850         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
5851         uint64_t ret_ref = tag_ptr(ret_copy, true);
5852         return ret_ref;
5853 }
5854
5855 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
5856 CHECK(!owner->result_ok);
5857         return DecodeError_clone(&*owner->contents.err);
5858 }
5859 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_err"))) TS_CResult_COption_TypeZDecodeErrorZ_get_err(uint64_t owner) {
5860         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
5861         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5862         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
5863         uint64_t ret_ref = tag_ptr(ret_copy, true);
5864         return ret_ref;
5865 }
5866
5867 uint32_t __attribute__((export_name("TS_LDKPaymentError_ty_from_ptr"))) TS_LDKPaymentError_ty_from_ptr(uint64_t ptr) {
5868         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
5869         switch(obj->tag) {
5870                 case LDKPaymentError_Invoice: return 0;
5871                 case LDKPaymentError_Routing: return 1;
5872                 case LDKPaymentError_Sending: return 2;
5873                 default: abort();
5874         }
5875 }
5876 jstring __attribute__((export_name("TS_LDKPaymentError_Invoice_get_invoice"))) TS_LDKPaymentError_Invoice_get_invoice(uint64_t ptr) {
5877         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
5878         assert(obj->tag == LDKPaymentError_Invoice);
5879                         LDKStr invoice_str = obj->invoice;
5880                         jstring invoice_conv = str_ref_to_ts(invoice_str.chars, invoice_str.len);
5881         return invoice_conv;
5882 }
5883 uint64_t __attribute__((export_name("TS_LDKPaymentError_Routing_get_routing"))) TS_LDKPaymentError_Routing_get_routing(uint64_t ptr) {
5884         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
5885         assert(obj->tag == LDKPaymentError_Routing);
5886                         LDKLightningError routing_var = obj->routing;
5887                         uint64_t routing_ref = 0;
5888                         CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var);
5889                         routing_ref = tag_ptr(routing_var.inner, false);
5890         return routing_ref;
5891 }
5892 uint64_t __attribute__((export_name("TS_LDKPaymentError_Sending_get_sending"))) TS_LDKPaymentError_Sending_get_sending(uint64_t ptr) {
5893         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
5894         assert(obj->tag == LDKPaymentError_Sending);
5895                         uint64_t sending_ref = tag_ptr(&obj->sending, false);
5896         return sending_ref;
5897 }
5898 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
5899 CHECK(owner->result_ok);
5900         return ThirtyTwoBytes_clone(&*owner->contents.result);
5901 }
5902 int8_tArray  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_ok"))) TS_CResult_PaymentIdPaymentErrorZ_get_ok(uint64_t owner) {
5903         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
5904         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5905         memcpy(ret_arr->elems, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data, 32);
5906         return ret_arr;
5907 }
5908
5909 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
5910 CHECK(!owner->result_ok);
5911         return PaymentError_clone(&*owner->contents.err);
5912 }
5913 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_err"))) TS_CResult_PaymentIdPaymentErrorZ_get_err(uint64_t owner) {
5914         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
5915         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
5916         *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
5917         uint64_t ret_ref = tag_ptr(ret_copy, true);
5918         return ret_ref;
5919 }
5920
5921 static inline void CResult_NonePaymentErrorZ_get_ok(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
5922 CHECK(owner->result_ok);
5923         return *owner->contents.result;
5924 }
5925 void  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_get_ok"))) TS_CResult_NonePaymentErrorZ_get_ok(uint64_t owner) {
5926         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
5927         CResult_NonePaymentErrorZ_get_ok(owner_conv);
5928 }
5929
5930 static inline struct LDKPaymentError CResult_NonePaymentErrorZ_get_err(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
5931 CHECK(!owner->result_ok);
5932         return PaymentError_clone(&*owner->contents.err);
5933 }
5934 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_get_err"))) TS_CResult_NonePaymentErrorZ_get_err(uint64_t owner) {
5935         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
5936         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
5937         *ret_copy = CResult_NonePaymentErrorZ_get_err(owner_conv);
5938         uint64_t ret_ref = tag_ptr(ret_copy, true);
5939         return ret_ref;
5940 }
5941
5942 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
5943 CHECK(owner->result_ok);
5944         return *owner->contents.result;
5945 }
5946 jstring  __attribute__((export_name("TS_CResult_StringErrorZ_get_ok"))) TS_CResult_StringErrorZ_get_ok(uint64_t owner) {
5947         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
5948         LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
5949         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
5950         return ret_conv;
5951 }
5952
5953 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
5954 CHECK(!owner->result_ok);
5955         return *owner->contents.err;
5956 }
5957 uint32_t  __attribute__((export_name("TS_CResult_StringErrorZ_get_err"))) TS_CResult_StringErrorZ_get_err(uint64_t owner) {
5958         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
5959         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StringErrorZ_get_err(owner_conv));
5960         return ret_conv;
5961 }
5962
5963 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
5964 CHECK(owner->result_ok);
5965         return *owner->contents.result;
5966 }
5967 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_ok"))) TS_CResult_PublicKeyErrorZ_get_ok(uint64_t owner) {
5968         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
5969         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
5970         memcpy(ret_arr->elems, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form, 33);
5971         return ret_arr;
5972 }
5973
5974 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
5975 CHECK(!owner->result_ok);
5976         return *owner->contents.err;
5977 }
5978 uint32_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_err"))) TS_CResult_PublicKeyErrorZ_get_err(uint64_t owner) {
5979         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
5980         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PublicKeyErrorZ_get_err(owner_conv));
5981         return ret_conv;
5982 }
5983
5984 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
5985         LDKChannelMonitorUpdate ret = *owner->contents.result;
5986         ret.is_owned = false;
5987         return ret;
5988 }
5989 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint64_t owner) {
5990         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
5991         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
5992         uint64_t ret_ref = 0;
5993         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5994         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5995         return ret_ref;
5996 }
5997
5998 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
5999 CHECK(!owner->result_ok);
6000         return DecodeError_clone(&*owner->contents.err);
6001 }
6002 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint64_t owner) {
6003         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
6004         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6005         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
6006         uint64_t ret_ref = tag_ptr(ret_copy, true);
6007         return ret_ref;
6008 }
6009
6010 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_ty_from_ptr"))) TS_LDKCOption_MonitorEventZ_ty_from_ptr(uint64_t ptr) {
6011         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
6012         switch(obj->tag) {
6013                 case LDKCOption_MonitorEventZ_Some: return 0;
6014                 case LDKCOption_MonitorEventZ_None: return 1;
6015                 default: abort();
6016         }
6017 }
6018 uint64_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_Some_get_some"))) TS_LDKCOption_MonitorEventZ_Some_get_some(uint64_t ptr) {
6019         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
6020         assert(obj->tag == LDKCOption_MonitorEventZ_Some);
6021                         uint64_t some_ref = tag_ptr(&obj->some, false);
6022         return some_ref;
6023 }
6024 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6025 CHECK(owner->result_ok);
6026         return COption_MonitorEventZ_clone(&*owner->contents.result);
6027 }
6028 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint64_t owner) {
6029         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
6030         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
6031         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
6032         uint64_t ret_ref = tag_ptr(ret_copy, true);
6033         return ret_ref;
6034 }
6035
6036 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6037 CHECK(!owner->result_ok);
6038         return DecodeError_clone(&*owner->contents.err);
6039 }
6040 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint64_t owner) {
6041         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
6042         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6043         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
6044         uint64_t ret_ref = tag_ptr(ret_copy, true);
6045         return ret_ref;
6046 }
6047
6048 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6049         LDKHTLCUpdate ret = *owner->contents.result;
6050         ret.is_owned = false;
6051         return ret;
6052 }
6053 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint64_t owner) {
6054         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
6055         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
6056         uint64_t ret_ref = 0;
6057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6059         return ret_ref;
6060 }
6061
6062 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6063 CHECK(!owner->result_ok);
6064         return DecodeError_clone(&*owner->contents.err);
6065 }
6066 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint64_t owner) {
6067         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
6068         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6069         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
6070         uint64_t ret_ref = tag_ptr(ret_copy, true);
6071         return ret_ref;
6072 }
6073
6074 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
6075         LDKOutPoint ret = owner->a;
6076         ret.is_owned = false;
6077         return ret;
6078 }
6079 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_a"))) TS_C2Tuple_OutPointScriptZ_get_a(uint64_t owner) {
6080         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
6081         LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
6082         uint64_t ret_ref = 0;
6083         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6084         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6085         return ret_ref;
6086 }
6087
6088 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
6089         return CVec_u8Z_clone(&owner->b);
6090 }
6091 int8_tArray  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_b"))) TS_C2Tuple_OutPointScriptZ_get_b(uint64_t owner) {
6092         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
6093         LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
6094         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6095         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6096         CVec_u8Z_free(ret_var);
6097         return ret_arr;
6098 }
6099
6100 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
6101         return owner->a;
6102 }
6103 int32_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_a"))) TS_C2Tuple_u32ScriptZ_get_a(uint64_t owner) {
6104         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
6105         int32_t ret_conv = C2Tuple_u32ScriptZ_get_a(owner_conv);
6106         return ret_conv;
6107 }
6108
6109 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
6110         return CVec_u8Z_clone(&owner->b);
6111 }
6112 int8_tArray  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_b"))) TS_C2Tuple_u32ScriptZ_get_b(uint64_t owner) {
6113         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
6114         LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
6115         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6116         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6117         CVec_u8Z_free(ret_var);
6118         return ret_arr;
6119 }
6120
6121 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
6122         LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
6123         for (size_t i = 0; i < ret.datalen; i++) {
6124                 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
6125         }
6126         return ret;
6127 }
6128 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
6129         return ThirtyTwoBytes_clone(&owner->a);
6130 }
6131 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint64_t owner) {
6132         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
6133         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6134         memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data, 32);
6135         return ret_arr;
6136 }
6137
6138 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
6139         return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
6140 }
6141 uint64_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint64_t owner) {
6142         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
6143         LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
6144         uint64_tArray ret_arr = NULL;
6145         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6146         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6147         for (size_t v = 0; v < ret_var.datalen; v++) {
6148                 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
6149                 *ret_conv_21_conv = ret_var.data[v];
6150                 ret_arr_ptr[v] = tag_ptr(ret_conv_21_conv, true);
6151         }
6152         
6153         FREE(ret_var.data);
6154         return ret_arr;
6155 }
6156
6157 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
6158         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 };
6159         for (size_t i = 0; i < ret.datalen; i++) {
6160                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
6161         }
6162         return ret;
6163 }
6164 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
6165         LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
6166         for (size_t i = 0; i < ret.datalen; i++) {
6167                 ret.data[i] = Event_clone(&orig->data[i]);
6168         }
6169         return ret;
6170 }
6171 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6172         return owner->a;
6173 }
6174 int32_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_a"))) TS_C2Tuple_u32TxOutZ_get_a(uint64_t owner) {
6175         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
6176         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
6177         return ret_conv;
6178 }
6179
6180 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6181         return TxOut_clone(&owner->b);
6182 }
6183 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_b"))) TS_C2Tuple_u32TxOutZ_get_b(uint64_t owner) {
6184         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
6185         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6186         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
6187         return tag_ptr(ret_ref, true);
6188 }
6189
6190 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
6191         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
6192         for (size_t i = 0; i < ret.datalen; i++) {
6193                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
6194         }
6195         return ret;
6196 }
6197 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6198         return ThirtyTwoBytes_clone(&owner->a);
6199 }
6200 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint64_t owner) {
6201         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
6202         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6203         memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
6204         return ret_arr;
6205 }
6206
6207 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6208         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
6209 }
6210 uint64_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint64_t owner) {
6211         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
6212         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
6213         uint64_tArray ret_arr = NULL;
6214         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6215         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6216         for (size_t u = 0; u < ret_var.datalen; u++) {
6217                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6218                 *ret_conv_20_conv = ret_var.data[u];
6219                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
6220         }
6221         
6222         FREE(ret_var.data);
6223         return ret_arr;
6224 }
6225
6226 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
6227         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 };
6228         for (size_t i = 0; i < ret.datalen; i++) {
6229                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
6230         }
6231         return ret;
6232 }
6233 uint32_t __attribute__((export_name("TS_LDKBalance_ty_from_ptr"))) TS_LDKBalance_ty_from_ptr(uint64_t ptr) {
6234         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6235         switch(obj->tag) {
6236                 case LDKBalance_ClaimableOnChannelClose: return 0;
6237                 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
6238                 case LDKBalance_ContentiousClaimable: return 2;
6239                 case LDKBalance_MaybeTimeoutClaimableHTLC: return 3;
6240                 case LDKBalance_MaybePreimageClaimableHTLC: return 4;
6241                 case LDKBalance_CounterpartyRevokedOutputClaimable: return 5;
6242                 default: abort();
6243         }
6244 }
6245 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis(uint64_t ptr) {
6246         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6247         assert(obj->tag == LDKBalance_ClaimableOnChannelClose);
6248                         int64_t claimable_amount_satoshis_conv = obj->claimable_on_channel_close.claimable_amount_satoshis;
6249         return claimable_amount_satoshis_conv;
6250 }
6251 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis(uint64_t ptr) {
6252         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6253         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6254                         int64_t claimable_amount_satoshis_conv = obj->claimable_awaiting_confirmations.claimable_amount_satoshis;
6255         return claimable_amount_satoshis_conv;
6256 }
6257 int32_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(uint64_t ptr) {
6258         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6259         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6260                         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
6261         return confirmation_height_conv;
6262 }
6263 int64_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis"))) TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis(uint64_t ptr) {
6264         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6265         assert(obj->tag == LDKBalance_ContentiousClaimable);
6266                         int64_t claimable_amount_satoshis_conv = obj->contentious_claimable.claimable_amount_satoshis;
6267         return claimable_amount_satoshis_conv;
6268 }
6269 int32_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_timeout_height"))) TS_LDKBalance_ContentiousClaimable_get_timeout_height(uint64_t ptr) {
6270         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6271         assert(obj->tag == LDKBalance_ContentiousClaimable);
6272                         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
6273         return timeout_height_conv;
6274 }
6275 int64_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_amount_satoshis"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_amount_satoshis(uint64_t ptr) {
6276         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6277         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
6278                         int64_t claimable_amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.claimable_amount_satoshis;
6279         return claimable_amount_satoshis_conv;
6280 }
6281 int32_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height(uint64_t ptr) {
6282         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6283         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
6284                         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
6285         return claimable_height_conv;
6286 }
6287 int64_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_claimable_amount_satoshis"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_claimable_amount_satoshis(uint64_t ptr) {
6288         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6289         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
6290                         int64_t claimable_amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.claimable_amount_satoshis;
6291         return claimable_amount_satoshis_conv;
6292 }
6293 int32_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height(uint64_t ptr) {
6294         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6295         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
6296                         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
6297         return expiry_height_conv;
6298 }
6299 int64_t __attribute__((export_name("TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_claimable_amount_satoshis"))) TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_claimable_amount_satoshis(uint64_t ptr) {
6300         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6301         assert(obj->tag == LDKBalance_CounterpartyRevokedOutputClaimable);
6302                         int64_t claimable_amount_satoshis_conv = obj->counterparty_revoked_output_claimable.claimable_amount_satoshis;
6303         return claimable_amount_satoshis_conv;
6304 }
6305 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
6306         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
6307         for (size_t i = 0; i < ret.datalen; i++) {
6308                 ret.data[i] = Balance_clone(&orig->data[i]);
6309         }
6310         return ret;
6311 }
6312 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
6313         return ThirtyTwoBytes_clone(&owner->a);
6314 }
6315 int8_tArray  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_a"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_a(uint64_t owner) {
6316         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
6317         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6318         memcpy(ret_arr->elems, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data, 32);
6319         return ret_arr;
6320 }
6321
6322 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
6323         LDKChannelMonitor ret = owner->b;
6324         ret.is_owned = false;
6325         return ret;
6326 }
6327 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_b"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_b(uint64_t owner) {
6328         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
6329         LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
6330         uint64_t ret_ref = 0;
6331         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6332         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6333         return ret_ref;
6334 }
6335
6336 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6337 CHECK(owner->result_ok);
6338         return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
6339 }
6340 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint64_t owner) {
6341         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
6342         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
6343         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
6344         return tag_ptr(ret_conv, true);
6345 }
6346
6347 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6348 CHECK(!owner->result_ok);
6349         return DecodeError_clone(&*owner->contents.err);
6350 }
6351 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint64_t owner) {
6352         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
6353         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6354         *ret_copy = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
6355         uint64_t ret_ref = tag_ptr(ret_copy, true);
6356         return ret_ref;
6357 }
6358
6359 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6360         return owner->a;
6361 }
6362 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_a"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint64_t owner) {
6363         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
6364         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
6365         memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
6366         return ret_arr;
6367 }
6368
6369 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6370         return Type_clone(&owner->b);
6371 }
6372 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_b"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint64_t owner) {
6373         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
6374         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
6375         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
6376         return tag_ptr(ret_ret, true);
6377 }
6378
6379 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
6380         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
6381         for (size_t i = 0; i < ret.datalen; i++) {
6382                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
6383         }
6384         return ret;
6385 }
6386 typedef struct LDKCustomOnionMessageContents_JCalls {
6387         atomic_size_t refcnt;
6388         uint32_t instance_ptr;
6389 } LDKCustomOnionMessageContents_JCalls;
6390 static void LDKCustomOnionMessageContents_JCalls_free(void* this_arg) {
6391         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
6392         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6393                 FREE(j_calls);
6394         }
6395 }
6396 uint64_t tlv_type_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
6397         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
6398         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 36, 0, 0, 0, 0, 0, 0);
6399 }
6400 LDKCVec_u8Z write_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
6401         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
6402         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 37, 0, 0, 0, 0, 0, 0);
6403         LDKCVec_u8Z ret_ref;
6404         ret_ref.datalen = ret->arr_len;
6405         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
6406         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
6407         return ret_ref;
6408 }
6409 static void LDKCustomOnionMessageContents_JCalls_cloned(LDKCustomOnionMessageContents* new_obj) {
6410         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) new_obj->this_arg;
6411         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6412 }
6413 static inline LDKCustomOnionMessageContents LDKCustomOnionMessageContents_init (JSValue o) {
6414         LDKCustomOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageContents_JCalls), "LDKCustomOnionMessageContents_JCalls");
6415         atomic_init(&calls->refcnt, 1);
6416         calls->instance_ptr = o;
6417
6418         LDKCustomOnionMessageContents ret = {
6419                 .this_arg = (void*) calls,
6420                 .tlv_type = tlv_type_LDKCustomOnionMessageContents_jcall,
6421                 .write = write_LDKCustomOnionMessageContents_jcall,
6422                 .cloned = LDKCustomOnionMessageContents_JCalls_cloned,
6423                 .free = LDKCustomOnionMessageContents_JCalls_free,
6424         };
6425         return ret;
6426 }
6427 uint64_t  __attribute__((export_name("TS_LDKCustomOnionMessageContents_new"))) TS_LDKCustomOnionMessageContents_new(JSValue o) {
6428         LDKCustomOnionMessageContents *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
6429         *res_ptr = LDKCustomOnionMessageContents_init(o);
6430         return tag_ptr(res_ptr, true);
6431 }
6432 int64_t  __attribute__((export_name("TS_CustomOnionMessageContents_tlv_type"))) TS_CustomOnionMessageContents_tlv_type(uint64_t this_arg) {
6433         void* this_arg_ptr = untag_ptr(this_arg);
6434         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6435         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
6436         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
6437         return ret_conv;
6438 }
6439
6440 int8_tArray  __attribute__((export_name("TS_CustomOnionMessageContents_write"))) TS_CustomOnionMessageContents_write(uint64_t this_arg) {
6441         void* this_arg_ptr = untag_ptr(this_arg);
6442         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6443         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
6444         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
6445         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6446         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6447         CVec_u8Z_free(ret_var);
6448         return ret_arr;
6449 }
6450
6451 uint32_t __attribute__((export_name("TS_LDKCOption_CustomOnionMessageContentsZ_ty_from_ptr"))) TS_LDKCOption_CustomOnionMessageContentsZ_ty_from_ptr(uint64_t ptr) {
6452         LDKCOption_CustomOnionMessageContentsZ *obj = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(ptr);
6453         switch(obj->tag) {
6454                 case LDKCOption_CustomOnionMessageContentsZ_Some: return 0;
6455                 case LDKCOption_CustomOnionMessageContentsZ_None: return 1;
6456                 default: abort();
6457         }
6458 }
6459 uint64_t __attribute__((export_name("TS_LDKCOption_CustomOnionMessageContentsZ_Some_get_some"))) TS_LDKCOption_CustomOnionMessageContentsZ_Some_get_some(uint64_t ptr) {
6460         LDKCOption_CustomOnionMessageContentsZ *obj = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(ptr);
6461         assert(obj->tag == LDKCOption_CustomOnionMessageContentsZ_Some);
6462                         LDKCustomOnionMessageContents* some_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
6463                         *some_ret = CustomOnionMessageContents_clone(&obj->some);
6464         return tag_ptr(some_ret, true);
6465 }
6466 static inline struct LDKCOption_CustomOnionMessageContentsZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
6467 CHECK(owner->result_ok);
6468         return COption_CustomOnionMessageContentsZ_clone(&*owner->contents.result);
6469 }
6470 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(uint64_t owner) {
6471         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
6472         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
6473         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
6474         uint64_t ret_ref = tag_ptr(ret_copy, true);
6475         return ret_ref;
6476 }
6477
6478 static inline struct LDKDecodeError CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
6479 CHECK(!owner->result_ok);
6480         return DecodeError_clone(&*owner->contents.err);
6481 }
6482 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(uint64_t owner) {
6483         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
6484         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6485         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
6486         uint64_t ret_ref = tag_ptr(ret_copy, true);
6487         return ret_ref;
6488 }
6489
6490 uint32_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_ty_from_ptr"))) TS_LDKCOption_NetAddressZ_ty_from_ptr(uint64_t ptr) {
6491         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
6492         switch(obj->tag) {
6493                 case LDKCOption_NetAddressZ_Some: return 0;
6494                 case LDKCOption_NetAddressZ_None: return 1;
6495                 default: abort();
6496         }
6497 }
6498 uint64_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_Some_get_some"))) TS_LDKCOption_NetAddressZ_Some_get_some(uint64_t ptr) {
6499         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
6500         assert(obj->tag == LDKCOption_NetAddressZ_Some);
6501                         uint64_t some_ref = tag_ptr(&obj->some, false);
6502         return some_ref;
6503 }
6504 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
6505 CHECK(owner->result_ok);
6506         return CVec_u8Z_clone(&*owner->contents.result);
6507 }
6508 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint64_t owner) {
6509         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
6510         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
6511         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6512         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6513         CVec_u8Z_free(ret_var);
6514         return ret_arr;
6515 }
6516
6517 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
6518         LDKPeerHandleError ret = *owner->contents.err;
6519         ret.is_owned = false;
6520         return ret;
6521 }
6522 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err(uint64_t owner) {
6523         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
6524         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
6525         uint64_t ret_ref = 0;
6526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6528         return ret_ref;
6529 }
6530
6531 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
6532 CHECK(owner->result_ok);
6533         return *owner->contents.result;
6534 }
6535 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_ok"))) TS_CResult_NonePeerHandleErrorZ_get_ok(uint64_t owner) {
6536         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
6537         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
6538 }
6539
6540 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
6541         LDKPeerHandleError ret = *owner->contents.err;
6542         ret.is_owned = false;
6543         return ret;
6544 }
6545 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_err"))) TS_CResult_NonePeerHandleErrorZ_get_err(uint64_t owner) {
6546         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
6547         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
6548         uint64_t ret_ref = 0;
6549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6551         return ret_ref;
6552 }
6553
6554 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
6555 CHECK(owner->result_ok);
6556         return *owner->contents.result;
6557 }
6558 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_ok"))) TS_CResult_boolPeerHandleErrorZ_get_ok(uint64_t owner) {
6559         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
6560         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
6561         return ret_conv;
6562 }
6563
6564 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
6565         LDKPeerHandleError ret = *owner->contents.err;
6566         ret.is_owned = false;
6567         return ret;
6568 }
6569 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_err"))) TS_CResult_boolPeerHandleErrorZ_get_err(uint64_t owner) {
6570         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
6571         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
6572         uint64_t ret_ref = 0;
6573         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6574         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6575         return ret_ref;
6576 }
6577
6578 uint32_t __attribute__((export_name("TS_LDKSendError_ty_from_ptr"))) TS_LDKSendError_ty_from_ptr(uint64_t ptr) {
6579         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
6580         switch(obj->tag) {
6581                 case LDKSendError_Secp256k1: return 0;
6582                 case LDKSendError_TooBigPacket: return 1;
6583                 case LDKSendError_TooFewBlindedHops: return 2;
6584                 case LDKSendError_InvalidFirstHop: return 3;
6585                 case LDKSendError_InvalidMessage: return 4;
6586                 case LDKSendError_BufferFull: return 5;
6587                 case LDKSendError_GetNodeIdFailed: return 6;
6588                 case LDKSendError_BlindedPathAdvanceFailed: return 7;
6589                 default: abort();
6590         }
6591 }
6592 uint32_t __attribute__((export_name("TS_LDKSendError_Secp256k1_get_secp256k1"))) TS_LDKSendError_Secp256k1_get_secp256k1(uint64_t ptr) {
6593         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
6594         assert(obj->tag == LDKSendError_Secp256k1);
6595                         uint32_t secp256k1_conv = LDKSecp256k1Error_to_js(obj->secp256k1);
6596         return secp256k1_conv;
6597 }
6598 static inline void CResult_NoneSendErrorZ_get_ok(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
6599 CHECK(owner->result_ok);
6600         return *owner->contents.result;
6601 }
6602 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_get_ok"))) TS_CResult_NoneSendErrorZ_get_ok(uint64_t owner) {
6603         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
6604         CResult_NoneSendErrorZ_get_ok(owner_conv);
6605 }
6606
6607 static inline struct LDKSendError CResult_NoneSendErrorZ_get_err(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
6608 CHECK(!owner->result_ok);
6609         return SendError_clone(&*owner->contents.err);
6610 }
6611 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_get_err"))) TS_CResult_NoneSendErrorZ_get_err(uint64_t owner) {
6612         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
6613         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
6614         *ret_copy = CResult_NoneSendErrorZ_get_err(owner_conv);
6615         uint64_t ret_ref = tag_ptr(ret_copy, true);
6616         return ret_ref;
6617 }
6618
6619 uint32_t __attribute__((export_name("TS_LDKGraphSyncError_ty_from_ptr"))) TS_LDKGraphSyncError_ty_from_ptr(uint64_t ptr) {
6620         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
6621         switch(obj->tag) {
6622                 case LDKGraphSyncError_DecodeError: return 0;
6623                 case LDKGraphSyncError_LightningError: return 1;
6624                 default: abort();
6625         }
6626 }
6627 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_DecodeError_get_decode_error"))) TS_LDKGraphSyncError_DecodeError_get_decode_error(uint64_t ptr) {
6628         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
6629         assert(obj->tag == LDKGraphSyncError_DecodeError);
6630                         uint64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
6631         return decode_error_ref;
6632 }
6633 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_LightningError_get_lightning_error"))) TS_LDKGraphSyncError_LightningError_get_lightning_error(uint64_t ptr) {
6634         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
6635         assert(obj->tag == LDKGraphSyncError_LightningError);
6636                         LDKLightningError lightning_error_var = obj->lightning_error;
6637                         uint64_t lightning_error_ref = 0;
6638                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
6639                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
6640         return lightning_error_ref;
6641 }
6642 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
6643 CHECK(owner->result_ok);
6644         return *owner->contents.result;
6645 }
6646 int32_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_ok"))) TS_CResult_u32GraphSyncErrorZ_get_ok(uint64_t owner) {
6647         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
6648         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
6649         return ret_conv;
6650 }
6651
6652 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
6653 CHECK(!owner->result_ok);
6654         return GraphSyncError_clone(&*owner->contents.err);
6655 }
6656 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_err"))) TS_CResult_u32GraphSyncErrorZ_get_err(uint64_t owner) {
6657         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
6658         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
6659         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
6660         uint64_t ret_ref = tag_ptr(ret_copy, true);
6661         return ret_ref;
6662 }
6663
6664 uint32_t __attribute__((export_name("TS_LDKParseError_ty_from_ptr"))) TS_LDKParseError_ty_from_ptr(uint64_t ptr) {
6665         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
6666         switch(obj->tag) {
6667                 case LDKParseError_Bech32Error: return 0;
6668                 case LDKParseError_ParseAmountError: return 1;
6669                 case LDKParseError_MalformedSignature: return 2;
6670                 case LDKParseError_BadPrefix: return 3;
6671                 case LDKParseError_UnknownCurrency: return 4;
6672                 case LDKParseError_UnknownSiPrefix: return 5;
6673                 case LDKParseError_MalformedHRP: return 6;
6674                 case LDKParseError_TooShortDataPart: return 7;
6675                 case LDKParseError_UnexpectedEndOfTaggedFields: return 8;
6676                 case LDKParseError_DescriptionDecodeError: return 9;
6677                 case LDKParseError_PaddingError: return 10;
6678                 case LDKParseError_IntegerOverflowError: return 11;
6679                 case LDKParseError_InvalidSegWitProgramLength: return 12;
6680                 case LDKParseError_InvalidPubKeyHashLength: return 13;
6681                 case LDKParseError_InvalidScriptHashLength: return 14;
6682                 case LDKParseError_InvalidRecoveryId: return 15;
6683                 case LDKParseError_InvalidSliceLength: return 16;
6684                 case LDKParseError_Skip: return 17;
6685                 default: abort();
6686         }
6687 }
6688 uint64_t __attribute__((export_name("TS_LDKParseError_Bech32Error_get_bech32_error"))) TS_LDKParseError_Bech32Error_get_bech32_error(uint64_t ptr) {
6689         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
6690         assert(obj->tag == LDKParseError_Bech32Error);
6691                         uint64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
6692         return bech32_error_ref;
6693 }
6694 int32_t __attribute__((export_name("TS_LDKParseError_ParseAmountError_get_parse_amount_error"))) TS_LDKParseError_ParseAmountError_get_parse_amount_error(uint64_t ptr) {
6695         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
6696         assert(obj->tag == LDKParseError_ParseAmountError);
6697                         /*obj->parse_amount_error*/
6698         return 0;
6699 }
6700 uint32_t __attribute__((export_name("TS_LDKParseError_MalformedSignature_get_malformed_signature"))) TS_LDKParseError_MalformedSignature_get_malformed_signature(uint64_t ptr) {
6701         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
6702         assert(obj->tag == LDKParseError_MalformedSignature);
6703                         uint32_t malformed_signature_conv = LDKSecp256k1Error_to_js(obj->malformed_signature);
6704         return malformed_signature_conv;
6705 }
6706 int32_t __attribute__((export_name("TS_LDKParseError_DescriptionDecodeError_get_description_decode_error"))) TS_LDKParseError_DescriptionDecodeError_get_description_decode_error(uint64_t ptr) {
6707         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
6708         assert(obj->tag == LDKParseError_DescriptionDecodeError);
6709                         /*obj->description_decode_error*/
6710         return 0;
6711 }
6712 jstring __attribute__((export_name("TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length"))) TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length(uint64_t ptr) {
6713         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
6714         assert(obj->tag == LDKParseError_InvalidSliceLength);
6715                         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
6716                         jstring invalid_slice_length_conv = str_ref_to_ts(invalid_slice_length_str.chars, invalid_slice_length_str.len);
6717         return invalid_slice_length_conv;
6718 }
6719 static inline enum LDKSiPrefix CResult_SiPrefixParseErrorZ_get_ok(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
6720 CHECK(owner->result_ok);
6721         return SiPrefix_clone(&*owner->contents.result);
6722 }
6723 uint32_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_ok"))) TS_CResult_SiPrefixParseErrorZ_get_ok(uint64_t owner) {
6724         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
6725         uint32_t ret_conv = LDKSiPrefix_to_js(CResult_SiPrefixParseErrorZ_get_ok(owner_conv));
6726         return ret_conv;
6727 }
6728
6729 static inline struct LDKParseError CResult_SiPrefixParseErrorZ_get_err(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
6730 CHECK(!owner->result_ok);
6731         return ParseError_clone(&*owner->contents.err);
6732 }
6733 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_err"))) TS_CResult_SiPrefixParseErrorZ_get_err(uint64_t owner) {
6734         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
6735         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
6736         *ret_copy = CResult_SiPrefixParseErrorZ_get_err(owner_conv);
6737         uint64_t ret_ref = tag_ptr(ret_copy, true);
6738         return ret_ref;
6739 }
6740
6741 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_ty_from_ptr"))) TS_LDKParseOrSemanticError_ty_from_ptr(uint64_t ptr) {
6742         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
6743         switch(obj->tag) {
6744                 case LDKParseOrSemanticError_ParseError: return 0;
6745                 case LDKParseOrSemanticError_SemanticError: return 1;
6746                 default: abort();
6747         }
6748 }
6749 uint64_t __attribute__((export_name("TS_LDKParseOrSemanticError_ParseError_get_parse_error"))) TS_LDKParseOrSemanticError_ParseError_get_parse_error(uint64_t ptr) {
6750         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
6751         assert(obj->tag == LDKParseOrSemanticError_ParseError);
6752                         uint64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
6753         return parse_error_ref;
6754 }
6755 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_SemanticError_get_semantic_error"))) TS_LDKParseOrSemanticError_SemanticError_get_semantic_error(uint64_t ptr) {
6756         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
6757         assert(obj->tag == LDKParseOrSemanticError_SemanticError);
6758                         uint32_t semantic_error_conv = LDKSemanticError_to_js(obj->semantic_error);
6759         return semantic_error_conv;
6760 }
6761 static inline struct LDKInvoice CResult_InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
6762         LDKInvoice ret = *owner->contents.result;
6763         ret.is_owned = false;
6764         return ret;
6765 }
6766 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok(uint64_t owner) {
6767         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
6768         LDKInvoice ret_var = CResult_InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
6769         uint64_t ret_ref = 0;
6770         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6771         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6772         return ret_ref;
6773 }
6774
6775 static inline struct LDKParseOrSemanticError CResult_InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
6776 CHECK(!owner->result_ok);
6777         return ParseOrSemanticError_clone(&*owner->contents.err);
6778 }
6779 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_err(uint64_t owner) {
6780         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
6781         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
6782         *ret_copy = CResult_InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
6783         uint64_t ret_ref = tag_ptr(ret_copy, true);
6784         return ret_ref;
6785 }
6786
6787 static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceParseErrorZ_get_ok(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
6788         LDKSignedRawInvoice ret = *owner->contents.result;
6789         ret.is_owned = false;
6790         return ret;
6791 }
6792 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_ok(uint64_t owner) {
6793         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
6794         LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceParseErrorZ_get_ok(owner_conv);
6795         uint64_t ret_ref = 0;
6796         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6797         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6798         return ret_ref;
6799 }
6800
6801 static inline struct LDKParseError CResult_SignedRawInvoiceParseErrorZ_get_err(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
6802 CHECK(!owner->result_ok);
6803         return ParseError_clone(&*owner->contents.err);
6804 }
6805 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_err(uint64_t owner) {
6806         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
6807         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
6808         *ret_copy = CResult_SignedRawInvoiceParseErrorZ_get_err(owner_conv);
6809         uint64_t ret_ref = tag_ptr(ret_copy, true);
6810         return ret_ref;
6811 }
6812
6813 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
6814         LDKRawInvoice ret = owner->a;
6815         ret.is_owned = false;
6816         return ret;
6817 }
6818 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(uint64_t owner) {
6819         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
6820         LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv);
6821         uint64_t ret_ref = 0;
6822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6824         return ret_ref;
6825 }
6826
6827 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
6828         return ThirtyTwoBytes_clone(&owner->b);
6829 }
6830 int8_tArray  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(uint64_t owner) {
6831         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
6832         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6833         memcpy(ret_arr->elems, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data, 32);
6834         return ret_arr;
6835 }
6836
6837 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
6838         LDKInvoiceSignature ret = owner->c;
6839         ret.is_owned = false;
6840         return ret;
6841 }
6842 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(uint64_t owner) {
6843         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
6844         LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(owner_conv);
6845         uint64_t ret_ref = 0;
6846         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6847         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6848         return ret_ref;
6849 }
6850
6851 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
6852         LDKPayeePubKey ret = *owner->contents.result;
6853         ret.is_owned = false;
6854         return ret;
6855 }
6856 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_ok"))) TS_CResult_PayeePubKeyErrorZ_get_ok(uint64_t owner) {
6857         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
6858         LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
6859         uint64_t ret_ref = 0;
6860         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6861         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6862         return ret_ref;
6863 }
6864
6865 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
6866 CHECK(!owner->result_ok);
6867         return *owner->contents.err;
6868 }
6869 uint32_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_err"))) TS_CResult_PayeePubKeyErrorZ_get_err(uint64_t owner) {
6870         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
6871         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PayeePubKeyErrorZ_get_err(owner_conv));
6872         return ret_conv;
6873 }
6874
6875 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
6876         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
6877         for (size_t i = 0; i < ret.datalen; i++) {
6878                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
6879         }
6880         return ret;
6881 }
6882 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
6883         LDKPositiveTimestamp ret = *owner->contents.result;
6884         ret.is_owned = false;
6885         return ret;
6886 }
6887 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_get_ok(uint64_t owner) {
6888         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
6889         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
6890         uint64_t ret_ref = 0;
6891         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6892         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6893         return ret_ref;
6894 }
6895
6896 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
6897 CHECK(!owner->result_ok);
6898         return CreationError_clone(&*owner->contents.err);
6899 }
6900 uint32_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_err"))) TS_CResult_PositiveTimestampCreationErrorZ_get_err(uint64_t owner) {
6901         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
6902         uint32_t ret_conv = LDKCreationError_to_js(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
6903         return ret_conv;
6904 }
6905
6906 static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
6907 CHECK(owner->result_ok);
6908         return *owner->contents.result;
6909 }
6910 void  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_ok"))) TS_CResult_NoneSemanticErrorZ_get_ok(uint64_t owner) {
6911         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
6912         CResult_NoneSemanticErrorZ_get_ok(owner_conv);
6913 }
6914
6915 static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
6916 CHECK(!owner->result_ok);
6917         return SemanticError_clone(&*owner->contents.err);
6918 }
6919 uint32_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_err"))) TS_CResult_NoneSemanticErrorZ_get_err(uint64_t owner) {
6920         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
6921         uint32_t ret_conv = LDKSemanticError_to_js(CResult_NoneSemanticErrorZ_get_err(owner_conv));
6922         return ret_conv;
6923 }
6924
6925 static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
6926         LDKInvoice ret = *owner->contents.result;
6927         ret.is_owned = false;
6928         return ret;
6929 }
6930 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_ok"))) TS_CResult_InvoiceSemanticErrorZ_get_ok(uint64_t owner) {
6931         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
6932         LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv);
6933         uint64_t ret_ref = 0;
6934         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6935         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6936         return ret_ref;
6937 }
6938
6939 static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
6940 CHECK(!owner->result_ok);
6941         return SemanticError_clone(&*owner->contents.err);
6942 }
6943 uint32_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_err"))) TS_CResult_InvoiceSemanticErrorZ_get_err(uint64_t owner) {
6944         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
6945         uint32_t ret_conv = LDKSemanticError_to_js(CResult_InvoiceSemanticErrorZ_get_err(owner_conv));
6946         return ret_conv;
6947 }
6948
6949 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
6950         LDKDescription ret = *owner->contents.result;
6951         ret.is_owned = false;
6952         return ret;
6953 }
6954 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_ok"))) TS_CResult_DescriptionCreationErrorZ_get_ok(uint64_t owner) {
6955         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
6956         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
6957         uint64_t ret_ref = 0;
6958         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6959         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6960         return ret_ref;
6961 }
6962
6963 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
6964 CHECK(!owner->result_ok);
6965         return CreationError_clone(&*owner->contents.err);
6966 }
6967 uint32_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_err"))) TS_CResult_DescriptionCreationErrorZ_get_err(uint64_t owner) {
6968         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
6969         uint32_t ret_conv = LDKCreationError_to_js(CResult_DescriptionCreationErrorZ_get_err(owner_conv));
6970         return ret_conv;
6971 }
6972
6973 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
6974         LDKPrivateRoute ret = *owner->contents.result;
6975         ret.is_owned = false;
6976         return ret;
6977 }
6978 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_ok"))) TS_CResult_PrivateRouteCreationErrorZ_get_ok(uint64_t owner) {
6979         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
6980         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
6981         uint64_t ret_ref = 0;
6982         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6983         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6984         return ret_ref;
6985 }
6986
6987 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
6988 CHECK(!owner->result_ok);
6989         return CreationError_clone(&*owner->contents.err);
6990 }
6991 uint32_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_err"))) TS_CResult_PrivateRouteCreationErrorZ_get_err(uint64_t owner) {
6992         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
6993         uint32_t ret_conv = LDKCreationError_to_js(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
6994         return ret_conv;
6995 }
6996
6997 static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
6998 CHECK(owner->result_ok);
6999         return *owner->contents.result;
7000 }
7001 void  __attribute__((export_name("TS_CResult_NoneErrorZ_get_ok"))) TS_CResult_NoneErrorZ_get_ok(uint64_t owner) {
7002         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
7003         CResult_NoneErrorZ_get_ok(owner_conv);
7004 }
7005
7006 static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
7007 CHECK(!owner->result_ok);
7008         return *owner->contents.err;
7009 }
7010 uint32_t  __attribute__((export_name("TS_CResult_NoneErrorZ_get_err"))) TS_CResult_NoneErrorZ_get_err(uint64_t owner) {
7011         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
7012         uint32_t ret_conv = LDKIOError_to_js(CResult_NoneErrorZ_get_err(owner_conv));
7013         return ret_conv;
7014 }
7015
7016 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
7017 CHECK(owner->result_ok);
7018         return NetAddress_clone(&*owner->contents.result);
7019 }
7020 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_ok"))) TS_CResult_NetAddressDecodeErrorZ_get_ok(uint64_t owner) {
7021         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
7022         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
7023         *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
7024         uint64_t ret_ref = tag_ptr(ret_copy, true);
7025         return ret_ref;
7026 }
7027
7028 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
7029 CHECK(!owner->result_ok);
7030         return DecodeError_clone(&*owner->contents.err);
7031 }
7032 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_err"))) TS_CResult_NetAddressDecodeErrorZ_get_err(uint64_t owner) {
7033         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
7034         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7035         *ret_copy = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
7036         uint64_t ret_ref = tag_ptr(ret_copy, true);
7037         return ret_ref;
7038 }
7039
7040 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
7041         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
7042         for (size_t i = 0; i < ret.datalen; i++) {
7043                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
7044         }
7045         return ret;
7046 }
7047 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
7048         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
7049         for (size_t i = 0; i < ret.datalen; i++) {
7050                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
7051         }
7052         return ret;
7053 }
7054 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
7055         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
7056         for (size_t i = 0; i < ret.datalen; i++) {
7057                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
7058         }
7059         return ret;
7060 }
7061 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
7062         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
7063         for (size_t i = 0; i < ret.datalen; i++) {
7064                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
7065         }
7066         return ret;
7067 }
7068 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
7069         LDKAcceptChannel ret = *owner->contents.result;
7070         ret.is_owned = false;
7071         return ret;
7072 }
7073 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint64_t owner) {
7074         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
7075         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
7076         uint64_t ret_ref = 0;
7077         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7078         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7079         return ret_ref;
7080 }
7081
7082 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
7083 CHECK(!owner->result_ok);
7084         return DecodeError_clone(&*owner->contents.err);
7085 }
7086 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_err"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint64_t owner) {
7087         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
7088         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7089         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
7090         uint64_t ret_ref = tag_ptr(ret_copy, true);
7091         return ret_ref;
7092 }
7093
7094 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
7095         LDKAnnouncementSignatures ret = *owner->contents.result;
7096         ret.is_owned = false;
7097         return ret;
7098 }
7099 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
7100         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
7101         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
7102         uint64_t ret_ref = 0;
7103         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7104         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7105         return ret_ref;
7106 }
7107
7108 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
7109 CHECK(!owner->result_ok);
7110         return DecodeError_clone(&*owner->contents.err);
7111 }
7112 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint64_t owner) {
7113         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
7114         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7115         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
7116         uint64_t ret_ref = tag_ptr(ret_copy, true);
7117         return ret_ref;
7118 }
7119
7120 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
7121         LDKChannelReestablish ret = *owner->contents.result;
7122         ret.is_owned = false;
7123         return ret;
7124 }
7125 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint64_t owner) {
7126         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
7127         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
7128         uint64_t ret_ref = 0;
7129         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7130         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7131         return ret_ref;
7132 }
7133
7134 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
7135 CHECK(!owner->result_ok);
7136         return DecodeError_clone(&*owner->contents.err);
7137 }
7138 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint64_t owner) {
7139         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
7140         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7141         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
7142         uint64_t ret_ref = tag_ptr(ret_copy, true);
7143         return ret_ref;
7144 }
7145
7146 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
7147         LDKClosingSigned ret = *owner->contents.result;
7148         ret.is_owned = false;
7149         return ret;
7150 }
7151 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint64_t owner) {
7152         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
7153         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
7154         uint64_t ret_ref = 0;
7155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7157         return ret_ref;
7158 }
7159
7160 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
7161 CHECK(!owner->result_ok);
7162         return DecodeError_clone(&*owner->contents.err);
7163 }
7164 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint64_t owner) {
7165         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
7166         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7167         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
7168         uint64_t ret_ref = tag_ptr(ret_copy, true);
7169         return ret_ref;
7170 }
7171
7172 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
7173         LDKClosingSignedFeeRange ret = *owner->contents.result;
7174         ret.is_owned = false;
7175         return ret;
7176 }
7177 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint64_t owner) {
7178         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
7179         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
7180         uint64_t ret_ref = 0;
7181         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7182         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7183         return ret_ref;
7184 }
7185
7186 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
7187 CHECK(!owner->result_ok);
7188         return DecodeError_clone(&*owner->contents.err);
7189 }
7190 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint64_t owner) {
7191         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
7192         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7193         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
7194         uint64_t ret_ref = tag_ptr(ret_copy, true);
7195         return ret_ref;
7196 }
7197
7198 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
7199         LDKCommitmentSigned ret = *owner->contents.result;
7200         ret.is_owned = false;
7201         return ret;
7202 }
7203 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_ok(uint64_t owner) {
7204         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
7205         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
7206         uint64_t ret_ref = 0;
7207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7209         return ret_ref;
7210 }
7211
7212 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
7213 CHECK(!owner->result_ok);
7214         return DecodeError_clone(&*owner->contents.err);
7215 }
7216 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_err(uint64_t owner) {
7217         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
7218         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7219         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
7220         uint64_t ret_ref = tag_ptr(ret_copy, true);
7221         return ret_ref;
7222 }
7223
7224 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
7225         LDKFundingCreated ret = *owner->contents.result;
7226         ret.is_owned = false;
7227         return ret;
7228 }
7229 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_get_ok(uint64_t owner) {
7230         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
7231         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
7232         uint64_t ret_ref = 0;
7233         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7234         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7235         return ret_ref;
7236 }
7237
7238 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
7239 CHECK(!owner->result_ok);
7240         return DecodeError_clone(&*owner->contents.err);
7241 }
7242 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_err"))) TS_CResult_FundingCreatedDecodeErrorZ_get_err(uint64_t owner) {
7243         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
7244         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7245         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
7246         uint64_t ret_ref = tag_ptr(ret_copy, true);
7247         return ret_ref;
7248 }
7249
7250 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7251         LDKFundingSigned ret = *owner->contents.result;
7252         ret.is_owned = false;
7253         return ret;
7254 }
7255 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_ok"))) TS_CResult_FundingSignedDecodeErrorZ_get_ok(uint64_t owner) {
7256         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
7257         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
7258         uint64_t ret_ref = 0;
7259         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7260         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7261         return ret_ref;
7262 }
7263
7264 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
7265 CHECK(!owner->result_ok);
7266         return DecodeError_clone(&*owner->contents.err);
7267 }
7268 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_err"))) TS_CResult_FundingSignedDecodeErrorZ_get_err(uint64_t owner) {
7269         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
7270         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7271         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
7272         uint64_t ret_ref = tag_ptr(ret_copy, true);
7273         return ret_ref;
7274 }
7275
7276 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7277         LDKChannelReady ret = *owner->contents.result;
7278         ret.is_owned = false;
7279         return ret;
7280 }
7281 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_get_ok(uint64_t owner) {
7282         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
7283         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
7284         uint64_t ret_ref = 0;
7285         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7286         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7287         return ret_ref;
7288 }
7289
7290 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7291 CHECK(!owner->result_ok);
7292         return DecodeError_clone(&*owner->contents.err);
7293 }
7294 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_err"))) TS_CResult_ChannelReadyDecodeErrorZ_get_err(uint64_t owner) {
7295         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
7296         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7297         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
7298         uint64_t ret_ref = tag_ptr(ret_copy, true);
7299         return ret_ref;
7300 }
7301
7302 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7303         LDKInit ret = *owner->contents.result;
7304         ret.is_owned = false;
7305         return ret;
7306 }
7307 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_ok"))) TS_CResult_InitDecodeErrorZ_get_ok(uint64_t owner) {
7308         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
7309         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
7310         uint64_t ret_ref = 0;
7311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7313         return ret_ref;
7314 }
7315
7316 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7317 CHECK(!owner->result_ok);
7318         return DecodeError_clone(&*owner->contents.err);
7319 }
7320 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_err"))) TS_CResult_InitDecodeErrorZ_get_err(uint64_t owner) {
7321         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
7322         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7323         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
7324         uint64_t ret_ref = tag_ptr(ret_copy, true);
7325         return ret_ref;
7326 }
7327
7328 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
7329         LDKOpenChannel ret = *owner->contents.result;
7330         ret.is_owned = false;
7331         return ret;
7332 }
7333 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_ok"))) TS_CResult_OpenChannelDecodeErrorZ_get_ok(uint64_t owner) {
7334         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
7335         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
7336         uint64_t ret_ref = 0;
7337         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7338         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7339         return ret_ref;
7340 }
7341
7342 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
7343 CHECK(!owner->result_ok);
7344         return DecodeError_clone(&*owner->contents.err);
7345 }
7346 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_err"))) TS_CResult_OpenChannelDecodeErrorZ_get_err(uint64_t owner) {
7347         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
7348         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7349         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
7350         uint64_t ret_ref = tag_ptr(ret_copy, true);
7351         return ret_ref;
7352 }
7353
7354 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
7355         LDKRevokeAndACK ret = *owner->contents.result;
7356         ret.is_owned = false;
7357         return ret;
7358 }
7359 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_ok(uint64_t owner) {
7360         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
7361         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
7362         uint64_t ret_ref = 0;
7363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7365         return ret_ref;
7366 }
7367
7368 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
7369 CHECK(!owner->result_ok);
7370         return DecodeError_clone(&*owner->contents.err);
7371 }
7372 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_err(uint64_t owner) {
7373         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
7374         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7375         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
7376         uint64_t ret_ref = tag_ptr(ret_copy, true);
7377         return ret_ref;
7378 }
7379
7380 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
7381         LDKShutdown ret = *owner->contents.result;
7382         ret.is_owned = false;
7383         return ret;
7384 }
7385 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_ok"))) TS_CResult_ShutdownDecodeErrorZ_get_ok(uint64_t owner) {
7386         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
7387         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
7388         uint64_t ret_ref = 0;
7389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7391         return ret_ref;
7392 }
7393
7394 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
7395 CHECK(!owner->result_ok);
7396         return DecodeError_clone(&*owner->contents.err);
7397 }
7398 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_err"))) TS_CResult_ShutdownDecodeErrorZ_get_err(uint64_t owner) {
7399         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
7400         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7401         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
7402         uint64_t ret_ref = tag_ptr(ret_copy, true);
7403         return ret_ref;
7404 }
7405
7406 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
7407         LDKUpdateFailHTLC ret = *owner->contents.result;
7408         ret.is_owned = false;
7409         return ret;
7410 }
7411 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint64_t owner) {
7412         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
7413         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
7414         uint64_t ret_ref = 0;
7415         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7416         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7417         return ret_ref;
7418 }
7419
7420 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
7421 CHECK(!owner->result_ok);
7422         return DecodeError_clone(&*owner->contents.err);
7423 }
7424 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err(uint64_t owner) {
7425         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
7426         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7427         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
7428         uint64_t ret_ref = tag_ptr(ret_copy, true);
7429         return ret_ref;
7430 }
7431
7432 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
7433         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
7434         ret.is_owned = false;
7435         return ret;
7436 }
7437 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint64_t owner) {
7438         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
7439         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
7440         uint64_t ret_ref = 0;
7441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7443         return ret_ref;
7444 }
7445
7446 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
7447 CHECK(!owner->result_ok);
7448         return DecodeError_clone(&*owner->contents.err);
7449 }
7450 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint64_t owner) {
7451         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
7452         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7453         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
7454         uint64_t ret_ref = tag_ptr(ret_copy, true);
7455         return ret_ref;
7456 }
7457
7458 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
7459         LDKUpdateFee ret = *owner->contents.result;
7460         ret.is_owned = false;
7461         return ret;
7462 }
7463 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_get_ok(uint64_t owner) {
7464         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
7465         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
7466         uint64_t ret_ref = 0;
7467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7469         return ret_ref;
7470 }
7471
7472 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
7473 CHECK(!owner->result_ok);
7474         return DecodeError_clone(&*owner->contents.err);
7475 }
7476 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_err"))) TS_CResult_UpdateFeeDecodeErrorZ_get_err(uint64_t owner) {
7477         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
7478         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7479         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
7480         uint64_t ret_ref = tag_ptr(ret_copy, true);
7481         return ret_ref;
7482 }
7483
7484 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
7485         LDKUpdateFulfillHTLC ret = *owner->contents.result;
7486         ret.is_owned = false;
7487         return ret;
7488 }
7489 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint64_t owner) {
7490         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
7491         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
7492         uint64_t ret_ref = 0;
7493         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7494         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7495         return ret_ref;
7496 }
7497
7498 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
7499 CHECK(!owner->result_ok);
7500         return DecodeError_clone(&*owner->contents.err);
7501 }
7502 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint64_t owner) {
7503         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
7504         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7505         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
7506         uint64_t ret_ref = tag_ptr(ret_copy, true);
7507         return ret_ref;
7508 }
7509
7510 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
7511         LDKUpdateAddHTLC ret = *owner->contents.result;
7512         ret.is_owned = false;
7513         return ret;
7514 }
7515 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint64_t owner) {
7516         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
7517         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
7518         uint64_t ret_ref = 0;
7519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7520         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7521         return ret_ref;
7522 }
7523
7524 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
7525 CHECK(!owner->result_ok);
7526         return DecodeError_clone(&*owner->contents.err);
7527 }
7528 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err(uint64_t owner) {
7529         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
7530         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7531         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
7532         uint64_t ret_ref = tag_ptr(ret_copy, true);
7533         return ret_ref;
7534 }
7535
7536 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
7537         LDKOnionMessage ret = *owner->contents.result;
7538         ret.is_owned = false;
7539         return ret;
7540 }
7541 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_ok"))) TS_CResult_OnionMessageDecodeErrorZ_get_ok(uint64_t owner) {
7542         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
7543         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
7544         uint64_t ret_ref = 0;
7545         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7546         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7547         return ret_ref;
7548 }
7549
7550 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
7551 CHECK(!owner->result_ok);
7552         return DecodeError_clone(&*owner->contents.err);
7553 }
7554 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_err"))) TS_CResult_OnionMessageDecodeErrorZ_get_err(uint64_t owner) {
7555         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
7556         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7557         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
7558         uint64_t ret_ref = tag_ptr(ret_copy, true);
7559         return ret_ref;
7560 }
7561
7562 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
7563         LDKPing ret = *owner->contents.result;
7564         ret.is_owned = false;
7565         return ret;
7566 }
7567 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_ok"))) TS_CResult_PingDecodeErrorZ_get_ok(uint64_t owner) {
7568         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
7569         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
7570         uint64_t ret_ref = 0;
7571         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7572         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7573         return ret_ref;
7574 }
7575
7576 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
7577 CHECK(!owner->result_ok);
7578         return DecodeError_clone(&*owner->contents.err);
7579 }
7580 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_err"))) TS_CResult_PingDecodeErrorZ_get_err(uint64_t owner) {
7581         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
7582         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7583         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
7584         uint64_t ret_ref = tag_ptr(ret_copy, true);
7585         return ret_ref;
7586 }
7587
7588 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
7589         LDKPong ret = *owner->contents.result;
7590         ret.is_owned = false;
7591         return ret;
7592 }
7593 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_ok"))) TS_CResult_PongDecodeErrorZ_get_ok(uint64_t owner) {
7594         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
7595         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
7596         uint64_t ret_ref = 0;
7597         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7598         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7599         return ret_ref;
7600 }
7601
7602 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
7603 CHECK(!owner->result_ok);
7604         return DecodeError_clone(&*owner->contents.err);
7605 }
7606 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_err"))) TS_CResult_PongDecodeErrorZ_get_err(uint64_t owner) {
7607         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
7608         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7609         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
7610         uint64_t ret_ref = tag_ptr(ret_copy, true);
7611         return ret_ref;
7612 }
7613
7614 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7615         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
7616         ret.is_owned = false;
7617         return ret;
7618 }
7619 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
7620         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
7621         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
7622         uint64_t ret_ref = 0;
7623         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7624         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7625         return ret_ref;
7626 }
7627
7628 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7629 CHECK(!owner->result_ok);
7630         return DecodeError_clone(&*owner->contents.err);
7631 }
7632 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
7633         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
7634         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7635         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
7636         uint64_t ret_ref = tag_ptr(ret_copy, true);
7637         return ret_ref;
7638 }
7639
7640 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7641         LDKChannelAnnouncement ret = *owner->contents.result;
7642         ret.is_owned = false;
7643         return ret;
7644 }
7645 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
7646         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
7647         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
7648         uint64_t ret_ref = 0;
7649         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7650         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7651         return ret_ref;
7652 }
7653
7654 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7655 CHECK(!owner->result_ok);
7656         return DecodeError_clone(&*owner->contents.err);
7657 }
7658 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
7659         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
7660         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7661         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
7662         uint64_t ret_ref = tag_ptr(ret_copy, true);
7663         return ret_ref;
7664 }
7665
7666 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7667         LDKUnsignedChannelUpdate ret = *owner->contents.result;
7668         ret.is_owned = false;
7669         return ret;
7670 }
7671 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
7672         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
7673         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
7674         uint64_t ret_ref = 0;
7675         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7676         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7677         return ret_ref;
7678 }
7679
7680 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7681 CHECK(!owner->result_ok);
7682         return DecodeError_clone(&*owner->contents.err);
7683 }
7684 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
7685         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
7686         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7687         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
7688         uint64_t ret_ref = tag_ptr(ret_copy, true);
7689         return ret_ref;
7690 }
7691
7692 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7693         LDKChannelUpdate ret = *owner->contents.result;
7694         ret.is_owned = false;
7695         return ret;
7696 }
7697 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
7698         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
7699         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
7700         uint64_t ret_ref = 0;
7701         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7702         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7703         return ret_ref;
7704 }
7705
7706 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7707 CHECK(!owner->result_ok);
7708         return DecodeError_clone(&*owner->contents.err);
7709 }
7710 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
7711         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
7712         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7713         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
7714         uint64_t ret_ref = tag_ptr(ret_copy, true);
7715         return ret_ref;
7716 }
7717
7718 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
7719         LDKErrorMessage ret = *owner->contents.result;
7720         ret.is_owned = false;
7721         return ret;
7722 }
7723 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_get_ok(uint64_t owner) {
7724         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
7725         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
7726         uint64_t ret_ref = 0;
7727         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7728         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7729         return ret_ref;
7730 }
7731
7732 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
7733 CHECK(!owner->result_ok);
7734         return DecodeError_clone(&*owner->contents.err);
7735 }
7736 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_err"))) TS_CResult_ErrorMessageDecodeErrorZ_get_err(uint64_t owner) {
7737         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
7738         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7739         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
7740         uint64_t ret_ref = tag_ptr(ret_copy, true);
7741         return ret_ref;
7742 }
7743
7744 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
7745         LDKWarningMessage ret = *owner->contents.result;
7746         ret.is_owned = false;
7747         return ret;
7748 }
7749 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_ok"))) TS_CResult_WarningMessageDecodeErrorZ_get_ok(uint64_t owner) {
7750         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
7751         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
7752         uint64_t ret_ref = 0;
7753         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7754         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7755         return ret_ref;
7756 }
7757
7758 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
7759 CHECK(!owner->result_ok);
7760         return DecodeError_clone(&*owner->contents.err);
7761 }
7762 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_err"))) TS_CResult_WarningMessageDecodeErrorZ_get_err(uint64_t owner) {
7763         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
7764         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7765         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
7766         uint64_t ret_ref = tag_ptr(ret_copy, true);
7767         return ret_ref;
7768 }
7769
7770 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7771         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
7772         ret.is_owned = false;
7773         return ret;
7774 }
7775 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
7776         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
7777         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
7778         uint64_t ret_ref = 0;
7779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7781         return ret_ref;
7782 }
7783
7784 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7785 CHECK(!owner->result_ok);
7786         return DecodeError_clone(&*owner->contents.err);
7787 }
7788 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
7789         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
7790         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7791         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
7792         uint64_t ret_ref = tag_ptr(ret_copy, true);
7793         return ret_ref;
7794 }
7795
7796 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7797         LDKNodeAnnouncement ret = *owner->contents.result;
7798         ret.is_owned = false;
7799         return ret;
7800 }
7801 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
7802         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
7803         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
7804         uint64_t ret_ref = 0;
7805         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7806         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7807         return ret_ref;
7808 }
7809
7810 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7811 CHECK(!owner->result_ok);
7812         return DecodeError_clone(&*owner->contents.err);
7813 }
7814 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
7815         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
7816         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7817         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
7818         uint64_t ret_ref = tag_ptr(ret_copy, true);
7819         return ret_ref;
7820 }
7821
7822 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
7823         LDKQueryShortChannelIds ret = *owner->contents.result;
7824         ret.is_owned = false;
7825         return ret;
7826 }
7827 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint64_t owner) {
7828         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
7829         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
7830         uint64_t ret_ref = 0;
7831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7833         return ret_ref;
7834 }
7835
7836 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
7837 CHECK(!owner->result_ok);
7838         return DecodeError_clone(&*owner->contents.err);
7839 }
7840 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint64_t owner) {
7841         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
7842         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7843         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
7844         uint64_t ret_ref = tag_ptr(ret_copy, true);
7845         return ret_ref;
7846 }
7847
7848 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
7849         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
7850         ret.is_owned = false;
7851         return ret;
7852 }
7853 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint64_t owner) {
7854         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
7855         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
7856         uint64_t ret_ref = 0;
7857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7859         return ret_ref;
7860 }
7861
7862 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
7863 CHECK(!owner->result_ok);
7864         return DecodeError_clone(&*owner->contents.err);
7865 }
7866 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint64_t owner) {
7867         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
7868         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7869         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
7870         uint64_t ret_ref = tag_ptr(ret_copy, true);
7871         return ret_ref;
7872 }
7873
7874 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7875         LDKQueryChannelRange ret = *owner->contents.result;
7876         ret.is_owned = false;
7877         return ret;
7878 }
7879 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
7880         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
7881         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
7882         uint64_t ret_ref = 0;
7883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7885         return ret_ref;
7886 }
7887
7888 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7889 CHECK(!owner->result_ok);
7890         return DecodeError_clone(&*owner->contents.err);
7891 }
7892 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
7893         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
7894         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7895         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
7896         uint64_t ret_ref = tag_ptr(ret_copy, true);
7897         return ret_ref;
7898 }
7899
7900 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7901         LDKReplyChannelRange ret = *owner->contents.result;
7902         ret.is_owned = false;
7903         return ret;
7904 }
7905 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
7906         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
7907         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
7908         uint64_t ret_ref = 0;
7909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7911         return ret_ref;
7912 }
7913
7914 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7915 CHECK(!owner->result_ok);
7916         return DecodeError_clone(&*owner->contents.err);
7917 }
7918 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
7919         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
7920         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7921         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
7922         uint64_t ret_ref = tag_ptr(ret_copy, true);
7923         return ret_ref;
7924 }
7925
7926 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
7927         LDKGossipTimestampFilter ret = *owner->contents.result;
7928         ret.is_owned = false;
7929         return ret;
7930 }
7931 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint64_t owner) {
7932         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
7933         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
7934         uint64_t ret_ref = 0;
7935         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7936         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7937         return ret_ref;
7938 }
7939
7940 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
7941 CHECK(!owner->result_ok);
7942         return DecodeError_clone(&*owner->contents.err);
7943 }
7944 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err(uint64_t owner) {
7945         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
7946         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7947         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
7948         uint64_t ret_ref = tag_ptr(ret_copy, true);
7949         return ret_ref;
7950 }
7951
7952 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_ty_from_ptr"))) TS_LDKSignOrCreationError_ty_from_ptr(uint64_t ptr) {
7953         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
7954         switch(obj->tag) {
7955                 case LDKSignOrCreationError_SignError: return 0;
7956                 case LDKSignOrCreationError_CreationError: return 1;
7957                 default: abort();
7958         }
7959 }
7960 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_CreationError_get_creation_error"))) TS_LDKSignOrCreationError_CreationError_get_creation_error(uint64_t ptr) {
7961         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
7962         assert(obj->tag == LDKSignOrCreationError_CreationError);
7963                         uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
7964         return creation_error_conv;
7965 }
7966 static inline struct LDKInvoice CResult_InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
7967         LDKInvoice ret = *owner->contents.result;
7968         ret.is_owned = false;
7969         return ret;
7970 }
7971 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_ok(uint64_t owner) {
7972         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
7973         LDKInvoice ret_var = CResult_InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
7974         uint64_t ret_ref = 0;
7975         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7976         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7977         return ret_ref;
7978 }
7979
7980 static inline struct LDKSignOrCreationError CResult_InvoiceSignOrCreationErrorZ_get_err(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
7981 CHECK(!owner->result_ok);
7982         return SignOrCreationError_clone(&*owner->contents.err);
7983 }
7984 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_err(uint64_t owner) {
7985         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
7986         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
7987         *ret_copy = CResult_InvoiceSignOrCreationErrorZ_get_err(owner_conv);
7988         uint64_t ret_ref = tag_ptr(ret_copy, true);
7989         return ret_ref;
7990 }
7991
7992 typedef struct LDKFilter_JCalls {
7993         atomic_size_t refcnt;
7994         uint32_t instance_ptr;
7995 } LDKFilter_JCalls;
7996 static void LDKFilter_JCalls_free(void* this_arg) {
7997         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7998         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7999                 FREE(j_calls);
8000         }
8001 }
8002 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
8003         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
8004         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
8005         memcpy(txid_arr->elems, *txid, 32);
8006         LDKu8slice script_pubkey_var = script_pubkey;
8007         int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__);
8008         memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
8009         js_invoke_function_uuuuuu(j_calls->instance_ptr, 38, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr, 0, 0, 0, 0);
8010 }
8011 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
8012         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
8013         LDKWatchedOutput output_var = output;
8014         uint64_t output_ref = 0;
8015         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
8016         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
8017         js_invoke_function_buuuuu(j_calls->instance_ptr, 39, output_ref, 0, 0, 0, 0, 0);
8018 }
8019 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
8020         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
8021         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8022 }
8023 static inline LDKFilter LDKFilter_init (JSValue o) {
8024         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
8025         atomic_init(&calls->refcnt, 1);
8026         calls->instance_ptr = o;
8027
8028         LDKFilter ret = {
8029                 .this_arg = (void*) calls,
8030                 .register_tx = register_tx_LDKFilter_jcall,
8031                 .register_output = register_output_LDKFilter_jcall,
8032                 .free = LDKFilter_JCalls_free,
8033         };
8034         return ret;
8035 }
8036 uint64_t  __attribute__((export_name("TS_LDKFilter_new"))) TS_LDKFilter_new(JSValue o) {
8037         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
8038         *res_ptr = LDKFilter_init(o);
8039         return tag_ptr(res_ptr, true);
8040 }
8041 void  __attribute__((export_name("TS_Filter_register_tx"))) TS_Filter_register_tx(uint64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
8042         void* this_arg_ptr = untag_ptr(this_arg);
8043         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8044         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
8045         unsigned char txid_arr[32];
8046         CHECK(txid->arr_len == 32);
8047         memcpy(txid_arr, txid->elems, 32); FREE(txid);
8048         unsigned char (*txid_ref)[32] = &txid_arr;
8049         LDKu8slice script_pubkey_ref;
8050         script_pubkey_ref.datalen = script_pubkey->arr_len;
8051         script_pubkey_ref.data = script_pubkey->elems;
8052         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
8053         FREE(script_pubkey);
8054 }
8055
8056 void  __attribute__((export_name("TS_Filter_register_output"))) TS_Filter_register_output(uint64_t this_arg, uint64_t output) {
8057         void* this_arg_ptr = untag_ptr(this_arg);
8058         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8059         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
8060         LDKWatchedOutput output_conv;
8061         output_conv.inner = untag_ptr(output);
8062         output_conv.is_owned = ptr_is_owned(output);
8063         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
8064         output_conv = WatchedOutput_clone(&output_conv);
8065         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
8066 }
8067
8068 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_ty_from_ptr"))) TS_LDKCOption_FilterZ_ty_from_ptr(uint64_t ptr) {
8069         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
8070         switch(obj->tag) {
8071                 case LDKCOption_FilterZ_Some: return 0;
8072                 case LDKCOption_FilterZ_None: return 1;
8073                 default: abort();
8074         }
8075 }
8076 uint64_t __attribute__((export_name("TS_LDKCOption_FilterZ_Some_get_some"))) TS_LDKCOption_FilterZ_Some_get_some(uint64_t ptr) {
8077         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
8078         assert(obj->tag == LDKCOption_FilterZ_Some);
8079                         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
8080                         *some_ret = obj->some;
8081                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
8082                         if ((*some_ret).free == LDKFilter_JCalls_free) {
8083                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8084                                 LDKFilter_JCalls_cloned(&(*some_ret));
8085                         }
8086         return tag_ptr(some_ret, true);
8087 }
8088 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
8089         LDKLockedChannelMonitor ret = *owner->contents.result;
8090         ret.is_owned = false;
8091         return ret;
8092 }
8093 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_ok"))) TS_CResult_LockedChannelMonitorNoneZ_get_ok(uint64_t owner) {
8094         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
8095         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
8096         uint64_t ret_ref = 0;
8097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8099         return ret_ref;
8100 }
8101
8102 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
8103 CHECK(!owner->result_ok);
8104         return *owner->contents.err;
8105 }
8106 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_err"))) TS_CResult_LockedChannelMonitorNoneZ_get_err(uint64_t owner) {
8107         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
8108         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
8109 }
8110
8111 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
8112         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
8113         for (size_t i = 0; i < ret.datalen; i++) {
8114                 ret.data[i] = OutPoint_clone(&orig->data[i]);
8115         }
8116         return ret;
8117 }
8118 static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) {
8119         LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen };
8120         for (size_t i = 0; i < ret.datalen; i++) {
8121                 ret.data[i] = MonitorUpdateId_clone(&orig->data[i]);
8122         }
8123         return ret;
8124 }
8125 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
8126         LDKOutPoint ret = owner->a;
8127         ret.is_owned = false;
8128         return ret;
8129 }
8130 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(uint64_t owner) {
8131         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
8132         LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv);
8133         uint64_t ret_ref = 0;
8134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8136         return ret_ref;
8137 }
8138
8139 static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
8140         return CVec_MonitorUpdateIdZ_clone(&owner->b);
8141 }
8142 uint64_tArray  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(uint64_t owner) {
8143         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
8144         LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv);
8145         uint64_tArray ret_arr = NULL;
8146         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
8147         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
8148         for (size_t r = 0; r < ret_var.datalen; r++) {
8149                 LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r];
8150                 uint64_t ret_conv_17_ref = 0;
8151                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var);
8152                 ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned);
8153                 ret_arr_ptr[r] = ret_conv_17_ref;
8154         }
8155         
8156         FREE(ret_var.data);
8157         return ret_arr;
8158 }
8159
8160 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) {
8161         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen };
8162         for (size_t i = 0; i < ret.datalen; i++) {
8163                 ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]);
8164         }
8165         return ret;
8166 }
8167 typedef struct LDKMessageSendEventsProvider_JCalls {
8168         atomic_size_t refcnt;
8169         uint32_t instance_ptr;
8170 } LDKMessageSendEventsProvider_JCalls;
8171 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
8172         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
8173         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8174                 FREE(j_calls);
8175         }
8176 }
8177 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
8178         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
8179         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 40, 0, 0, 0, 0, 0, 0);
8180         LDKCVec_MessageSendEventZ ret_constr;
8181         ret_constr.datalen = ret->arr_len;
8182         if (ret_constr.datalen > 0)
8183                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
8184         else
8185                 ret_constr.data = NULL;
8186         uint64_t* ret_vals = ret->elems;
8187         for (size_t s = 0; s < ret_constr.datalen; s++) {
8188                 uint64_t ret_conv_18 = ret_vals[s];
8189                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
8190                 CHECK_ACCESS(ret_conv_18_ptr);
8191                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
8192                 FREE(untag_ptr(ret_conv_18));
8193                 ret_constr.data[s] = ret_conv_18_conv;
8194         }
8195         FREE(ret);
8196         return ret_constr;
8197 }
8198 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
8199         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
8200         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8201 }
8202 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JSValue o) {
8203         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
8204         atomic_init(&calls->refcnt, 1);
8205         calls->instance_ptr = o;
8206
8207         LDKMessageSendEventsProvider ret = {
8208                 .this_arg = (void*) calls,
8209                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
8210                 .free = LDKMessageSendEventsProvider_JCalls_free,
8211         };
8212         return ret;
8213 }
8214 uint64_t  __attribute__((export_name("TS_LDKMessageSendEventsProvider_new"))) TS_LDKMessageSendEventsProvider_new(JSValue o) {
8215         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
8216         *res_ptr = LDKMessageSendEventsProvider_init(o);
8217         return tag_ptr(res_ptr, true);
8218 }
8219 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) {
8220         void* this_arg_ptr = untag_ptr(this_arg);
8221         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8222         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
8223         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
8224         uint64_tArray ret_arr = NULL;
8225         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
8226         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
8227         for (size_t s = 0; s < ret_var.datalen; s++) {
8228                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
8229                 *ret_conv_18_copy = ret_var.data[s];
8230                 uint64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
8231                 ret_arr_ptr[s] = ret_conv_18_ref;
8232         }
8233         
8234         FREE(ret_var.data);
8235         return ret_arr;
8236 }
8237
8238 typedef struct LDKOnionMessageProvider_JCalls {
8239         atomic_size_t refcnt;
8240         uint32_t instance_ptr;
8241 } LDKOnionMessageProvider_JCalls;
8242 static void LDKOnionMessageProvider_JCalls_free(void* this_arg) {
8243         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
8244         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8245                 FREE(j_calls);
8246         }
8247 }
8248 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageProvider_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
8249         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
8250         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
8251         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
8252         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 41, (uint32_t)peer_node_id_arr, 0, 0, 0, 0, 0);
8253         LDKOnionMessage ret_conv;
8254         ret_conv.inner = untag_ptr(ret);
8255         ret_conv.is_owned = ptr_is_owned(ret);
8256         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
8257         return ret_conv;
8258 }
8259 static void LDKOnionMessageProvider_JCalls_cloned(LDKOnionMessageProvider* new_obj) {
8260         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) new_obj->this_arg;
8261         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8262 }
8263 static inline LDKOnionMessageProvider LDKOnionMessageProvider_init (JSValue o) {
8264         LDKOnionMessageProvider_JCalls *calls = MALLOC(sizeof(LDKOnionMessageProvider_JCalls), "LDKOnionMessageProvider_JCalls");
8265         atomic_init(&calls->refcnt, 1);
8266         calls->instance_ptr = o;
8267
8268         LDKOnionMessageProvider ret = {
8269                 .this_arg = (void*) calls,
8270                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageProvider_jcall,
8271                 .free = LDKOnionMessageProvider_JCalls_free,
8272         };
8273         return ret;
8274 }
8275 uint64_t  __attribute__((export_name("TS_LDKOnionMessageProvider_new"))) TS_LDKOnionMessageProvider_new(JSValue o) {
8276         LDKOnionMessageProvider *res_ptr = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
8277         *res_ptr = LDKOnionMessageProvider_init(o);
8278         return tag_ptr(res_ptr, true);
8279 }
8280 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) {
8281         void* this_arg_ptr = untag_ptr(this_arg);
8282         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8283         LDKOnionMessageProvider* this_arg_conv = (LDKOnionMessageProvider*)this_arg_ptr;
8284         LDKPublicKey peer_node_id_ref;
8285         CHECK(peer_node_id->arr_len == 33);
8286         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
8287         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
8288         uint64_t ret_ref = 0;
8289         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8290         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8291         return ret_ref;
8292 }
8293
8294 typedef struct LDKEventHandler_JCalls {
8295         atomic_size_t refcnt;
8296         uint32_t instance_ptr;
8297 } LDKEventHandler_JCalls;
8298 static void LDKEventHandler_JCalls_free(void* this_arg) {
8299         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
8300         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8301                 FREE(j_calls);
8302         }
8303 }
8304 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
8305         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
8306         LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
8307         *event_copy = event;
8308         uint64_t event_ref = tag_ptr(event_copy, true);
8309         js_invoke_function_buuuuu(j_calls->instance_ptr, 42, event_ref, 0, 0, 0, 0, 0);
8310 }
8311 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
8312         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
8313         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8314 }
8315 static inline LDKEventHandler LDKEventHandler_init (JSValue o) {
8316         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
8317         atomic_init(&calls->refcnt, 1);
8318         calls->instance_ptr = o;
8319
8320         LDKEventHandler ret = {
8321                 .this_arg = (void*) calls,
8322                 .handle_event = handle_event_LDKEventHandler_jcall,
8323                 .free = LDKEventHandler_JCalls_free,
8324         };
8325         return ret;
8326 }
8327 uint64_t  __attribute__((export_name("TS_LDKEventHandler_new"))) TS_LDKEventHandler_new(JSValue o) {
8328         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
8329         *res_ptr = LDKEventHandler_init(o);
8330         return tag_ptr(res_ptr, true);
8331 }
8332 void  __attribute__((export_name("TS_EventHandler_handle_event"))) TS_EventHandler_handle_event(uint64_t this_arg, uint64_t event) {
8333         void* this_arg_ptr = untag_ptr(this_arg);
8334         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8335         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
8336         void* event_ptr = untag_ptr(event);
8337         CHECK_ACCESS(event_ptr);
8338         LDKEvent event_conv = *(LDKEvent*)(event_ptr);
8339         event_conv = Event_clone((LDKEvent*)untag_ptr(event));
8340         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
8341 }
8342
8343 typedef struct LDKEventsProvider_JCalls {
8344         atomic_size_t refcnt;
8345         uint32_t instance_ptr;
8346 } LDKEventsProvider_JCalls;
8347 static void LDKEventsProvider_JCalls_free(void* this_arg) {
8348         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
8349         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8350                 FREE(j_calls);
8351         }
8352 }
8353 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
8354         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
8355         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
8356         *handler_ret = handler;
8357         js_invoke_function_buuuuu(j_calls->instance_ptr, 43, tag_ptr(handler_ret, true), 0, 0, 0, 0, 0);
8358 }
8359 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
8360         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
8361         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8362 }
8363 static inline LDKEventsProvider LDKEventsProvider_init (JSValue o) {
8364         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
8365         atomic_init(&calls->refcnt, 1);
8366         calls->instance_ptr = o;
8367
8368         LDKEventsProvider ret = {
8369                 .this_arg = (void*) calls,
8370                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
8371                 .free = LDKEventsProvider_JCalls_free,
8372         };
8373         return ret;
8374 }
8375 uint64_t  __attribute__((export_name("TS_LDKEventsProvider_new"))) TS_LDKEventsProvider_new(JSValue o) {
8376         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
8377         *res_ptr = LDKEventsProvider_init(o);
8378         return tag_ptr(res_ptr, true);
8379 }
8380 void  __attribute__((export_name("TS_EventsProvider_process_pending_events"))) TS_EventsProvider_process_pending_events(uint64_t this_arg, uint64_t handler) {
8381         void* this_arg_ptr = untag_ptr(this_arg);
8382         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8383         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
8384         void* handler_ptr = untag_ptr(handler);
8385         CHECK_ACCESS(handler_ptr);
8386         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
8387         if (handler_conv.free == LDKEventHandler_JCalls_free) {
8388                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8389                 LDKEventHandler_JCalls_cloned(&handler_conv);
8390         }
8391         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
8392 }
8393
8394 typedef struct LDKScore_JCalls {
8395         atomic_size_t refcnt;
8396         uint32_t instance_ptr;
8397 } LDKScore_JCalls;
8398 static void LDKScore_JCalls_free(void* this_arg) {
8399         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8400         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8401                 FREE(j_calls);
8402         }
8403 }
8404 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target, LDKChannelUsage usage) {
8405         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8406         int64_t short_channel_id_conv = short_channel_id;
8407         LDKNodeId source_var = *source;
8408         uint64_t source_ref = 0;
8409         source_var = NodeId_clone(&source_var);
8410         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
8411         source_ref = tag_ptr(source_var.inner, source_var.is_owned);
8412         LDKNodeId target_var = *target;
8413         uint64_t target_ref = 0;
8414         target_var = NodeId_clone(&target_var);
8415         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
8416         target_ref = tag_ptr(target_var.inner, target_var.is_owned);
8417         LDKChannelUsage usage_var = usage;
8418         uint64_t usage_ref = 0;
8419         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
8420         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
8421         return js_invoke_function_bbbbuu(j_calls->instance_ptr, 44, short_channel_id_conv, source_ref, target_ref, usage_ref, 0, 0);
8422 }
8423 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
8424         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8425         LDKCVec_RouteHopZ path_var = path;
8426         uint64_tArray path_arr = NULL;
8427         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
8428         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
8429         for (size_t k = 0; k < path_var.datalen; k++) {
8430                 LDKRouteHop path_conv_10_var = path_var.data[k];
8431                 uint64_t path_conv_10_ref = 0;
8432                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8433                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
8434                 path_arr_ptr[k] = path_conv_10_ref;
8435         }
8436         
8437         FREE(path_var.data);
8438         int64_t short_channel_id_conv = short_channel_id;
8439         js_invoke_function_ubuuuu(j_calls->instance_ptr, 45, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0);
8440 }
8441 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
8442         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8443         LDKCVec_RouteHopZ path_var = path;
8444         uint64_tArray path_arr = NULL;
8445         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
8446         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
8447         for (size_t k = 0; k < path_var.datalen; k++) {
8448                 LDKRouteHop path_conv_10_var = path_var.data[k];
8449                 uint64_t path_conv_10_ref = 0;
8450                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8451                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
8452                 path_arr_ptr[k] = path_conv_10_ref;
8453         }
8454         
8455         FREE(path_var.data);
8456         js_invoke_function_uuuuuu(j_calls->instance_ptr, 46, (uint32_t)path_arr, 0, 0, 0, 0, 0);
8457 }
8458 void probe_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
8459         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8460         LDKCVec_RouteHopZ path_var = path;
8461         uint64_tArray path_arr = NULL;
8462         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
8463         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
8464         for (size_t k = 0; k < path_var.datalen; k++) {
8465                 LDKRouteHop path_conv_10_var = path_var.data[k];
8466                 uint64_t path_conv_10_ref = 0;
8467                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8468                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
8469                 path_arr_ptr[k] = path_conv_10_ref;
8470         }
8471         
8472         FREE(path_var.data);
8473         int64_t short_channel_id_conv = short_channel_id;
8474         js_invoke_function_ubuuuu(j_calls->instance_ptr, 47, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0);
8475 }
8476 void probe_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
8477         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8478         LDKCVec_RouteHopZ path_var = path;
8479         uint64_tArray path_arr = NULL;
8480         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
8481         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
8482         for (size_t k = 0; k < path_var.datalen; k++) {
8483                 LDKRouteHop path_conv_10_var = path_var.data[k];
8484                 uint64_t path_conv_10_ref = 0;
8485                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8486                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
8487                 path_arr_ptr[k] = path_conv_10_ref;
8488         }
8489         
8490         FREE(path_var.data);
8491         js_invoke_function_uuuuuu(j_calls->instance_ptr, 48, (uint32_t)path_arr, 0, 0, 0, 0, 0);
8492 }
8493 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
8494         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8495         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 49, 0, 0, 0, 0, 0, 0);
8496         LDKCVec_u8Z ret_ref;
8497         ret_ref.datalen = ret->arr_len;
8498         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8499         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
8500         return ret_ref;
8501 }
8502 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
8503         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
8504         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8505 }
8506 static inline LDKScore LDKScore_init (JSValue o) {
8507         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
8508         atomic_init(&calls->refcnt, 1);
8509         calls->instance_ptr = o;
8510
8511         LDKScore ret = {
8512                 .this_arg = (void*) calls,
8513                 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
8514                 .payment_path_failed = payment_path_failed_LDKScore_jcall,
8515                 .payment_path_successful = payment_path_successful_LDKScore_jcall,
8516                 .probe_failed = probe_failed_LDKScore_jcall,
8517                 .probe_successful = probe_successful_LDKScore_jcall,
8518                 .write = write_LDKScore_jcall,
8519                 .free = LDKScore_JCalls_free,
8520         };
8521         return ret;
8522 }
8523 uint64_t  __attribute__((export_name("TS_LDKScore_new"))) TS_LDKScore_new(JSValue o) {
8524         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
8525         *res_ptr = LDKScore_init(o);
8526         return tag_ptr(res_ptr, true);
8527 }
8528 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) {
8529         void* this_arg_ptr = untag_ptr(this_arg);
8530         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8531         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8532         LDKNodeId source_conv;
8533         source_conv.inner = untag_ptr(source);
8534         source_conv.is_owned = ptr_is_owned(source);
8535         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
8536         source_conv.is_owned = false;
8537         LDKNodeId target_conv;
8538         target_conv.inner = untag_ptr(target);
8539         target_conv.is_owned = ptr_is_owned(target);
8540         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
8541         target_conv.is_owned = false;
8542         LDKChannelUsage usage_conv;
8543         usage_conv.inner = untag_ptr(usage);
8544         usage_conv.is_owned = ptr_is_owned(usage);
8545         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
8546         usage_conv = ChannelUsage_clone(&usage_conv);
8547         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv, usage_conv);
8548         return ret_conv;
8549 }
8550
8551 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) {
8552         void* this_arg_ptr = untag_ptr(this_arg);
8553         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8554         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8555         LDKCVec_RouteHopZ path_constr;
8556         path_constr.datalen = path->arr_len;
8557         if (path_constr.datalen > 0)
8558                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8559         else
8560                 path_constr.data = NULL;
8561         uint64_t* path_vals = path->elems;
8562         for (size_t k = 0; k < path_constr.datalen; k++) {
8563                 uint64_t path_conv_10 = path_vals[k];
8564                 LDKRouteHop path_conv_10_conv;
8565                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
8566                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
8567                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8568                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8569                 path_constr.data[k] = path_conv_10_conv;
8570         }
8571         FREE(path);
8572         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
8573 }
8574
8575 void  __attribute__((export_name("TS_Score_payment_path_successful"))) TS_Score_payment_path_successful(uint64_t this_arg, uint64_tArray path) {
8576         void* this_arg_ptr = untag_ptr(this_arg);
8577         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8578         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8579         LDKCVec_RouteHopZ path_constr;
8580         path_constr.datalen = path->arr_len;
8581         if (path_constr.datalen > 0)
8582                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8583         else
8584                 path_constr.data = NULL;
8585         uint64_t* path_vals = path->elems;
8586         for (size_t k = 0; k < path_constr.datalen; k++) {
8587                 uint64_t path_conv_10 = path_vals[k];
8588                 LDKRouteHop path_conv_10_conv;
8589                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
8590                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
8591                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8592                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8593                 path_constr.data[k] = path_conv_10_conv;
8594         }
8595         FREE(path);
8596         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
8597 }
8598
8599 void  __attribute__((export_name("TS_Score_probe_failed"))) TS_Score_probe_failed(uint64_t this_arg, uint64_tArray path, int64_t short_channel_id) {
8600         void* this_arg_ptr = untag_ptr(this_arg);
8601         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8602         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8603         LDKCVec_RouteHopZ path_constr;
8604         path_constr.datalen = path->arr_len;
8605         if (path_constr.datalen > 0)
8606                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8607         else
8608                 path_constr.data = NULL;
8609         uint64_t* path_vals = path->elems;
8610         for (size_t k = 0; k < path_constr.datalen; k++) {
8611                 uint64_t path_conv_10 = path_vals[k];
8612                 LDKRouteHop path_conv_10_conv;
8613                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
8614                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
8615                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8616                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8617                 path_constr.data[k] = path_conv_10_conv;
8618         }
8619         FREE(path);
8620         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
8621 }
8622
8623 void  __attribute__((export_name("TS_Score_probe_successful"))) TS_Score_probe_successful(uint64_t this_arg, uint64_tArray path) {
8624         void* this_arg_ptr = untag_ptr(this_arg);
8625         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8626         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8627         LDKCVec_RouteHopZ path_constr;
8628         path_constr.datalen = path->arr_len;
8629         if (path_constr.datalen > 0)
8630                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8631         else
8632                 path_constr.data = NULL;
8633         uint64_t* path_vals = path->elems;
8634         for (size_t k = 0; k < path_constr.datalen; k++) {
8635                 uint64_t path_conv_10 = path_vals[k];
8636                 LDKRouteHop path_conv_10_conv;
8637                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
8638                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
8639                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8640                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8641                 path_constr.data[k] = path_conv_10_conv;
8642         }
8643         FREE(path);
8644         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, path_constr);
8645 }
8646
8647 int8_tArray  __attribute__((export_name("TS_Score_write"))) TS_Score_write(uint64_t this_arg) {
8648         void* this_arg_ptr = untag_ptr(this_arg);
8649         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8650         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8651         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8652         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8653         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8654         CVec_u8Z_free(ret_var);
8655         return ret_arr;
8656 }
8657
8658 typedef struct LDKLockableScore_JCalls {
8659         atomic_size_t refcnt;
8660         uint32_t instance_ptr;
8661 } LDKLockableScore_JCalls;
8662 static void LDKLockableScore_JCalls_free(void* this_arg) {
8663         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
8664         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8665                 FREE(j_calls);
8666         }
8667 }
8668 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
8669         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
8670         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 50, 0, 0, 0, 0, 0, 0);
8671         void* ret_ptr = untag_ptr(ret);
8672         CHECK_ACCESS(ret_ptr);
8673         LDKScore ret_conv = *(LDKScore*)(ret_ptr);
8674         if (ret_conv.free == LDKScore_JCalls_free) {
8675                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8676                 LDKScore_JCalls_cloned(&ret_conv);
8677         }// WARNING: we may need a move here but no clone is available for LDKScore
8678         
8679         return ret_conv;
8680 }
8681 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
8682         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
8683         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8684 }
8685 static inline LDKLockableScore LDKLockableScore_init (JSValue o) {
8686         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
8687         atomic_init(&calls->refcnt, 1);
8688         calls->instance_ptr = o;
8689
8690         LDKLockableScore ret = {
8691                 .this_arg = (void*) calls,
8692                 .lock = lock_LDKLockableScore_jcall,
8693                 .free = LDKLockableScore_JCalls_free,
8694         };
8695         return ret;
8696 }
8697 uint64_t  __attribute__((export_name("TS_LDKLockableScore_new"))) TS_LDKLockableScore_new(JSValue o) {
8698         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
8699         *res_ptr = LDKLockableScore_init(o);
8700         return tag_ptr(res_ptr, true);
8701 }
8702 uint64_t  __attribute__((export_name("TS_LockableScore_lock"))) TS_LockableScore_lock(uint64_t this_arg) {
8703         void* this_arg_ptr = untag_ptr(this_arg);
8704         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8705         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
8706         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
8707         *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
8708         return tag_ptr(ret_ret, true);
8709 }
8710
8711 typedef struct LDKWriteableScore_JCalls {
8712         atomic_size_t refcnt;
8713         uint32_t instance_ptr;
8714         LDKLockableScore_JCalls* LockableScore;
8715 } LDKWriteableScore_JCalls;
8716 static void LDKWriteableScore_JCalls_free(void* this_arg) {
8717         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
8718         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8719                 FREE(j_calls);
8720         }
8721 }
8722 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
8723         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
8724         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 51, 0, 0, 0, 0, 0, 0);
8725         LDKCVec_u8Z ret_ref;
8726         ret_ref.datalen = ret->arr_len;
8727         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8728         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
8729         return ret_ref;
8730 }
8731 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
8732         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
8733         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8734         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
8735 }
8736 static inline LDKWriteableScore LDKWriteableScore_init (JSValue o, JSValue LockableScore) {
8737         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
8738         atomic_init(&calls->refcnt, 1);
8739         calls->instance_ptr = o;
8740
8741         LDKWriteableScore ret = {
8742                 .this_arg = (void*) calls,
8743                 .write = write_LDKWriteableScore_jcall,
8744                 .free = LDKWriteableScore_JCalls_free,
8745                 .LockableScore = LDKLockableScore_init(LockableScore),
8746         };
8747         calls->LockableScore = ret.LockableScore.this_arg;
8748         return ret;
8749 }
8750 uint64_t  __attribute__((export_name("TS_LDKWriteableScore_new"))) TS_LDKWriteableScore_new(JSValue o, JSValue LockableScore) {
8751         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
8752         *res_ptr = LDKWriteableScore_init(o, LockableScore);
8753         return tag_ptr(res_ptr, true);
8754 }
8755 int8_tArray  __attribute__((export_name("TS_WriteableScore_write"))) TS_WriteableScore_write(uint64_t this_arg) {
8756         void* this_arg_ptr = untag_ptr(this_arg);
8757         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8758         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
8759         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8760         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8761         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8762         CVec_u8Z_free(ret_var);
8763         return ret_arr;
8764 }
8765
8766 typedef struct LDKPersister_JCalls {
8767         atomic_size_t refcnt;
8768         uint32_t instance_ptr;
8769 } LDKPersister_JCalls;
8770 static void LDKPersister_JCalls_free(void* this_arg) {
8771         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8772         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8773                 FREE(j_calls);
8774         }
8775 }
8776 LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
8777         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8778         LDKChannelManager channel_manager_var = *channel_manager;
8779         uint64_t channel_manager_ref = 0;
8780         // WARNING: we may need a move here but no clone is available for LDKChannelManager
8781         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
8782         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
8783         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 52, channel_manager_ref, 0, 0, 0, 0, 0);
8784         void* ret_ptr = untag_ptr(ret);
8785         CHECK_ACCESS(ret_ptr);
8786         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8787         FREE(untag_ptr(ret));
8788         return ret_conv;
8789 }
8790 LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
8791         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8792         LDKNetworkGraph network_graph_var = *network_graph;
8793         uint64_t network_graph_ref = 0;
8794         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
8795         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
8796         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
8797         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 53, network_graph_ref, 0, 0, 0, 0, 0);
8798         void* ret_ptr = untag_ptr(ret);
8799         CHECK_ACCESS(ret_ptr);
8800         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8801         FREE(untag_ptr(ret));
8802         return ret_conv;
8803 }
8804 LDKCResult_NoneErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
8805         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8806         // WARNING: This object doesn't live past this scope, needs clone!
8807         uint64_t ret_scorer = tag_ptr(scorer, false);
8808         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 54, ret_scorer, 0, 0, 0, 0, 0);
8809         void* ret_ptr = untag_ptr(ret);
8810         CHECK_ACCESS(ret_ptr);
8811         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8812         FREE(untag_ptr(ret));
8813         return ret_conv;
8814 }
8815 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
8816         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
8817         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8818 }
8819 static inline LDKPersister LDKPersister_init (JSValue o) {
8820         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
8821         atomic_init(&calls->refcnt, 1);
8822         calls->instance_ptr = o;
8823
8824         LDKPersister ret = {
8825                 .this_arg = (void*) calls,
8826                 .persist_manager = persist_manager_LDKPersister_jcall,
8827                 .persist_graph = persist_graph_LDKPersister_jcall,
8828                 .persist_scorer = persist_scorer_LDKPersister_jcall,
8829                 .free = LDKPersister_JCalls_free,
8830         };
8831         return ret;
8832 }
8833 uint64_t  __attribute__((export_name("TS_LDKPersister_new"))) TS_LDKPersister_new(JSValue o) {
8834         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
8835         *res_ptr = LDKPersister_init(o);
8836         return tag_ptr(res_ptr, true);
8837 }
8838 uint64_t  __attribute__((export_name("TS_Persister_persist_manager"))) TS_Persister_persist_manager(uint64_t this_arg, uint64_t channel_manager) {
8839         void* this_arg_ptr = untag_ptr(this_arg);
8840         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8841         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
8842         LDKChannelManager channel_manager_conv;
8843         channel_manager_conv.inner = untag_ptr(channel_manager);
8844         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
8845         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
8846         channel_manager_conv.is_owned = false;
8847         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8848         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
8849         return tag_ptr(ret_conv, true);
8850 }
8851
8852 uint64_t  __attribute__((export_name("TS_Persister_persist_graph"))) TS_Persister_persist_graph(uint64_t this_arg, uint64_t network_graph) {
8853         void* this_arg_ptr = untag_ptr(this_arg);
8854         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8855         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
8856         LDKNetworkGraph network_graph_conv;
8857         network_graph_conv.inner = untag_ptr(network_graph);
8858         network_graph_conv.is_owned = ptr_is_owned(network_graph);
8859         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
8860         network_graph_conv.is_owned = false;
8861         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8862         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
8863         return tag_ptr(ret_conv, true);
8864 }
8865
8866 uint64_t  __attribute__((export_name("TS_Persister_persist_scorer"))) TS_Persister_persist_scorer(uint64_t this_arg, uint64_t scorer) {
8867         void* this_arg_ptr = untag_ptr(this_arg);
8868         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8869         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
8870         void* scorer_ptr = untag_ptr(scorer);
8871         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
8872         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
8873         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8874         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
8875         return tag_ptr(ret_conv, true);
8876 }
8877
8878 typedef struct LDKFutureCallback_JCalls {
8879         atomic_size_t refcnt;
8880         uint32_t instance_ptr;
8881 } LDKFutureCallback_JCalls;
8882 static void LDKFutureCallback_JCalls_free(void* this_arg) {
8883         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
8884         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8885                 FREE(j_calls);
8886         }
8887 }
8888 void call_LDKFutureCallback_jcall(const void* this_arg) {
8889         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
8890         js_invoke_function_uuuuuu(j_calls->instance_ptr, 55, 0, 0, 0, 0, 0, 0);
8891 }
8892 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
8893         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
8894         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8895 }
8896 static inline LDKFutureCallback LDKFutureCallback_init (JSValue o) {
8897         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
8898         atomic_init(&calls->refcnt, 1);
8899         calls->instance_ptr = o;
8900
8901         LDKFutureCallback ret = {
8902                 .this_arg = (void*) calls,
8903                 .call = call_LDKFutureCallback_jcall,
8904                 .free = LDKFutureCallback_JCalls_free,
8905         };
8906         return ret;
8907 }
8908 uint64_t  __attribute__((export_name("TS_LDKFutureCallback_new"))) TS_LDKFutureCallback_new(JSValue o) {
8909         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
8910         *res_ptr = LDKFutureCallback_init(o);
8911         return tag_ptr(res_ptr, true);
8912 }
8913 void  __attribute__((export_name("TS_FutureCallback_call"))) TS_FutureCallback_call(uint64_t this_arg) {
8914         void* this_arg_ptr = untag_ptr(this_arg);
8915         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8916         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
8917         (this_arg_conv->call)(this_arg_conv->this_arg);
8918 }
8919
8920 typedef struct LDKListen_JCalls {
8921         atomic_size_t refcnt;
8922         uint32_t instance_ptr;
8923 } LDKListen_JCalls;
8924 static void LDKListen_JCalls_free(void* this_arg) {
8925         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8926         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8927                 FREE(j_calls);
8928         }
8929 }
8930 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
8931         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8932         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8933         memcpy(header_arr->elems, *header, 80);
8934         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
8935         uint64_tArray txdata_arr = NULL;
8936         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
8937         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
8938         for (size_t c = 0; c < txdata_var.datalen; c++) {
8939                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
8940                 *txdata_conv_28_conv = txdata_var.data[c];
8941                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
8942         }
8943         
8944         FREE(txdata_var.data);
8945         int32_t height_conv = height;
8946         js_invoke_function_uuuuuu(j_calls->instance_ptr, 56, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
8947 }
8948 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
8949         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8950         LDKu8slice block_var = block;
8951         int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__);
8952         memcpy(block_arr->elems, block_var.data, block_var.datalen);
8953         int32_t height_conv = height;
8954         js_invoke_function_uuuuuu(j_calls->instance_ptr, 57, (uint32_t)block_arr, height_conv, 0, 0, 0, 0);
8955 }
8956 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
8957         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8958         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8959         memcpy(header_arr->elems, *header, 80);
8960         int32_t height_conv = height;
8961         js_invoke_function_uuuuuu(j_calls->instance_ptr, 58, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
8962 }
8963 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
8964         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
8965         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8966 }
8967 static inline LDKListen LDKListen_init (JSValue o) {
8968         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
8969         atomic_init(&calls->refcnt, 1);
8970         calls->instance_ptr = o;
8971
8972         LDKListen ret = {
8973                 .this_arg = (void*) calls,
8974                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
8975                 .block_connected = block_connected_LDKListen_jcall,
8976                 .block_disconnected = block_disconnected_LDKListen_jcall,
8977                 .free = LDKListen_JCalls_free,
8978         };
8979         return ret;
8980 }
8981 uint64_t  __attribute__((export_name("TS_LDKListen_new"))) TS_LDKListen_new(JSValue o) {
8982         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
8983         *res_ptr = LDKListen_init(o);
8984         return tag_ptr(res_ptr, true);
8985 }
8986 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) {
8987         void* this_arg_ptr = untag_ptr(this_arg);
8988         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8989         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8990         unsigned char header_arr[80];
8991         CHECK(header->arr_len == 80);
8992         memcpy(header_arr, header->elems, 80); FREE(header);
8993         unsigned char (*header_ref)[80] = &header_arr;
8994         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
8995         txdata_constr.datalen = txdata->arr_len;
8996         if (txdata_constr.datalen > 0)
8997                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8998         else
8999                 txdata_constr.data = NULL;
9000         uint64_t* txdata_vals = txdata->elems;
9001         for (size_t c = 0; c < txdata_constr.datalen; c++) {
9002                 uint64_t txdata_conv_28 = txdata_vals[c];
9003                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
9004                 CHECK_ACCESS(txdata_conv_28_ptr);
9005                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
9006                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
9007                 txdata_constr.data[c] = txdata_conv_28_conv;
9008         }
9009         FREE(txdata);
9010         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
9011 }
9012
9013 void  __attribute__((export_name("TS_Listen_block_connected"))) TS_Listen_block_connected(uint64_t this_arg, int8_tArray block, int32_t height) {
9014         void* this_arg_ptr = untag_ptr(this_arg);
9015         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9016         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
9017         LDKu8slice block_ref;
9018         block_ref.datalen = block->arr_len;
9019         block_ref.data = block->elems;
9020         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
9021         FREE(block);
9022 }
9023
9024 void  __attribute__((export_name("TS_Listen_block_disconnected"))) TS_Listen_block_disconnected(uint64_t this_arg, int8_tArray header, int32_t height) {
9025         void* this_arg_ptr = untag_ptr(this_arg);
9026         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9027         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
9028         unsigned char header_arr[80];
9029         CHECK(header->arr_len == 80);
9030         memcpy(header_arr, header->elems, 80); FREE(header);
9031         unsigned char (*header_ref)[80] = &header_arr;
9032         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
9033 }
9034
9035 typedef struct LDKConfirm_JCalls {
9036         atomic_size_t refcnt;
9037         uint32_t instance_ptr;
9038 } LDKConfirm_JCalls;
9039 static void LDKConfirm_JCalls_free(void* this_arg) {
9040         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9041         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9042                 FREE(j_calls);
9043         }
9044 }
9045 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
9046         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9047         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
9048         memcpy(header_arr->elems, *header, 80);
9049         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
9050         uint64_tArray txdata_arr = NULL;
9051         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
9052         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
9053         for (size_t c = 0; c < txdata_var.datalen; c++) {
9054                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9055                 *txdata_conv_28_conv = txdata_var.data[c];
9056                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
9057         }
9058         
9059         FREE(txdata_var.data);
9060         int32_t height_conv = height;
9061         js_invoke_function_uuuuuu(j_calls->instance_ptr, 59, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
9062 }
9063 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
9064         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9065         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
9066         memcpy(txid_arr->elems, *txid, 32);
9067         js_invoke_function_uuuuuu(j_calls->instance_ptr, 60, (uint32_t)txid_arr, 0, 0, 0, 0, 0);
9068 }
9069 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
9070         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9071         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
9072         memcpy(header_arr->elems, *header, 80);
9073         int32_t height_conv = height;
9074         js_invoke_function_uuuuuu(j_calls->instance_ptr, 61, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
9075 }
9076 LDKCVec_C2Tuple_TxidBlockHashZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
9077         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
9078         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 62, 0, 0, 0, 0, 0, 0);
9079         LDKCVec_C2Tuple_TxidBlockHashZZ ret_constr;
9080         ret_constr.datalen = ret->arr_len;
9081         if (ret_constr.datalen > 0)
9082                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKCVec_C2Tuple_TxidBlockHashZZ Elements");
9083         else
9084                 ret_constr.data = NULL;
9085         uint64_t* ret_vals = ret->elems;
9086         for (size_t z = 0; z < ret_constr.datalen; z++) {
9087                 uint64_t ret_conv_25 = ret_vals[z];
9088                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
9089                 CHECK_ACCESS(ret_conv_25_ptr);
9090                 LDKC2Tuple_TxidBlockHashZ ret_conv_25_conv = *(LDKC2Tuple_TxidBlockHashZ*)(ret_conv_25_ptr);
9091                 FREE(untag_ptr(ret_conv_25));
9092                 ret_constr.data[z] = ret_conv_25_conv;
9093         }
9094         FREE(ret);
9095         return ret_constr;
9096 }
9097 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
9098         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
9099         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9100 }
9101 static inline LDKConfirm LDKConfirm_init (JSValue o) {
9102         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
9103         atomic_init(&calls->refcnt, 1);
9104         calls->instance_ptr = o;
9105
9106         LDKConfirm ret = {
9107                 .this_arg = (void*) calls,
9108                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
9109                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
9110                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
9111                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
9112                 .free = LDKConfirm_JCalls_free,
9113         };
9114         return ret;
9115 }
9116 uint64_t  __attribute__((export_name("TS_LDKConfirm_new"))) TS_LDKConfirm_new(JSValue o) {
9117         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
9118         *res_ptr = LDKConfirm_init(o);
9119         return tag_ptr(res_ptr, true);
9120 }
9121 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) {
9122         void* this_arg_ptr = untag_ptr(this_arg);
9123         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9124         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
9125         unsigned char header_arr[80];
9126         CHECK(header->arr_len == 80);
9127         memcpy(header_arr, header->elems, 80); FREE(header);
9128         unsigned char (*header_ref)[80] = &header_arr;
9129         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
9130         txdata_constr.datalen = txdata->arr_len;
9131         if (txdata_constr.datalen > 0)
9132                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9133         else
9134                 txdata_constr.data = NULL;
9135         uint64_t* txdata_vals = txdata->elems;
9136         for (size_t c = 0; c < txdata_constr.datalen; c++) {
9137                 uint64_t txdata_conv_28 = txdata_vals[c];
9138                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
9139                 CHECK_ACCESS(txdata_conv_28_ptr);
9140                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
9141                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
9142                 txdata_constr.data[c] = txdata_conv_28_conv;
9143         }
9144         FREE(txdata);
9145         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
9146 }
9147
9148 void  __attribute__((export_name("TS_Confirm_transaction_unconfirmed"))) TS_Confirm_transaction_unconfirmed(uint64_t this_arg, int8_tArray txid) {
9149         void* this_arg_ptr = untag_ptr(this_arg);
9150         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9151         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
9152         unsigned char txid_arr[32];
9153         CHECK(txid->arr_len == 32);
9154         memcpy(txid_arr, txid->elems, 32); FREE(txid);
9155         unsigned char (*txid_ref)[32] = &txid_arr;
9156         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
9157 }
9158
9159 void  __attribute__((export_name("TS_Confirm_best_block_updated"))) TS_Confirm_best_block_updated(uint64_t this_arg, int8_tArray header, int32_t height) {
9160         void* this_arg_ptr = untag_ptr(this_arg);
9161         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9162         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
9163         unsigned char header_arr[80];
9164         CHECK(header->arr_len == 80);
9165         memcpy(header_arr, header->elems, 80); FREE(header);
9166         unsigned char (*header_ref)[80] = &header_arr;
9167         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
9168 }
9169
9170 uint64_tArray  __attribute__((export_name("TS_Confirm_get_relevant_txids"))) TS_Confirm_get_relevant_txids(uint64_t this_arg) {
9171         void* this_arg_ptr = untag_ptr(this_arg);
9172         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9173         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
9174         LDKCVec_C2Tuple_TxidBlockHashZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
9175         uint64_tArray ret_arr = NULL;
9176         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
9177         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
9178         for (size_t z = 0; z < ret_var.datalen; z++) {
9179                 LDKC2Tuple_TxidBlockHashZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
9180                 *ret_conv_25_conv = ret_var.data[z];
9181                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
9182         }
9183         
9184         FREE(ret_var.data);
9185         return ret_arr;
9186 }
9187
9188 typedef struct LDKPersist_JCalls {
9189         atomic_size_t refcnt;
9190         uint32_t instance_ptr;
9191 } LDKPersist_JCalls;
9192 static void LDKPersist_JCalls_free(void* this_arg) {
9193         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
9194         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9195                 FREE(j_calls);
9196         }
9197 }
9198 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
9199         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
9200         LDKOutPoint channel_id_var = channel_id;
9201         uint64_t channel_id_ref = 0;
9202         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
9203         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
9204         LDKChannelMonitor data_var = *data;
9205         uint64_t data_ref = 0;
9206         data_var = ChannelMonitor_clone(&data_var);
9207         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
9208         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
9209         LDKMonitorUpdateId update_id_var = update_id;
9210         uint64_t update_id_ref = 0;
9211         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
9212         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
9213         uint64_t ret = js_invoke_function_bbbuuu(j_calls->instance_ptr, 63, channel_id_ref, data_ref, update_id_ref, 0, 0, 0);
9214         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
9215         return ret_conv;
9216 }
9217 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
9218         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
9219         LDKOutPoint channel_id_var = channel_id;
9220         uint64_t channel_id_ref = 0;
9221         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
9222         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
9223         LDKChannelMonitorUpdate update_var = *update;
9224         uint64_t update_ref = 0;
9225         update_var = ChannelMonitorUpdate_clone(&update_var);
9226         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
9227         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
9228         LDKChannelMonitor data_var = *data;
9229         uint64_t data_ref = 0;
9230         data_var = ChannelMonitor_clone(&data_var);
9231         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
9232         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
9233         LDKMonitorUpdateId update_id_var = update_id;
9234         uint64_t update_id_ref = 0;
9235         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
9236         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
9237         uint64_t ret = js_invoke_function_bbbbuu(j_calls->instance_ptr, 64, channel_id_ref, update_ref, data_ref, update_id_ref, 0, 0);
9238         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
9239         return ret_conv;
9240 }
9241 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
9242         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
9243         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9244 }
9245 static inline LDKPersist LDKPersist_init (JSValue o) {
9246         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
9247         atomic_init(&calls->refcnt, 1);
9248         calls->instance_ptr = o;
9249
9250         LDKPersist ret = {
9251                 .this_arg = (void*) calls,
9252                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
9253                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
9254                 .free = LDKPersist_JCalls_free,
9255         };
9256         return ret;
9257 }
9258 uint64_t  __attribute__((export_name("TS_LDKPersist_new"))) TS_LDKPersist_new(JSValue o) {
9259         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
9260         *res_ptr = LDKPersist_init(o);
9261         return tag_ptr(res_ptr, true);
9262 }
9263 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) {
9264         void* this_arg_ptr = untag_ptr(this_arg);
9265         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9266         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
9267         LDKOutPoint channel_id_conv;
9268         channel_id_conv.inner = untag_ptr(channel_id);
9269         channel_id_conv.is_owned = ptr_is_owned(channel_id);
9270         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
9271         channel_id_conv = OutPoint_clone(&channel_id_conv);
9272         LDKChannelMonitor data_conv;
9273         data_conv.inner = untag_ptr(data);
9274         data_conv.is_owned = ptr_is_owned(data);
9275         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
9276         data_conv.is_owned = false;
9277         LDKMonitorUpdateId update_id_conv;
9278         update_id_conv.inner = untag_ptr(update_id);
9279         update_id_conv.is_owned = ptr_is_owned(update_id);
9280         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
9281         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
9282         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));
9283         return ret_conv;
9284 }
9285
9286 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) {
9287         void* this_arg_ptr = untag_ptr(this_arg);
9288         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9289         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
9290         LDKOutPoint channel_id_conv;
9291         channel_id_conv.inner = untag_ptr(channel_id);
9292         channel_id_conv.is_owned = ptr_is_owned(channel_id);
9293         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
9294         channel_id_conv = OutPoint_clone(&channel_id_conv);
9295         LDKChannelMonitorUpdate update_conv;
9296         update_conv.inner = untag_ptr(update);
9297         update_conv.is_owned = ptr_is_owned(update);
9298         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
9299         update_conv.is_owned = false;
9300         LDKChannelMonitor data_conv;
9301         data_conv.inner = untag_ptr(data);
9302         data_conv.is_owned = ptr_is_owned(data);
9303         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
9304         data_conv.is_owned = false;
9305         LDKMonitorUpdateId update_id_conv;
9306         update_id_conv.inner = untag_ptr(update_id);
9307         update_id_conv.is_owned = ptr_is_owned(update_id);
9308         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
9309         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
9310         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));
9311         return ret_conv;
9312 }
9313
9314 typedef struct LDKChannelMessageHandler_JCalls {
9315         atomic_size_t refcnt;
9316         uint32_t instance_ptr;
9317         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
9318 } LDKChannelMessageHandler_JCalls;
9319 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
9320         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9321         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9322                 FREE(j_calls);
9323         }
9324 }
9325 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
9326         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9327         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9328         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9329         LDKInitFeatures their_features_var = their_features;
9330         uint64_t their_features_ref = 0;
9331         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
9332         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
9333         LDKOpenChannel msg_var = *msg;
9334         uint64_t msg_ref = 0;
9335         msg_var = OpenChannel_clone(&msg_var);
9336         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9337         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9338         js_invoke_function_ubbuuu(j_calls->instance_ptr, 65, (uint32_t)their_node_id_arr, their_features_ref, msg_ref, 0, 0, 0);
9339 }
9340 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
9341         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9342         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9343         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9344         LDKInitFeatures their_features_var = their_features;
9345         uint64_t their_features_ref = 0;
9346         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
9347         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
9348         LDKAcceptChannel msg_var = *msg;
9349         uint64_t msg_ref = 0;
9350         msg_var = AcceptChannel_clone(&msg_var);
9351         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9352         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9353         js_invoke_function_ubbuuu(j_calls->instance_ptr, 66, (uint32_t)their_node_id_arr, their_features_ref, msg_ref, 0, 0, 0);
9354 }
9355 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
9356         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9357         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9358         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9359         LDKFundingCreated msg_var = *msg;
9360         uint64_t msg_ref = 0;
9361         msg_var = FundingCreated_clone(&msg_var);
9362         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9363         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9364         js_invoke_function_ubuuuu(j_calls->instance_ptr, 67, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9365 }
9366 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
9367         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9368         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9369         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9370         LDKFundingSigned msg_var = *msg;
9371         uint64_t msg_ref = 0;
9372         msg_var = FundingSigned_clone(&msg_var);
9373         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9374         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9375         js_invoke_function_ubuuuu(j_calls->instance_ptr, 68, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9376 }
9377 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
9378         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9379         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9380         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9381         LDKChannelReady msg_var = *msg;
9382         uint64_t msg_ref = 0;
9383         msg_var = ChannelReady_clone(&msg_var);
9384         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9385         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9386         js_invoke_function_ubuuuu(j_calls->instance_ptr, 69, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9387 }
9388 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
9389         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9390         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9391         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9392         LDKInitFeatures their_features_var = *their_features;
9393         uint64_t their_features_ref = 0;
9394         their_features_var = InitFeatures_clone(&their_features_var);
9395         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
9396         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
9397         LDKShutdown msg_var = *msg;
9398         uint64_t msg_ref = 0;
9399         msg_var = Shutdown_clone(&msg_var);
9400         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9401         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9402         js_invoke_function_ubbuuu(j_calls->instance_ptr, 70, (uint32_t)their_node_id_arr, their_features_ref, msg_ref, 0, 0, 0);
9403 }
9404 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
9405         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9406         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9407         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9408         LDKClosingSigned msg_var = *msg;
9409         uint64_t msg_ref = 0;
9410         msg_var = ClosingSigned_clone(&msg_var);
9411         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9412         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9413         js_invoke_function_ubuuuu(j_calls->instance_ptr, 71, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9414 }
9415 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
9416         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9417         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9418         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9419         LDKUpdateAddHTLC msg_var = *msg;
9420         uint64_t msg_ref = 0;
9421         msg_var = UpdateAddHTLC_clone(&msg_var);
9422         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9423         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9424         js_invoke_function_ubuuuu(j_calls->instance_ptr, 72, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9425 }
9426 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
9427         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9428         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9429         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9430         LDKUpdateFulfillHTLC msg_var = *msg;
9431         uint64_t msg_ref = 0;
9432         msg_var = UpdateFulfillHTLC_clone(&msg_var);
9433         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9434         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9435         js_invoke_function_ubuuuu(j_calls->instance_ptr, 73, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9436 }
9437 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
9438         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9439         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9440         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9441         LDKUpdateFailHTLC msg_var = *msg;
9442         uint64_t msg_ref = 0;
9443         msg_var = UpdateFailHTLC_clone(&msg_var);
9444         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9445         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9446         js_invoke_function_ubuuuu(j_calls->instance_ptr, 74, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9447 }
9448 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
9449         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9450         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9451         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9452         LDKUpdateFailMalformedHTLC msg_var = *msg;
9453         uint64_t msg_ref = 0;
9454         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
9455         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9456         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9457         js_invoke_function_ubuuuu(j_calls->instance_ptr, 75, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9458 }
9459 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
9460         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9461         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9462         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9463         LDKCommitmentSigned msg_var = *msg;
9464         uint64_t msg_ref = 0;
9465         msg_var = CommitmentSigned_clone(&msg_var);
9466         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9467         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9468         js_invoke_function_ubuuuu(j_calls->instance_ptr, 76, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9469 }
9470 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
9471         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9472         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9473         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9474         LDKRevokeAndACK msg_var = *msg;
9475         uint64_t msg_ref = 0;
9476         msg_var = RevokeAndACK_clone(&msg_var);
9477         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9478         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9479         js_invoke_function_ubuuuu(j_calls->instance_ptr, 77, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9480 }
9481 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
9482         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9483         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9484         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9485         LDKUpdateFee msg_var = *msg;
9486         uint64_t msg_ref = 0;
9487         msg_var = UpdateFee_clone(&msg_var);
9488         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9489         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9490         js_invoke_function_ubuuuu(j_calls->instance_ptr, 78, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9491 }
9492 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
9493         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9494         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9495         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9496         LDKAnnouncementSignatures msg_var = *msg;
9497         uint64_t msg_ref = 0;
9498         msg_var = AnnouncementSignatures_clone(&msg_var);
9499         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9500         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9501         js_invoke_function_ubuuuu(j_calls->instance_ptr, 79, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9502 }
9503 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
9504         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9505         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9506         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9507         jboolean no_connection_possible_conv = no_connection_possible;
9508         js_invoke_function_uuuuuu(j_calls->instance_ptr, 80, (uint32_t)their_node_id_arr, no_connection_possible_conv, 0, 0, 0, 0);
9509 }
9510 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
9511         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9512         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9513         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9514         LDKInit msg_var = *msg;
9515         uint64_t msg_ref = 0;
9516         msg_var = Init_clone(&msg_var);
9517         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9518         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9519         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 81, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9520         void* ret_ptr = untag_ptr(ret);
9521         CHECK_ACCESS(ret_ptr);
9522         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
9523         FREE(untag_ptr(ret));
9524         return ret_conv;
9525 }
9526 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
9527         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9528         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9529         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9530         LDKChannelReestablish msg_var = *msg;
9531         uint64_t msg_ref = 0;
9532         msg_var = ChannelReestablish_clone(&msg_var);
9533         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9534         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9535         js_invoke_function_ubuuuu(j_calls->instance_ptr, 82, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9536 }
9537 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
9538         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9539         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9540         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9541         LDKChannelUpdate msg_var = *msg;
9542         uint64_t msg_ref = 0;
9543         msg_var = ChannelUpdate_clone(&msg_var);
9544         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9545         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9546         js_invoke_function_ubuuuu(j_calls->instance_ptr, 83, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9547 }
9548 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
9549         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9550         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9551         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9552         LDKErrorMessage msg_var = *msg;
9553         uint64_t msg_ref = 0;
9554         msg_var = ErrorMessage_clone(&msg_var);
9555         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9556         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9557         js_invoke_function_ubuuuu(j_calls->instance_ptr, 84, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9558 }
9559 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
9560         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9561         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 85, 0, 0, 0, 0, 0, 0);
9562         LDKNodeFeatures ret_conv;
9563         ret_conv.inner = untag_ptr(ret);
9564         ret_conv.is_owned = ptr_is_owned(ret);
9565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
9566         return ret_conv;
9567 }
9568 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
9569         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9570         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9571         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9572         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 86, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
9573         LDKInitFeatures ret_conv;
9574         ret_conv.inner = untag_ptr(ret);
9575         ret_conv.is_owned = ptr_is_owned(ret);
9576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
9577         return ret_conv;
9578 }
9579 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
9580         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
9581         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9582         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
9583 }
9584 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
9585         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
9586         atomic_init(&calls->refcnt, 1);
9587         calls->instance_ptr = o;
9588
9589         LDKChannelMessageHandler ret = {
9590                 .this_arg = (void*) calls,
9591                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
9592                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
9593                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
9594                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
9595                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
9596                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
9597                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
9598                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
9599                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
9600                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
9601                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
9602                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
9603                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
9604                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
9605                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
9606                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
9607                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
9608                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
9609                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
9610                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
9611                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
9612                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
9613                 .free = LDKChannelMessageHandler_JCalls_free,
9614                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
9615         };
9616         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
9617         return ret;
9618 }
9619 uint64_t  __attribute__((export_name("TS_LDKChannelMessageHandler_new"))) TS_LDKChannelMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
9620         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
9621         *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
9622         return tag_ptr(res_ptr, true);
9623 }
9624 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) {
9625         void* this_arg_ptr = untag_ptr(this_arg);
9626         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9627         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9628         LDKPublicKey their_node_id_ref;
9629         CHECK(their_node_id->arr_len == 33);
9630         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9631         LDKInitFeatures their_features_conv;
9632         their_features_conv.inner = untag_ptr(their_features);
9633         their_features_conv.is_owned = ptr_is_owned(their_features);
9634         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
9635         their_features_conv = InitFeatures_clone(&their_features_conv);
9636         LDKOpenChannel msg_conv;
9637         msg_conv.inner = untag_ptr(msg);
9638         msg_conv.is_owned = ptr_is_owned(msg);
9639         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9640         msg_conv.is_owned = false;
9641         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
9642 }
9643
9644 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) {
9645         void* this_arg_ptr = untag_ptr(this_arg);
9646         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9647         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9648         LDKPublicKey their_node_id_ref;
9649         CHECK(their_node_id->arr_len == 33);
9650         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9651         LDKInitFeatures their_features_conv;
9652         their_features_conv.inner = untag_ptr(their_features);
9653         their_features_conv.is_owned = ptr_is_owned(their_features);
9654         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
9655         their_features_conv = InitFeatures_clone(&their_features_conv);
9656         LDKAcceptChannel msg_conv;
9657         msg_conv.inner = untag_ptr(msg);
9658         msg_conv.is_owned = ptr_is_owned(msg);
9659         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9660         msg_conv.is_owned = false;
9661         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
9662 }
9663
9664 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) {
9665         void* this_arg_ptr = untag_ptr(this_arg);
9666         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9667         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9668         LDKPublicKey their_node_id_ref;
9669         CHECK(their_node_id->arr_len == 33);
9670         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9671         LDKFundingCreated msg_conv;
9672         msg_conv.inner = untag_ptr(msg);
9673         msg_conv.is_owned = ptr_is_owned(msg);
9674         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9675         msg_conv.is_owned = false;
9676         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9677 }
9678
9679 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) {
9680         void* this_arg_ptr = untag_ptr(this_arg);
9681         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9682         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9683         LDKPublicKey their_node_id_ref;
9684         CHECK(their_node_id->arr_len == 33);
9685         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9686         LDKFundingSigned msg_conv;
9687         msg_conv.inner = untag_ptr(msg);
9688         msg_conv.is_owned = ptr_is_owned(msg);
9689         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9690         msg_conv.is_owned = false;
9691         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9692 }
9693
9694 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) {
9695         void* this_arg_ptr = untag_ptr(this_arg);
9696         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9697         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9698         LDKPublicKey their_node_id_ref;
9699         CHECK(their_node_id->arr_len == 33);
9700         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9701         LDKChannelReady msg_conv;
9702         msg_conv.inner = untag_ptr(msg);
9703         msg_conv.is_owned = ptr_is_owned(msg);
9704         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9705         msg_conv.is_owned = false;
9706         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9707 }
9708
9709 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) {
9710         void* this_arg_ptr = untag_ptr(this_arg);
9711         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9712         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9713         LDKPublicKey their_node_id_ref;
9714         CHECK(their_node_id->arr_len == 33);
9715         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9716         LDKInitFeatures their_features_conv;
9717         their_features_conv.inner = untag_ptr(their_features);
9718         their_features_conv.is_owned = ptr_is_owned(their_features);
9719         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
9720         their_features_conv.is_owned = false;
9721         LDKShutdown msg_conv;
9722         msg_conv.inner = untag_ptr(msg);
9723         msg_conv.is_owned = ptr_is_owned(msg);
9724         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9725         msg_conv.is_owned = false;
9726         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
9727 }
9728
9729 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) {
9730         void* this_arg_ptr = untag_ptr(this_arg);
9731         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9732         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9733         LDKPublicKey their_node_id_ref;
9734         CHECK(their_node_id->arr_len == 33);
9735         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9736         LDKClosingSigned msg_conv;
9737         msg_conv.inner = untag_ptr(msg);
9738         msg_conv.is_owned = ptr_is_owned(msg);
9739         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9740         msg_conv.is_owned = false;
9741         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9742 }
9743
9744 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) {
9745         void* this_arg_ptr = untag_ptr(this_arg);
9746         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9747         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9748         LDKPublicKey their_node_id_ref;
9749         CHECK(their_node_id->arr_len == 33);
9750         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9751         LDKUpdateAddHTLC msg_conv;
9752         msg_conv.inner = untag_ptr(msg);
9753         msg_conv.is_owned = ptr_is_owned(msg);
9754         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9755         msg_conv.is_owned = false;
9756         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9757 }
9758
9759 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) {
9760         void* this_arg_ptr = untag_ptr(this_arg);
9761         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9762         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9763         LDKPublicKey their_node_id_ref;
9764         CHECK(their_node_id->arr_len == 33);
9765         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9766         LDKUpdateFulfillHTLC msg_conv;
9767         msg_conv.inner = untag_ptr(msg);
9768         msg_conv.is_owned = ptr_is_owned(msg);
9769         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9770         msg_conv.is_owned = false;
9771         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9772 }
9773
9774 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) {
9775         void* this_arg_ptr = untag_ptr(this_arg);
9776         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9777         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9778         LDKPublicKey their_node_id_ref;
9779         CHECK(their_node_id->arr_len == 33);
9780         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9781         LDKUpdateFailHTLC msg_conv;
9782         msg_conv.inner = untag_ptr(msg);
9783         msg_conv.is_owned = ptr_is_owned(msg);
9784         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9785         msg_conv.is_owned = false;
9786         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9787 }
9788
9789 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) {
9790         void* this_arg_ptr = untag_ptr(this_arg);
9791         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9792         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9793         LDKPublicKey their_node_id_ref;
9794         CHECK(their_node_id->arr_len == 33);
9795         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9796         LDKUpdateFailMalformedHTLC msg_conv;
9797         msg_conv.inner = untag_ptr(msg);
9798         msg_conv.is_owned = ptr_is_owned(msg);
9799         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9800         msg_conv.is_owned = false;
9801         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9802 }
9803
9804 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) {
9805         void* this_arg_ptr = untag_ptr(this_arg);
9806         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9807         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9808         LDKPublicKey their_node_id_ref;
9809         CHECK(their_node_id->arr_len == 33);
9810         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9811         LDKCommitmentSigned msg_conv;
9812         msg_conv.inner = untag_ptr(msg);
9813         msg_conv.is_owned = ptr_is_owned(msg);
9814         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9815         msg_conv.is_owned = false;
9816         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9817 }
9818
9819 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) {
9820         void* this_arg_ptr = untag_ptr(this_arg);
9821         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9822         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9823         LDKPublicKey their_node_id_ref;
9824         CHECK(their_node_id->arr_len == 33);
9825         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9826         LDKRevokeAndACK msg_conv;
9827         msg_conv.inner = untag_ptr(msg);
9828         msg_conv.is_owned = ptr_is_owned(msg);
9829         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9830         msg_conv.is_owned = false;
9831         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9832 }
9833
9834 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) {
9835         void* this_arg_ptr = untag_ptr(this_arg);
9836         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9837         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9838         LDKPublicKey their_node_id_ref;
9839         CHECK(their_node_id->arr_len == 33);
9840         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9841         LDKUpdateFee msg_conv;
9842         msg_conv.inner = untag_ptr(msg);
9843         msg_conv.is_owned = ptr_is_owned(msg);
9844         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9845         msg_conv.is_owned = false;
9846         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9847 }
9848
9849 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) {
9850         void* this_arg_ptr = untag_ptr(this_arg);
9851         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9852         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9853         LDKPublicKey their_node_id_ref;
9854         CHECK(their_node_id->arr_len == 33);
9855         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9856         LDKAnnouncementSignatures msg_conv;
9857         msg_conv.inner = untag_ptr(msg);
9858         msg_conv.is_owned = ptr_is_owned(msg);
9859         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9860         msg_conv.is_owned = false;
9861         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9862 }
9863
9864 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) {
9865         void* this_arg_ptr = untag_ptr(this_arg);
9866         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9867         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9868         LDKPublicKey their_node_id_ref;
9869         CHECK(their_node_id->arr_len == 33);
9870         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9871         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
9872 }
9873
9874 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) {
9875         void* this_arg_ptr = untag_ptr(this_arg);
9876         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9877         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9878         LDKPublicKey their_node_id_ref;
9879         CHECK(their_node_id->arr_len == 33);
9880         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9881         LDKInit msg_conv;
9882         msg_conv.inner = untag_ptr(msg);
9883         msg_conv.is_owned = ptr_is_owned(msg);
9884         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9885         msg_conv.is_owned = false;
9886         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
9887         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9888         return tag_ptr(ret_conv, true);
9889 }
9890
9891 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) {
9892         void* this_arg_ptr = untag_ptr(this_arg);
9893         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9894         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9895         LDKPublicKey their_node_id_ref;
9896         CHECK(their_node_id->arr_len == 33);
9897         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9898         LDKChannelReestablish msg_conv;
9899         msg_conv.inner = untag_ptr(msg);
9900         msg_conv.is_owned = ptr_is_owned(msg);
9901         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9902         msg_conv.is_owned = false;
9903         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9904 }
9905
9906 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) {
9907         void* this_arg_ptr = untag_ptr(this_arg);
9908         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9909         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9910         LDKPublicKey their_node_id_ref;
9911         CHECK(their_node_id->arr_len == 33);
9912         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9913         LDKChannelUpdate msg_conv;
9914         msg_conv.inner = untag_ptr(msg);
9915         msg_conv.is_owned = ptr_is_owned(msg);
9916         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9917         msg_conv.is_owned = false;
9918         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9919 }
9920
9921 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_error"))) TS_ChannelMessageHandler_handle_error(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
9922         void* this_arg_ptr = untag_ptr(this_arg);
9923         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9924         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9925         LDKPublicKey their_node_id_ref;
9926         CHECK(their_node_id->arr_len == 33);
9927         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9928         LDKErrorMessage msg_conv;
9929         msg_conv.inner = untag_ptr(msg);
9930         msg_conv.is_owned = ptr_is_owned(msg);
9931         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9932         msg_conv.is_owned = false;
9933         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9934 }
9935
9936 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_node_features"))) TS_ChannelMessageHandler_provided_node_features(uint64_t this_arg) {
9937         void* this_arg_ptr = untag_ptr(this_arg);
9938         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9939         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9940         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
9941         uint64_t ret_ref = 0;
9942         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9943         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9944         return ret_ref;
9945 }
9946
9947 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_init_features"))) TS_ChannelMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
9948         void* this_arg_ptr = untag_ptr(this_arg);
9949         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9950         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9951         LDKPublicKey their_node_id_ref;
9952         CHECK(their_node_id->arr_len == 33);
9953         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9954         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
9955         uint64_t ret_ref = 0;
9956         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9957         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9958         return ret_ref;
9959 }
9960
9961 typedef struct LDKRoutingMessageHandler_JCalls {
9962         atomic_size_t refcnt;
9963         uint32_t instance_ptr;
9964         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
9965 } LDKRoutingMessageHandler_JCalls;
9966 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
9967         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9968         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9969                 FREE(j_calls);
9970         }
9971 }
9972 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
9973         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9974         LDKNodeAnnouncement msg_var = *msg;
9975         uint64_t msg_ref = 0;
9976         msg_var = NodeAnnouncement_clone(&msg_var);
9977         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9978         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9979         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 87, msg_ref, 0, 0, 0, 0, 0);
9980         void* ret_ptr = untag_ptr(ret);
9981         CHECK_ACCESS(ret_ptr);
9982         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9983         FREE(untag_ptr(ret));
9984         return ret_conv;
9985 }
9986 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
9987         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9988         LDKChannelAnnouncement msg_var = *msg;
9989         uint64_t msg_ref = 0;
9990         msg_var = ChannelAnnouncement_clone(&msg_var);
9991         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9992         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9993         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 88, msg_ref, 0, 0, 0, 0, 0);
9994         void* ret_ptr = untag_ptr(ret);
9995         CHECK_ACCESS(ret_ptr);
9996         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9997         FREE(untag_ptr(ret));
9998         return ret_conv;
9999 }
10000 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
10001         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10002         LDKChannelUpdate msg_var = *msg;
10003         uint64_t msg_ref = 0;
10004         msg_var = ChannelUpdate_clone(&msg_var);
10005         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10006         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10007         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 89, msg_ref, 0, 0, 0, 0, 0);
10008         void* ret_ptr = untag_ptr(ret);
10009         CHECK_ACCESS(ret_ptr);
10010         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
10011         FREE(untag_ptr(ret));
10012         return ret_conv;
10013 }
10014 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
10015         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10016         int64_t starting_point_conv = starting_point;
10017         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 90, starting_point_conv, 0, 0, 0, 0, 0);
10018         void* ret_ptr = untag_ptr(ret);
10019         CHECK_ACCESS(ret_ptr);
10020         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
10021         FREE(untag_ptr(ret));
10022         return ret_conv;
10023 }
10024 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point) {
10025         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10026         int8_tArray starting_point_arr = init_int8_tArray(33, __LINE__);
10027         memcpy(starting_point_arr->elems, starting_point.compressed_form, 33);
10028         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 91, (uint32_t)starting_point_arr, 0, 0, 0, 0, 0);
10029         LDKNodeAnnouncement ret_conv;
10030         ret_conv.inner = untag_ptr(ret);
10031         ret_conv.is_owned = ptr_is_owned(ret);
10032         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10033         return ret_conv;
10034 }
10035 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
10036         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10037         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10038         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10039         LDKInit init_var = *init;
10040         uint64_t init_ref = 0;
10041         init_var = Init_clone(&init_var);
10042         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
10043         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
10044         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 92, (uint32_t)their_node_id_arr, init_ref, 0, 0, 0, 0);
10045         void* ret_ptr = untag_ptr(ret);
10046         CHECK_ACCESS(ret_ptr);
10047         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
10048         FREE(untag_ptr(ret));
10049         return ret_conv;
10050 }
10051 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
10052         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10053         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10054         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10055         LDKReplyChannelRange msg_var = msg;
10056         uint64_t msg_ref = 0;
10057         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10058         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10059         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 93, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10060         void* ret_ptr = untag_ptr(ret);
10061         CHECK_ACCESS(ret_ptr);
10062         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10063         FREE(untag_ptr(ret));
10064         return ret_conv;
10065 }
10066 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
10067         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10068         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10069         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10070         LDKReplyShortChannelIdsEnd msg_var = msg;
10071         uint64_t msg_ref = 0;
10072         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10073         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10074         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 94, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10075         void* ret_ptr = untag_ptr(ret);
10076         CHECK_ACCESS(ret_ptr);
10077         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10078         FREE(untag_ptr(ret));
10079         return ret_conv;
10080 }
10081 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
10082         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10083         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10084         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10085         LDKQueryChannelRange msg_var = msg;
10086         uint64_t msg_ref = 0;
10087         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10088         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10089         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 95, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10090         void* ret_ptr = untag_ptr(ret);
10091         CHECK_ACCESS(ret_ptr);
10092         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10093         FREE(untag_ptr(ret));
10094         return ret_conv;
10095 }
10096 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
10097         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10098         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10099         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10100         LDKQueryShortChannelIds msg_var = msg;
10101         uint64_t msg_ref = 0;
10102         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10103         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10104         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 96, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
10105         void* ret_ptr = untag_ptr(ret);
10106         CHECK_ACCESS(ret_ptr);
10107         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10108         FREE(untag_ptr(ret));
10109         return ret_conv;
10110 }
10111 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
10112         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10113         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 97, 0, 0, 0, 0, 0, 0);
10114         LDKNodeFeatures ret_conv;
10115         ret_conv.inner = untag_ptr(ret);
10116         ret_conv.is_owned = ptr_is_owned(ret);
10117         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10118         return ret_conv;
10119 }
10120 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
10121         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
10122         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10123         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10124         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 98, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
10125         LDKInitFeatures ret_conv;
10126         ret_conv.inner = untag_ptr(ret);
10127         ret_conv.is_owned = ptr_is_owned(ret);
10128         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10129         return ret_conv;
10130 }
10131 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
10132         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
10133         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10134         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
10135 }
10136 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
10137         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
10138         atomic_init(&calls->refcnt, 1);
10139         calls->instance_ptr = o;
10140
10141         LDKRoutingMessageHandler ret = {
10142                 .this_arg = (void*) calls,
10143                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
10144                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
10145                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
10146                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
10147                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
10148                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
10149                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
10150                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
10151                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
10152                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
10153                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
10154                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
10155                 .free = LDKRoutingMessageHandler_JCalls_free,
10156                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
10157         };
10158         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
10159         return ret;
10160 }
10161 uint64_t  __attribute__((export_name("TS_LDKRoutingMessageHandler_new"))) TS_LDKRoutingMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
10162         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
10163         *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
10164         return tag_ptr(res_ptr, true);
10165 }
10166 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_node_announcement"))) TS_RoutingMessageHandler_handle_node_announcement(uint64_t this_arg, uint64_t msg) {
10167         void* this_arg_ptr = untag_ptr(this_arg);
10168         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10169         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10170         LDKNodeAnnouncement msg_conv;
10171         msg_conv.inner = untag_ptr(msg);
10172         msg_conv.is_owned = ptr_is_owned(msg);
10173         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10174         msg_conv.is_owned = false;
10175         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10176         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
10177         return tag_ptr(ret_conv, true);
10178 }
10179
10180 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_announcement"))) TS_RoutingMessageHandler_handle_channel_announcement(uint64_t this_arg, uint64_t msg) {
10181         void* this_arg_ptr = untag_ptr(this_arg);
10182         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10183         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10184         LDKChannelAnnouncement msg_conv;
10185         msg_conv.inner = untag_ptr(msg);
10186         msg_conv.is_owned = ptr_is_owned(msg);
10187         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10188         msg_conv.is_owned = false;
10189         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10190         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
10191         return tag_ptr(ret_conv, true);
10192 }
10193
10194 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_update"))) TS_RoutingMessageHandler_handle_channel_update(uint64_t this_arg, uint64_t msg) {
10195         void* this_arg_ptr = untag_ptr(this_arg);
10196         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10197         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10198         LDKChannelUpdate msg_conv;
10199         msg_conv.inner = untag_ptr(msg);
10200         msg_conv.is_owned = ptr_is_owned(msg);
10201         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10202         msg_conv.is_owned = false;
10203         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
10204         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
10205         return tag_ptr(ret_conv, true);
10206 }
10207
10208 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) {
10209         void* this_arg_ptr = untag_ptr(this_arg);
10210         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10211         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10212         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
10213         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
10214         uint64_t ret_ref = tag_ptr(ret_copy, true);
10215         return ret_ref;
10216 }
10217
10218 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) {
10219         void* this_arg_ptr = untag_ptr(this_arg);
10220         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10221         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10222         LDKPublicKey starting_point_ref;
10223         CHECK(starting_point->arr_len == 33);
10224         memcpy(starting_point_ref.compressed_form, starting_point->elems, 33); FREE(starting_point);
10225         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_ref);
10226         uint64_t ret_ref = 0;
10227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10229         return ret_ref;
10230 }
10231
10232 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) {
10233         void* this_arg_ptr = untag_ptr(this_arg);
10234         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10235         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10236         LDKPublicKey their_node_id_ref;
10237         CHECK(their_node_id->arr_len == 33);
10238         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10239         LDKInit init_conv;
10240         init_conv.inner = untag_ptr(init);
10241         init_conv.is_owned = ptr_is_owned(init);
10242         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
10243         init_conv.is_owned = false;
10244         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10245         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
10246         return tag_ptr(ret_conv, true);
10247 }
10248
10249 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) {
10250         void* this_arg_ptr = untag_ptr(this_arg);
10251         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10252         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10253         LDKPublicKey their_node_id_ref;
10254         CHECK(their_node_id->arr_len == 33);
10255         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10256         LDKReplyChannelRange msg_conv;
10257         msg_conv.inner = untag_ptr(msg);
10258         msg_conv.is_owned = ptr_is_owned(msg);
10259         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10260         msg_conv = ReplyChannelRange_clone(&msg_conv);
10261         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10262         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10263         return tag_ptr(ret_conv, true);
10264 }
10265
10266 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) {
10267         void* this_arg_ptr = untag_ptr(this_arg);
10268         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10269         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10270         LDKPublicKey their_node_id_ref;
10271         CHECK(their_node_id->arr_len == 33);
10272         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10273         LDKReplyShortChannelIdsEnd msg_conv;
10274         msg_conv.inner = untag_ptr(msg);
10275         msg_conv.is_owned = ptr_is_owned(msg);
10276         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10277         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
10278         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10279         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10280         return tag_ptr(ret_conv, true);
10281 }
10282
10283 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) {
10284         void* this_arg_ptr = untag_ptr(this_arg);
10285         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10286         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10287         LDKPublicKey their_node_id_ref;
10288         CHECK(their_node_id->arr_len == 33);
10289         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10290         LDKQueryChannelRange msg_conv;
10291         msg_conv.inner = untag_ptr(msg);
10292         msg_conv.is_owned = ptr_is_owned(msg);
10293         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10294         msg_conv = QueryChannelRange_clone(&msg_conv);
10295         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10296         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10297         return tag_ptr(ret_conv, true);
10298 }
10299
10300 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) {
10301         void* this_arg_ptr = untag_ptr(this_arg);
10302         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10303         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10304         LDKPublicKey their_node_id_ref;
10305         CHECK(their_node_id->arr_len == 33);
10306         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10307         LDKQueryShortChannelIds msg_conv;
10308         msg_conv.inner = untag_ptr(msg);
10309         msg_conv.is_owned = ptr_is_owned(msg);
10310         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10311         msg_conv = QueryShortChannelIds_clone(&msg_conv);
10312         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10313         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10314         return tag_ptr(ret_conv, true);
10315 }
10316
10317 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_node_features"))) TS_RoutingMessageHandler_provided_node_features(uint64_t this_arg) {
10318         void* this_arg_ptr = untag_ptr(this_arg);
10319         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10320         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10321         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
10322         uint64_t ret_ref = 0;
10323         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10324         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10325         return ret_ref;
10326 }
10327
10328 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_init_features"))) TS_RoutingMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
10329         void* this_arg_ptr = untag_ptr(this_arg);
10330         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10331         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10332         LDKPublicKey their_node_id_ref;
10333         CHECK(their_node_id->arr_len == 33);
10334         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10335         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
10336         uint64_t ret_ref = 0;
10337         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10338         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10339         return ret_ref;
10340 }
10341
10342 typedef struct LDKOnionMessageHandler_JCalls {
10343         atomic_size_t refcnt;
10344         uint32_t instance_ptr;
10345         LDKOnionMessageProvider_JCalls* OnionMessageProvider;
10346 } LDKOnionMessageHandler_JCalls;
10347 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
10348         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10349         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10350                 FREE(j_calls);
10351         }
10352 }
10353 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
10354         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10355         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
10356         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
10357         LDKOnionMessage msg_var = *msg;
10358         uint64_t msg_ref = 0;
10359         msg_var = OnionMessage_clone(&msg_var);
10360         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10361         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10362         js_invoke_function_ubuuuu(j_calls->instance_ptr, 99, (uint32_t)peer_node_id_arr, msg_ref, 0, 0, 0, 0);
10363 }
10364 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
10365         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10366         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10367         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10368         LDKInit init_var = *init;
10369         uint64_t init_ref = 0;
10370         init_var = Init_clone(&init_var);
10371         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
10372         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
10373         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 100, (uint32_t)their_node_id_arr, init_ref, 0, 0, 0, 0);
10374         void* ret_ptr = untag_ptr(ret);
10375         CHECK_ACCESS(ret_ptr);
10376         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
10377         FREE(untag_ptr(ret));
10378         return ret_conv;
10379 }
10380 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
10381         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10382         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10383         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10384         jboolean no_connection_possible_conv = no_connection_possible;
10385         js_invoke_function_uuuuuu(j_calls->instance_ptr, 101, (uint32_t)their_node_id_arr, no_connection_possible_conv, 0, 0, 0, 0);
10386 }
10387 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
10388         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10389         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 102, 0, 0, 0, 0, 0, 0);
10390         LDKNodeFeatures ret_conv;
10391         ret_conv.inner = untag_ptr(ret);
10392         ret_conv.is_owned = ptr_is_owned(ret);
10393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10394         return ret_conv;
10395 }
10396 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
10397         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10398         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10399         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10400         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 103, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
10401         LDKInitFeatures ret_conv;
10402         ret_conv.inner = untag_ptr(ret);
10403         ret_conv.is_owned = ptr_is_owned(ret);
10404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10405         return ret_conv;
10406 }
10407 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
10408         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
10409         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10410         atomic_fetch_add_explicit(&j_calls->OnionMessageProvider->refcnt, 1, memory_order_release);
10411 }
10412 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JSValue o, JSValue OnionMessageProvider) {
10413         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
10414         atomic_init(&calls->refcnt, 1);
10415         calls->instance_ptr = o;
10416
10417         LDKOnionMessageHandler ret = {
10418                 .this_arg = (void*) calls,
10419                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
10420                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
10421                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
10422                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
10423                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
10424                 .free = LDKOnionMessageHandler_JCalls_free,
10425                 .OnionMessageProvider = LDKOnionMessageProvider_init(OnionMessageProvider),
10426         };
10427         calls->OnionMessageProvider = ret.OnionMessageProvider.this_arg;
10428         return ret;
10429 }
10430 uint64_t  __attribute__((export_name("TS_LDKOnionMessageHandler_new"))) TS_LDKOnionMessageHandler_new(JSValue o, JSValue OnionMessageProvider) {
10431         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
10432         *res_ptr = LDKOnionMessageHandler_init(o, OnionMessageProvider);
10433         return tag_ptr(res_ptr, true);
10434 }
10435 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) {
10436         void* this_arg_ptr = untag_ptr(this_arg);
10437         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10438         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
10439         LDKPublicKey peer_node_id_ref;
10440         CHECK(peer_node_id->arr_len == 33);
10441         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
10442         LDKOnionMessage msg_conv;
10443         msg_conv.inner = untag_ptr(msg);
10444         msg_conv.is_owned = ptr_is_owned(msg);
10445         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10446         msg_conv.is_owned = false;
10447         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
10448 }
10449
10450 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) {
10451         void* this_arg_ptr = untag_ptr(this_arg);
10452         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10453         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
10454         LDKPublicKey their_node_id_ref;
10455         CHECK(their_node_id->arr_len == 33);
10456         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10457         LDKInit init_conv;
10458         init_conv.inner = untag_ptr(init);
10459         init_conv.is_owned = ptr_is_owned(init);
10460         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
10461         init_conv.is_owned = false;
10462         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
10463         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
10464         return tag_ptr(ret_conv, true);
10465 }
10466
10467 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) {
10468         void* this_arg_ptr = untag_ptr(this_arg);
10469         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10470         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
10471         LDKPublicKey their_node_id_ref;
10472         CHECK(their_node_id->arr_len == 33);
10473         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10474         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
10475 }
10476
10477 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_node_features"))) TS_OnionMessageHandler_provided_node_features(uint64_t this_arg) {
10478         void* this_arg_ptr = untag_ptr(this_arg);
10479         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10480         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
10481         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
10482         uint64_t ret_ref = 0;
10483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10485         return ret_ref;
10486 }
10487
10488 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_init_features"))) TS_OnionMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
10489         void* this_arg_ptr = untag_ptr(this_arg);
10490         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10491         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
10492         LDKPublicKey their_node_id_ref;
10493         CHECK(their_node_id->arr_len == 33);
10494         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10495         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
10496         uint64_t ret_ref = 0;
10497         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10498         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10499         return ret_ref;
10500 }
10501
10502 typedef struct LDKCustomMessageReader_JCalls {
10503         atomic_size_t refcnt;
10504         uint32_t instance_ptr;
10505 } LDKCustomMessageReader_JCalls;
10506 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
10507         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
10508         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10509                 FREE(j_calls);
10510         }
10511 }
10512 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
10513         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
10514         int16_t message_type_conv = message_type;
10515         LDKu8slice buffer_var = buffer;
10516         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
10517         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
10518         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 104, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
10519         void* ret_ptr = untag_ptr(ret);
10520         CHECK_ACCESS(ret_ptr);
10521         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
10522         FREE(untag_ptr(ret));
10523         return ret_conv;
10524 }
10525 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
10526         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
10527         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10528 }
10529 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JSValue o) {
10530         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
10531         atomic_init(&calls->refcnt, 1);
10532         calls->instance_ptr = o;
10533
10534         LDKCustomMessageReader ret = {
10535                 .this_arg = (void*) calls,
10536                 .read = read_LDKCustomMessageReader_jcall,
10537                 .free = LDKCustomMessageReader_JCalls_free,
10538         };
10539         return ret;
10540 }
10541 uint64_t  __attribute__((export_name("TS_LDKCustomMessageReader_new"))) TS_LDKCustomMessageReader_new(JSValue o) {
10542         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
10543         *res_ptr = LDKCustomMessageReader_init(o);
10544         return tag_ptr(res_ptr, true);
10545 }
10546 uint64_t  __attribute__((export_name("TS_CustomMessageReader_read"))) TS_CustomMessageReader_read(uint64_t this_arg, int16_t message_type, int8_tArray buffer) {
10547         void* this_arg_ptr = untag_ptr(this_arg);
10548         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10549         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
10550         LDKu8slice buffer_ref;
10551         buffer_ref.datalen = buffer->arr_len;
10552         buffer_ref.data = buffer->elems;
10553         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
10554         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
10555         FREE(buffer);
10556         return tag_ptr(ret_conv, true);
10557 }
10558
10559 typedef struct LDKCustomMessageHandler_JCalls {
10560         atomic_size_t refcnt;
10561         uint32_t instance_ptr;
10562         LDKCustomMessageReader_JCalls* CustomMessageReader;
10563 } LDKCustomMessageHandler_JCalls;
10564 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
10565         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10566         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10567                 FREE(j_calls);
10568         }
10569 }
10570 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
10571         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10572         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
10573         *msg_ret = msg;
10574         int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__);
10575         memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
10576         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);
10577         void* ret_ptr = untag_ptr(ret);
10578         CHECK_ACCESS(ret_ptr);
10579         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10580         FREE(untag_ptr(ret));
10581         return ret_conv;
10582 }
10583 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
10584         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10585         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 106, 0, 0, 0, 0, 0, 0);
10586         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
10587         ret_constr.datalen = ret->arr_len;
10588         if (ret_constr.datalen > 0)
10589                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
10590         else
10591                 ret_constr.data = NULL;
10592         uint64_t* ret_vals = ret->elems;
10593         for (size_t z = 0; z < ret_constr.datalen; z++) {
10594                 uint64_t ret_conv_25 = ret_vals[z];
10595                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
10596                 CHECK_ACCESS(ret_conv_25_ptr);
10597                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
10598                 FREE(untag_ptr(ret_conv_25));
10599                 ret_constr.data[z] = ret_conv_25_conv;
10600         }
10601         FREE(ret);
10602         return ret_constr;
10603 }
10604 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
10605         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
10606         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10607         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
10608 }
10609 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JSValue o, JSValue CustomMessageReader) {
10610         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
10611         atomic_init(&calls->refcnt, 1);
10612         calls->instance_ptr = o;
10613
10614         LDKCustomMessageHandler ret = {
10615                 .this_arg = (void*) calls,
10616                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
10617                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
10618                 .free = LDKCustomMessageHandler_JCalls_free,
10619                 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
10620         };
10621         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
10622         return ret;
10623 }
10624 uint64_t  __attribute__((export_name("TS_LDKCustomMessageHandler_new"))) TS_LDKCustomMessageHandler_new(JSValue o, JSValue CustomMessageReader) {
10625         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
10626         *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
10627         return tag_ptr(res_ptr, true);
10628 }
10629 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) {
10630         void* this_arg_ptr = untag_ptr(this_arg);
10631         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10632         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
10633         void* msg_ptr = untag_ptr(msg);
10634         CHECK_ACCESS(msg_ptr);
10635         LDKType msg_conv = *(LDKType*)(msg_ptr);
10636         if (msg_conv.free == LDKType_JCalls_free) {
10637                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10638                 LDKType_JCalls_cloned(&msg_conv);
10639         }
10640         LDKPublicKey sender_node_id_ref;
10641         CHECK(sender_node_id->arr_len == 33);
10642         memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33); FREE(sender_node_id);
10643         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10644         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
10645         return tag_ptr(ret_conv, true);
10646 }
10647
10648 uint64_tArray  __attribute__((export_name("TS_CustomMessageHandler_get_and_clear_pending_msg"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint64_t this_arg) {
10649         void* this_arg_ptr = untag_ptr(this_arg);
10650         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10651         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
10652         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
10653         uint64_tArray ret_arr = NULL;
10654         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
10655         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
10656         for (size_t z = 0; z < ret_var.datalen; z++) {
10657                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
10658                 *ret_conv_25_conv = ret_var.data[z];
10659                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
10660         }
10661         
10662         FREE(ret_var.data);
10663         return ret_arr;
10664 }
10665
10666 typedef struct LDKCustomOnionMessageHandler_JCalls {
10667         atomic_size_t refcnt;
10668         uint32_t instance_ptr;
10669 } LDKCustomOnionMessageHandler_JCalls;
10670 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
10671         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
10672         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10673                 FREE(j_calls);
10674         }
10675 }
10676 void handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKCustomOnionMessageContents msg) {
10677         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
10678         LDKCustomOnionMessageContents* msg_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
10679         *msg_ret = msg;
10680         js_invoke_function_buuuuu(j_calls->instance_ptr, 107, tag_ptr(msg_ret, true), 0, 0, 0, 0, 0);
10681 }
10682 LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
10683         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
10684         int64_t message_type_conv = message_type;
10685         LDKu8slice buffer_var = buffer;
10686         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
10687         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
10688         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 108, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
10689         void* ret_ptr = untag_ptr(ret);
10690         CHECK_ACCESS(ret_ptr);
10691         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(ret_ptr);
10692         FREE(untag_ptr(ret));
10693         return ret_conv;
10694 }
10695 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
10696         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
10697         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10698 }
10699 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (JSValue o) {
10700         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
10701         atomic_init(&calls->refcnt, 1);
10702         calls->instance_ptr = o;
10703
10704         LDKCustomOnionMessageHandler ret = {
10705                 .this_arg = (void*) calls,
10706                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
10707                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
10708                 .free = LDKCustomOnionMessageHandler_JCalls_free,
10709         };
10710         return ret;
10711 }
10712 uint64_t  __attribute__((export_name("TS_LDKCustomOnionMessageHandler_new"))) TS_LDKCustomOnionMessageHandler_new(JSValue o) {
10713         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
10714         *res_ptr = LDKCustomOnionMessageHandler_init(o);
10715         return tag_ptr(res_ptr, true);
10716 }
10717 void  __attribute__((export_name("TS_CustomOnionMessageHandler_handle_custom_message"))) TS_CustomOnionMessageHandler_handle_custom_message(uint64_t this_arg, uint64_t msg) {
10718         void* this_arg_ptr = untag_ptr(this_arg);
10719         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10720         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
10721         void* msg_ptr = untag_ptr(msg);
10722         CHECK_ACCESS(msg_ptr);
10723         LDKCustomOnionMessageContents msg_conv = *(LDKCustomOnionMessageContents*)(msg_ptr);
10724         if (msg_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
10725                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10726                 LDKCustomOnionMessageContents_JCalls_cloned(&msg_conv);
10727         }
10728         (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
10729 }
10730
10731 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) {
10732         void* this_arg_ptr = untag_ptr(this_arg);
10733         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10734         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
10735         LDKu8slice buffer_ref;
10736         buffer_ref.datalen = buffer->arr_len;
10737         buffer_ref.data = buffer->elems;
10738         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
10739         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
10740         FREE(buffer);
10741         return tag_ptr(ret_conv, true);
10742 }
10743
10744 typedef struct LDKSocketDescriptor_JCalls {
10745         atomic_size_t refcnt;
10746         uint32_t instance_ptr;
10747 } LDKSocketDescriptor_JCalls;
10748 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
10749         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10750         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10751                 FREE(j_calls);
10752         }
10753 }
10754 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
10755         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10756         LDKu8slice data_var = data;
10757         int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__);
10758         memcpy(data_arr->elems, data_var.data, data_var.datalen);
10759         jboolean resume_read_conv = resume_read;
10760         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 109, (uint32_t)data_arr, resume_read_conv, 0, 0, 0, 0);
10761 }
10762 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
10763         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10764         js_invoke_function_uuuuuu(j_calls->instance_ptr, 110, 0, 0, 0, 0, 0, 0);
10765 }
10766 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
10767         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10768         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
10769         *other_arg_clone = SocketDescriptor_clone(other_arg);
10770         return js_invoke_function_buuuuu(j_calls->instance_ptr, 111, tag_ptr(other_arg_clone, true), 0, 0, 0, 0, 0);
10771 }
10772 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
10773         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10774         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 112, 0, 0, 0, 0, 0, 0);
10775 }
10776 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
10777         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
10778         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10779 }
10780 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JSValue o) {
10781         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
10782         atomic_init(&calls->refcnt, 1);
10783         calls->instance_ptr = o;
10784
10785         LDKSocketDescriptor ret = {
10786                 .this_arg = (void*) calls,
10787                 .send_data = send_data_LDKSocketDescriptor_jcall,
10788                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
10789                 .eq = eq_LDKSocketDescriptor_jcall,
10790                 .hash = hash_LDKSocketDescriptor_jcall,
10791                 .cloned = LDKSocketDescriptor_JCalls_cloned,
10792                 .free = LDKSocketDescriptor_JCalls_free,
10793         };
10794         return ret;
10795 }
10796 uint64_t  __attribute__((export_name("TS_LDKSocketDescriptor_new"))) TS_LDKSocketDescriptor_new(JSValue o) {
10797         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
10798         *res_ptr = LDKSocketDescriptor_init(o);
10799         return tag_ptr(res_ptr, true);
10800 }
10801 uint32_t  __attribute__((export_name("TS_SocketDescriptor_send_data"))) TS_SocketDescriptor_send_data(uint64_t this_arg, int8_tArray data, jboolean resume_read) {
10802         void* this_arg_ptr = untag_ptr(this_arg);
10803         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10804         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10805         LDKu8slice data_ref;
10806         data_ref.datalen = data->arr_len;
10807         data_ref.data = data->elems;
10808         uint32_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
10809         FREE(data);
10810         return ret_conv;
10811 }
10812
10813 void  __attribute__((export_name("TS_SocketDescriptor_disconnect_socket"))) TS_SocketDescriptor_disconnect_socket(uint64_t this_arg) {
10814         void* this_arg_ptr = untag_ptr(this_arg);
10815         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10816         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10817         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
10818 }
10819
10820 int64_t  __attribute__((export_name("TS_SocketDescriptor_hash"))) TS_SocketDescriptor_hash(uint64_t this_arg) {
10821         void* this_arg_ptr = untag_ptr(this_arg);
10822         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10823         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10824         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
10825         return ret_conv;
10826 }
10827
10828 uint32_t __attribute__((export_name("TS_LDKEffectiveCapacity_ty_from_ptr"))) TS_LDKEffectiveCapacity_ty_from_ptr(uint64_t ptr) {
10829         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
10830         switch(obj->tag) {
10831                 case LDKEffectiveCapacity_ExactLiquidity: return 0;
10832                 case LDKEffectiveCapacity_MaximumHTLC: return 1;
10833                 case LDKEffectiveCapacity_Total: return 2;
10834                 case LDKEffectiveCapacity_Infinite: return 3;
10835                 case LDKEffectiveCapacity_Unknown: return 4;
10836                 default: abort();
10837         }
10838 }
10839 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat"))) TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(uint64_t ptr) {
10840         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
10841         assert(obj->tag == LDKEffectiveCapacity_ExactLiquidity);
10842                         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
10843         return liquidity_msat_conv;
10844 }
10845 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat(uint64_t ptr) {
10846         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
10847         assert(obj->tag == LDKEffectiveCapacity_MaximumHTLC);
10848                         int64_t amount_msat_conv = obj->maximum_htlc.amount_msat;
10849         return amount_msat_conv;
10850 }
10851 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_capacity_msat"))) TS_LDKEffectiveCapacity_Total_get_capacity_msat(uint64_t ptr) {
10852         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
10853         assert(obj->tag == LDKEffectiveCapacity_Total);
10854                         int64_t capacity_msat_conv = obj->total.capacity_msat;
10855         return capacity_msat_conv;
10856 }
10857 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat"))) TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat(uint64_t ptr) {
10858         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
10859         assert(obj->tag == LDKEffectiveCapacity_Total);
10860                         int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat;
10861         return htlc_maximum_msat_conv;
10862 }
10863 typedef struct LDKRouter_JCalls {
10864         atomic_size_t refcnt;
10865         uint32_t instance_ptr;
10866 } LDKRouter_JCalls;
10867 static void LDKRouter_JCalls_free(void* this_arg) {
10868         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10869         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10870                 FREE(j_calls);
10871         }
10872 }
10873 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) {
10874         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10875         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
10876         memcpy(payer_arr->elems, payer.compressed_form, 33);
10877         LDKRouteParameters route_params_var = *route_params;
10878         uint64_t route_params_ref = 0;
10879         route_params_var = RouteParameters_clone(&route_params_var);
10880         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
10881         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
10882         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
10883         uint64_tArray first_hops_arr = NULL;
10884         if (first_hops != NULL) {
10885                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
10886                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
10887                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
10888                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
10889                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
10890                         uint64_t first_hops_conv_16_ref = 0;
10891                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
10892                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
10893                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
10894                 }
10895         
10896         }
10897         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
10898         uint64_t inflight_htlcs_ref = 0;
10899         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
10900         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
10901         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);
10902         void* ret_ptr = untag_ptr(ret);
10903         CHECK_ACCESS(ret_ptr);
10904         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
10905         FREE(untag_ptr(ret));
10906         return ret_conv;
10907 }
10908 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) {
10909         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10910         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
10911         memcpy(payer_arr->elems, payer.compressed_form, 33);
10912         LDKRouteParameters route_params_var = *route_params;
10913         uint64_t route_params_ref = 0;
10914         route_params_var = RouteParameters_clone(&route_params_var);
10915         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
10916         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
10917         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
10918         uint64_tArray first_hops_arr = NULL;
10919         if (first_hops != NULL) {
10920                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
10921                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
10922                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
10923                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
10924                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
10925                         uint64_t first_hops_conv_16_ref = 0;
10926                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
10927                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
10928                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
10929                 }
10930         
10931         }
10932         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
10933         uint64_t inflight_htlcs_ref = 0;
10934         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
10935         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
10936         int8_tArray _payment_hash_arr = init_int8_tArray(32, __LINE__);
10937         memcpy(_payment_hash_arr->elems, _payment_hash.data, 32);
10938         int8_tArray _payment_id_arr = init_int8_tArray(32, __LINE__);
10939         memcpy(_payment_id_arr->elems, _payment_id.data, 32);
10940         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);
10941         void* ret_ptr = untag_ptr(ret);
10942         CHECK_ACCESS(ret_ptr);
10943         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
10944         FREE(untag_ptr(ret));
10945         return ret_conv;
10946 }
10947 void notify_payment_path_failed_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
10948         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10949         LDKCVec_RouteHopZ path_var = path;
10950         uint64_tArray path_arr = NULL;
10951         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
10952         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
10953         for (size_t k = 0; k < path_var.datalen; k++) {
10954                 LDKRouteHop path_conv_10_var = path_var.data[k];
10955                 uint64_t path_conv_10_ref = 0;
10956                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10957                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
10958                 path_arr_ptr[k] = path_conv_10_ref;
10959         }
10960         
10961         FREE(path_var.data);
10962         int64_t short_channel_id_conv = short_channel_id;
10963         js_invoke_function_ubuuuu(j_calls->instance_ptr, 115, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0);
10964 }
10965 void notify_payment_path_successful_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path) {
10966         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10967         LDKCVec_RouteHopZ path_var = path;
10968         uint64_tArray path_arr = NULL;
10969         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
10970         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
10971         for (size_t k = 0; k < path_var.datalen; k++) {
10972                 LDKRouteHop path_conv_10_var = path_var.data[k];
10973                 uint64_t path_conv_10_ref = 0;
10974                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10975                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
10976                 path_arr_ptr[k] = path_conv_10_ref;
10977         }
10978         
10979         FREE(path_var.data);
10980         js_invoke_function_uuuuuu(j_calls->instance_ptr, 116, (uint32_t)path_arr, 0, 0, 0, 0, 0);
10981 }
10982 void notify_payment_probe_successful_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path) {
10983         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10984         LDKCVec_RouteHopZ path_var = path;
10985         uint64_tArray path_arr = NULL;
10986         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
10987         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
10988         for (size_t k = 0; k < path_var.datalen; k++) {
10989                 LDKRouteHop path_conv_10_var = path_var.data[k];
10990                 uint64_t path_conv_10_ref = 0;
10991                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10992                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
10993                 path_arr_ptr[k] = path_conv_10_ref;
10994         }
10995         
10996         FREE(path_var.data);
10997         js_invoke_function_uuuuuu(j_calls->instance_ptr, 117, (uint32_t)path_arr, 0, 0, 0, 0, 0);
10998 }
10999 void notify_payment_probe_failed_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
11000         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
11001         LDKCVec_RouteHopZ path_var = path;
11002         uint64_tArray path_arr = NULL;
11003         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
11004         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
11005         for (size_t k = 0; k < path_var.datalen; k++) {
11006                 LDKRouteHop path_conv_10_var = path_var.data[k];
11007                 uint64_t path_conv_10_ref = 0;
11008                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
11009                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
11010                 path_arr_ptr[k] = path_conv_10_ref;
11011         }
11012         
11013         FREE(path_var.data);
11014         int64_t short_channel_id_conv = short_channel_id;
11015         js_invoke_function_ubuuuu(j_calls->instance_ptr, 118, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0);
11016 }
11017 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
11018         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
11019         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11020 }
11021 static inline LDKRouter LDKRouter_init (JSValue o) {
11022         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
11023         atomic_init(&calls->refcnt, 1);
11024         calls->instance_ptr = o;
11025
11026         LDKRouter ret = {
11027                 .this_arg = (void*) calls,
11028                 .find_route = find_route_LDKRouter_jcall,
11029                 .find_route_with_id = find_route_with_id_LDKRouter_jcall,
11030                 .notify_payment_path_failed = notify_payment_path_failed_LDKRouter_jcall,
11031                 .notify_payment_path_successful = notify_payment_path_successful_LDKRouter_jcall,
11032                 .notify_payment_probe_successful = notify_payment_probe_successful_LDKRouter_jcall,
11033                 .notify_payment_probe_failed = notify_payment_probe_failed_LDKRouter_jcall,
11034                 .free = LDKRouter_JCalls_free,
11035         };
11036         return ret;
11037 }
11038 uint64_t  __attribute__((export_name("TS_LDKRouter_new"))) TS_LDKRouter_new(JSValue o) {
11039         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
11040         *res_ptr = LDKRouter_init(o);
11041         return tag_ptr(res_ptr, true);
11042 }
11043 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) {
11044         void* this_arg_ptr = untag_ptr(this_arg);
11045         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11046         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
11047         LDKPublicKey payer_ref;
11048         CHECK(payer->arr_len == 33);
11049         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
11050         LDKRouteParameters route_params_conv;
11051         route_params_conv.inner = untag_ptr(route_params);
11052         route_params_conv.is_owned = ptr_is_owned(route_params);
11053         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
11054         route_params_conv.is_owned = false;
11055         LDKCVec_ChannelDetailsZ first_hops_constr;
11056         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
11057         if (first_hops != 0) {
11058                 first_hops_constr.datalen = first_hops->arr_len;
11059                 if (first_hops_constr.datalen > 0)
11060                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
11061                 else
11062                         first_hops_constr.data = NULL;
11063                 uint64_t* first_hops_vals = first_hops->elems;
11064                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
11065                         uint64_t first_hops_conv_16 = first_hops_vals[q];
11066                         LDKChannelDetails first_hops_conv_16_conv;
11067                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
11068                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
11069                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
11070                         first_hops_conv_16_conv.is_owned = false;
11071                         first_hops_constr.data[q] = first_hops_conv_16_conv;
11072                 }
11073                 FREE(first_hops);
11074                 first_hops_ptr = &first_hops_constr;
11075         }
11076         LDKInFlightHtlcs inflight_htlcs_conv;
11077         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
11078         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
11079         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
11080         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
11081         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11082         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv);
11083         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
11084         return tag_ptr(ret_conv, true);
11085 }
11086
11087 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) {
11088         void* this_arg_ptr = untag_ptr(this_arg);
11089         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11090         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
11091         LDKPublicKey payer_ref;
11092         CHECK(payer->arr_len == 33);
11093         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
11094         LDKRouteParameters route_params_conv;
11095         route_params_conv.inner = untag_ptr(route_params);
11096         route_params_conv.is_owned = ptr_is_owned(route_params);
11097         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
11098         route_params_conv.is_owned = false;
11099         LDKCVec_ChannelDetailsZ first_hops_constr;
11100         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
11101         if (first_hops != 0) {
11102                 first_hops_constr.datalen = first_hops->arr_len;
11103                 if (first_hops_constr.datalen > 0)
11104                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
11105                 else
11106                         first_hops_constr.data = NULL;
11107                 uint64_t* first_hops_vals = first_hops->elems;
11108                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
11109                         uint64_t first_hops_conv_16 = first_hops_vals[q];
11110                         LDKChannelDetails first_hops_conv_16_conv;
11111                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
11112                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
11113                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
11114                         first_hops_conv_16_conv.is_owned = false;
11115                         first_hops_constr.data[q] = first_hops_conv_16_conv;
11116                 }
11117                 FREE(first_hops);
11118                 first_hops_ptr = &first_hops_constr;
11119         }
11120         LDKInFlightHtlcs inflight_htlcs_conv;
11121         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
11122         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
11123         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
11124         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
11125         LDKThirtyTwoBytes _payment_hash_ref;
11126         CHECK(_payment_hash->arr_len == 32);
11127         memcpy(_payment_hash_ref.data, _payment_hash->elems, 32); FREE(_payment_hash);
11128         LDKThirtyTwoBytes _payment_id_ref;
11129         CHECK(_payment_id->arr_len == 32);
11130         memcpy(_payment_id_ref.data, _payment_id->elems, 32); FREE(_payment_id);
11131         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11132         *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);
11133         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
11134         return tag_ptr(ret_conv, true);
11135 }
11136
11137 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) {
11138         void* this_arg_ptr = untag_ptr(this_arg);
11139         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11140         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
11141         LDKCVec_RouteHopZ path_constr;
11142         path_constr.datalen = path->arr_len;
11143         if (path_constr.datalen > 0)
11144                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11145         else
11146                 path_constr.data = NULL;
11147         uint64_t* path_vals = path->elems;
11148         for (size_t k = 0; k < path_constr.datalen; k++) {
11149                 uint64_t path_conv_10 = path_vals[k];
11150                 LDKRouteHop path_conv_10_conv;
11151                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
11152                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
11153                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
11154                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
11155                 path_constr.data[k] = path_conv_10_conv;
11156         }
11157         FREE(path);
11158         (this_arg_conv->notify_payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
11159 }
11160
11161 void  __attribute__((export_name("TS_Router_notify_payment_path_successful"))) TS_Router_notify_payment_path_successful(uint64_t this_arg, uint64_tArray path) {
11162         void* this_arg_ptr = untag_ptr(this_arg);
11163         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11164         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
11165         LDKCVec_RouteHopZ path_constr;
11166         path_constr.datalen = path->arr_len;
11167         if (path_constr.datalen > 0)
11168                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11169         else
11170                 path_constr.data = NULL;
11171         uint64_t* path_vals = path->elems;
11172         for (size_t k = 0; k < path_constr.datalen; k++) {
11173                 uint64_t path_conv_10 = path_vals[k];
11174                 LDKRouteHop path_conv_10_conv;
11175                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
11176                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
11177                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
11178                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
11179                 path_constr.data[k] = path_conv_10_conv;
11180         }
11181         FREE(path);
11182         (this_arg_conv->notify_payment_path_successful)(this_arg_conv->this_arg, path_constr);
11183 }
11184
11185 void  __attribute__((export_name("TS_Router_notify_payment_probe_successful"))) TS_Router_notify_payment_probe_successful(uint64_t this_arg, uint64_tArray path) {
11186         void* this_arg_ptr = untag_ptr(this_arg);
11187         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11188         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
11189         LDKCVec_RouteHopZ path_constr;
11190         path_constr.datalen = path->arr_len;
11191         if (path_constr.datalen > 0)
11192                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11193         else
11194                 path_constr.data = NULL;
11195         uint64_t* path_vals = path->elems;
11196         for (size_t k = 0; k < path_constr.datalen; k++) {
11197                 uint64_t path_conv_10 = path_vals[k];
11198                 LDKRouteHop path_conv_10_conv;
11199                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
11200                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
11201                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
11202                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
11203                 path_constr.data[k] = path_conv_10_conv;
11204         }
11205         FREE(path);
11206         (this_arg_conv->notify_payment_probe_successful)(this_arg_conv->this_arg, path_constr);
11207 }
11208
11209 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) {
11210         void* this_arg_ptr = untag_ptr(this_arg);
11211         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11212         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
11213         LDKCVec_RouteHopZ path_constr;
11214         path_constr.datalen = path->arr_len;
11215         if (path_constr.datalen > 0)
11216                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11217         else
11218                 path_constr.data = NULL;
11219         uint64_t* path_vals = path->elems;
11220         for (size_t k = 0; k < path_constr.datalen; k++) {
11221                 uint64_t path_conv_10 = path_vals[k];
11222                 LDKRouteHop path_conv_10_conv;
11223                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
11224                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
11225                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
11226                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
11227                 path_constr.data[k] = path_conv_10_conv;
11228         }
11229         FREE(path);
11230         (this_arg_conv->notify_payment_probe_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
11231 }
11232
11233 uint32_t __attribute__((export_name("TS_LDKDestination_ty_from_ptr"))) TS_LDKDestination_ty_from_ptr(uint64_t ptr) {
11234         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
11235         switch(obj->tag) {
11236                 case LDKDestination_Node: return 0;
11237                 case LDKDestination_BlindedPath: return 1;
11238                 default: abort();
11239         }
11240 }
11241 int8_tArray __attribute__((export_name("TS_LDKDestination_Node_get_node"))) TS_LDKDestination_Node_get_node(uint64_t ptr) {
11242         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
11243         assert(obj->tag == LDKDestination_Node);
11244                         int8_tArray node_arr = init_int8_tArray(33, __LINE__);
11245                         memcpy(node_arr->elems, obj->node.compressed_form, 33);
11246         return node_arr;
11247 }
11248 uint64_t __attribute__((export_name("TS_LDKDestination_BlindedPath_get_blinded_path"))) TS_LDKDestination_BlindedPath_get_blinded_path(uint64_t ptr) {
11249         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
11250         assert(obj->tag == LDKDestination_BlindedPath);
11251                         LDKBlindedPath blinded_path_var = obj->blinded_path;
11252                         uint64_t blinded_path_ref = 0;
11253                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var);
11254                         blinded_path_ref = tag_ptr(blinded_path_var.inner, false);
11255         return blinded_path_ref;
11256 }
11257 uint32_t __attribute__((export_name("TS_LDKOnionMessageContents_ty_from_ptr"))) TS_LDKOnionMessageContents_ty_from_ptr(uint64_t ptr) {
11258         LDKOnionMessageContents *obj = (LDKOnionMessageContents*)untag_ptr(ptr);
11259         switch(obj->tag) {
11260                 case LDKOnionMessageContents_Custom: return 0;
11261                 default: abort();
11262         }
11263 }
11264 uint64_t __attribute__((export_name("TS_LDKOnionMessageContents_Custom_get_custom"))) TS_LDKOnionMessageContents_Custom_get_custom(uint64_t ptr) {
11265         LDKOnionMessageContents *obj = (LDKOnionMessageContents*)untag_ptr(ptr);
11266         assert(obj->tag == LDKOnionMessageContents_Custom);
11267                         LDKCustomOnionMessageContents* custom_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
11268                         *custom_ret = CustomOnionMessageContents_clone(&obj->custom);
11269         return tag_ptr(custom_ret, true);
11270 }
11271 uint32_t __attribute__((export_name("TS_LDKFallback_ty_from_ptr"))) TS_LDKFallback_ty_from_ptr(uint64_t ptr) {
11272         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
11273         switch(obj->tag) {
11274                 case LDKFallback_SegWitProgram: return 0;
11275                 case LDKFallback_PubKeyHash: return 1;
11276                 case LDKFallback_ScriptHash: return 2;
11277                 default: abort();
11278         }
11279 }
11280 int8_t __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_version"))) TS_LDKFallback_SegWitProgram_get_version(uint64_t ptr) {
11281         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
11282         assert(obj->tag == LDKFallback_SegWitProgram);
11283                         uint8_t version_val = obj->seg_wit_program.version._0;
11284         return version_val;
11285 }
11286 int8_tArray __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_program"))) TS_LDKFallback_SegWitProgram_get_program(uint64_t ptr) {
11287         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
11288         assert(obj->tag == LDKFallback_SegWitProgram);
11289                         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
11290                         int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__);
11291                         memcpy(program_arr->elems, program_var.data, program_var.datalen);
11292         return program_arr;
11293 }
11294 int8_tArray __attribute__((export_name("TS_LDKFallback_PubKeyHash_get_pub_key_hash"))) TS_LDKFallback_PubKeyHash_get_pub_key_hash(uint64_t ptr) {
11295         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
11296         assert(obj->tag == LDKFallback_PubKeyHash);
11297                         int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__);
11298                         memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20);
11299         return pub_key_hash_arr;
11300 }
11301 int8_tArray __attribute__((export_name("TS_LDKFallback_ScriptHash_get_script_hash"))) TS_LDKFallback_ScriptHash_get_script_hash(uint64_t ptr) {
11302         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
11303         assert(obj->tag == LDKFallback_ScriptHash);
11304                         int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__);
11305                         memcpy(script_hash_arr->elems, obj->script_hash.data, 20);
11306         return script_hash_arr;
11307 }
11308 typedef struct LDKPayer_JCalls {
11309         atomic_size_t refcnt;
11310         uint32_t instance_ptr;
11311 } LDKPayer_JCalls;
11312 static void LDKPayer_JCalls_free(void* this_arg) {
11313         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
11314         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11315                 FREE(j_calls);
11316         }
11317 }
11318 LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) {
11319         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
11320         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 119, 0, 0, 0, 0, 0, 0);
11321         LDKPublicKey ret_ref;
11322         CHECK(ret->arr_len == 33);
11323         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
11324         return ret_ref;
11325 }
11326 LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) {
11327         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
11328         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 120, 0, 0, 0, 0, 0, 0);
11329         LDKCVec_ChannelDetailsZ ret_constr;
11330         ret_constr.datalen = ret->arr_len;
11331         if (ret_constr.datalen > 0)
11332                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
11333         else
11334                 ret_constr.data = NULL;
11335         uint64_t* ret_vals = ret->elems;
11336         for (size_t q = 0; q < ret_constr.datalen; q++) {
11337                 uint64_t ret_conv_16 = ret_vals[q];
11338                 LDKChannelDetails ret_conv_16_conv;
11339                 ret_conv_16_conv.inner = untag_ptr(ret_conv_16);
11340                 ret_conv_16_conv.is_owned = ptr_is_owned(ret_conv_16);
11341                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv);
11342                 ret_constr.data[q] = ret_conv_16_conv;
11343         }
11344         FREE(ret);
11345         return ret_constr;
11346 }
11347 LDKCResult_NonePaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret, LDKThirtyTwoBytes payment_id) {
11348         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
11349         LDKRoute route_var = *route;
11350         uint64_t route_ref = 0;
11351         route_var = Route_clone(&route_var);
11352         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
11353         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
11354         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
11355         memcpy(payment_hash_arr->elems, payment_hash.data, 32);
11356         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
11357         memcpy(payment_secret_arr->elems, payment_secret.data, 32);
11358         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11359         memcpy(payment_id_arr->elems, payment_id.data, 32);
11360         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);
11361         void* ret_ptr = untag_ptr(ret);
11362         CHECK_ACCESS(ret_ptr);
11363         LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
11364         FREE(untag_ptr(ret));
11365         return ret_conv;
11366 }
11367 LDKCResult_NonePaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage, LDKThirtyTwoBytes payment_id) {
11368         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
11369         LDKRoute route_var = *route;
11370         uint64_t route_ref = 0;
11371         route_var = Route_clone(&route_var);
11372         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
11373         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
11374         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
11375         memcpy(payment_preimage_arr->elems, payment_preimage.data, 32);
11376         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11377         memcpy(payment_id_arr->elems, payment_id.data, 32);
11378         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);
11379         void* ret_ptr = untag_ptr(ret);
11380         CHECK_ACCESS(ret_ptr);
11381         LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
11382         FREE(untag_ptr(ret));
11383         return ret_conv;
11384 }
11385 LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) {
11386         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
11387         LDKRoute route_var = *route;
11388         uint64_t route_ref = 0;
11389         route_var = Route_clone(&route_var);
11390         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
11391         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
11392         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11393         memcpy(payment_id_arr->elems, payment_id.data, 32);
11394         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 123, route_ref, (uint32_t)payment_id_arr, 0, 0, 0, 0);
11395         void* ret_ptr = untag_ptr(ret);
11396         CHECK_ACCESS(ret_ptr);
11397         LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
11398         FREE(untag_ptr(ret));
11399         return ret_conv;
11400 }
11401 void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) {
11402         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
11403         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
11404         memcpy(payment_id_arr->elems, payment_id.data, 32);
11405         js_invoke_function_uuuuuu(j_calls->instance_ptr, 124, (uint32_t)payment_id_arr, 0, 0, 0, 0, 0);
11406 }
11407 LDKInFlightHtlcs inflight_htlcs_LDKPayer_jcall(const void* this_arg) {
11408         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
11409         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 125, 0, 0, 0, 0, 0, 0);
11410         LDKInFlightHtlcs ret_conv;
11411         ret_conv.inner = untag_ptr(ret);
11412         ret_conv.is_owned = ptr_is_owned(ret);
11413         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
11414         return ret_conv;
11415 }
11416 static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) {
11417         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg;
11418         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11419 }
11420 static inline LDKPayer LDKPayer_init (JSValue o) {
11421         LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls");
11422         atomic_init(&calls->refcnt, 1);
11423         calls->instance_ptr = o;
11424
11425         LDKPayer ret = {
11426                 .this_arg = (void*) calls,
11427                 .node_id = node_id_LDKPayer_jcall,
11428                 .first_hops = first_hops_LDKPayer_jcall,
11429                 .send_payment = send_payment_LDKPayer_jcall,
11430                 .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall,
11431                 .retry_payment = retry_payment_LDKPayer_jcall,
11432                 .abandon_payment = abandon_payment_LDKPayer_jcall,
11433                 .inflight_htlcs = inflight_htlcs_LDKPayer_jcall,
11434                 .free = LDKPayer_JCalls_free,
11435         };
11436         return ret;
11437 }
11438 uint64_t  __attribute__((export_name("TS_LDKPayer_new"))) TS_LDKPayer_new(JSValue o) {
11439         LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer");
11440         *res_ptr = LDKPayer_init(o);
11441         return tag_ptr(res_ptr, true);
11442 }
11443 int8_tArray  __attribute__((export_name("TS_Payer_node_id"))) TS_Payer_node_id(uint64_t this_arg) {
11444         void* this_arg_ptr = untag_ptr(this_arg);
11445         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11446         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
11447         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
11448         memcpy(ret_arr->elems, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form, 33);
11449         return ret_arr;
11450 }
11451
11452 uint64_tArray  __attribute__((export_name("TS_Payer_first_hops"))) TS_Payer_first_hops(uint64_t this_arg) {
11453         void* this_arg_ptr = untag_ptr(this_arg);
11454         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11455         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
11456         LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg);
11457         uint64_tArray ret_arr = NULL;
11458         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
11459         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
11460         for (size_t q = 0; q < ret_var.datalen; q++) {
11461                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
11462                 uint64_t ret_conv_16_ref = 0;
11463                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
11464                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
11465                 ret_arr_ptr[q] = ret_conv_16_ref;
11466         }
11467         
11468         FREE(ret_var.data);
11469         return ret_arr;
11470 }
11471
11472 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) {
11473         void* this_arg_ptr = untag_ptr(this_arg);
11474         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11475         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
11476         LDKRoute route_conv;
11477         route_conv.inner = untag_ptr(route);
11478         route_conv.is_owned = ptr_is_owned(route);
11479         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
11480         route_conv.is_owned = false;
11481         LDKThirtyTwoBytes payment_hash_ref;
11482         CHECK(payment_hash->arr_len == 32);
11483         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
11484         LDKThirtyTwoBytes payment_secret_ref;
11485         CHECK(payment_secret->arr_len == 32);
11486         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
11487         LDKThirtyTwoBytes payment_id_ref;
11488         CHECK(payment_id->arr_len == 32);
11489         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
11490         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11491         *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref, payment_id_ref);
11492         return tag_ptr(ret_conv, true);
11493 }
11494
11495 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) {
11496         void* this_arg_ptr = untag_ptr(this_arg);
11497         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11498         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
11499         LDKRoute route_conv;
11500         route_conv.inner = untag_ptr(route);
11501         route_conv.is_owned = ptr_is_owned(route);
11502         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
11503         route_conv.is_owned = false;
11504         LDKThirtyTwoBytes payment_preimage_ref;
11505         CHECK(payment_preimage->arr_len == 32);
11506         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
11507         LDKThirtyTwoBytes payment_id_ref;
11508         CHECK(payment_id->arr_len == 32);
11509         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
11510         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11511         *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref, payment_id_ref);
11512         return tag_ptr(ret_conv, true);
11513 }
11514
11515 uint64_t  __attribute__((export_name("TS_Payer_retry_payment"))) TS_Payer_retry_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_id) {
11516         void* this_arg_ptr = untag_ptr(this_arg);
11517         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11518         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
11519         LDKRoute route_conv;
11520         route_conv.inner = untag_ptr(route);
11521         route_conv.is_owned = ptr_is_owned(route);
11522         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
11523         route_conv.is_owned = false;
11524         LDKThirtyTwoBytes payment_id_ref;
11525         CHECK(payment_id->arr_len == 32);
11526         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
11527         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
11528         *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref);
11529         return tag_ptr(ret_conv, true);
11530 }
11531
11532 void  __attribute__((export_name("TS_Payer_abandon_payment"))) TS_Payer_abandon_payment(uint64_t this_arg, int8_tArray payment_id) {
11533         void* this_arg_ptr = untag_ptr(this_arg);
11534         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11535         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
11536         LDKThirtyTwoBytes payment_id_ref;
11537         CHECK(payment_id->arr_len == 32);
11538         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
11539         (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref);
11540 }
11541
11542 uint64_t  __attribute__((export_name("TS_Payer_inflight_htlcs"))) TS_Payer_inflight_htlcs(uint64_t this_arg) {
11543         void* this_arg_ptr = untag_ptr(this_arg);
11544         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11545         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
11546         LDKInFlightHtlcs ret_var = (this_arg_conv->inflight_htlcs)(this_arg_conv->this_arg);
11547         uint64_t ret_ref = 0;
11548         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11549         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11550         return ret_ref;
11551 }
11552
11553 uint32_t __attribute__((export_name("TS_LDKRetry_ty_from_ptr"))) TS_LDKRetry_ty_from_ptr(uint64_t ptr) {
11554         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
11555         switch(obj->tag) {
11556                 case LDKRetry_Attempts: return 0;
11557                 default: abort();
11558         }
11559 }
11560 uint32_t __attribute__((export_name("TS_LDKRetry_Attempts_get_attempts"))) TS_LDKRetry_Attempts_get_attempts(uint64_t ptr) {
11561         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
11562         assert(obj->tag == LDKRetry_Attempts);
11563                         uint32_t attempts_conv = obj->attempts;
11564         return attempts_conv;
11565 }
11566 jstring  __attribute__((export_name("TS__ldk_get_compiled_version"))) TS__ldk_get_compiled_version() {
11567         LDKStr ret_str = _ldk_get_compiled_version();
11568         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
11569         Str_free(ret_str);
11570         return ret_conv;
11571 }
11572
11573 jstring  __attribute__((export_name("TS__ldk_c_bindings_get_compiled_version"))) TS__ldk_c_bindings_get_compiled_version() {
11574         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
11575         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
11576         Str_free(ret_str);
11577         return ret_conv;
11578 }
11579
11580 int8_tArray  __attribute__((export_name("TS_U128_le_bytes"))) TS_U128_le_bytes(int8_tArray val) {
11581         LDKU128 val_ref;
11582         CHECK(val->arr_len == 16);
11583         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
11584         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
11585         memcpy(ret_arr->elems, U128_le_bytes(val_ref).data, 16);
11586         return ret_arr;
11587 }
11588
11589 int8_tArray  __attribute__((export_name("TS_U128_new"))) TS_U128_new(int8_tArray le_bytes) {
11590         LDKSixteenBytes le_bytes_ref;
11591         CHECK(le_bytes->arr_len == 16);
11592         memcpy(le_bytes_ref.data, le_bytes->elems, 16); FREE(le_bytes);
11593         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
11594         memcpy(ret_arr->elems, U128_new(le_bytes_ref).le_bytes, 16);
11595         return ret_arr;
11596 }
11597
11598 uint64_t  __attribute__((export_name("TS_BigEndianScalar_new"))) TS_BigEndianScalar_new(int8_tArray big_endian_bytes) {
11599         LDKThirtyTwoBytes big_endian_bytes_ref;
11600         CHECK(big_endian_bytes->arr_len == 32);
11601         memcpy(big_endian_bytes_ref.data, big_endian_bytes->elems, 32); FREE(big_endian_bytes);
11602         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
11603         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
11604         return tag_ptr(ret_ref, true);
11605 }
11606
11607 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
11608         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
11609         *ret_copy = Bech32Error_clone(arg);
11610         uint64_t ret_ref = tag_ptr(ret_copy, true);
11611         return ret_ref;
11612 }
11613 int64_t  __attribute__((export_name("TS_Bech32Error_clone_ptr"))) TS_Bech32Error_clone_ptr(uint64_t arg) {
11614         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
11615         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
11616         return ret_conv;
11617 }
11618
11619 uint64_t  __attribute__((export_name("TS_Bech32Error_clone"))) TS_Bech32Error_clone(uint64_t orig) {
11620         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
11621         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
11622         *ret_copy = Bech32Error_clone(orig_conv);
11623         uint64_t ret_ref = tag_ptr(ret_copy, true);
11624         return ret_ref;
11625 }
11626
11627 void  __attribute__((export_name("TS_Bech32Error_free"))) TS_Bech32Error_free(uint64_t o) {
11628         if (!ptr_is_owned(o)) return;
11629         void* o_ptr = untag_ptr(o);
11630         CHECK_ACCESS(o_ptr);
11631         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
11632         FREE(untag_ptr(o));
11633         Bech32Error_free(o_conv);
11634 }
11635
11636 void  __attribute__((export_name("TS_Transaction_free"))) TS_Transaction_free(int8_tArray _res) {
11637         LDKTransaction _res_ref;
11638         _res_ref.datalen = _res->arr_len;
11639         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
11640         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
11641         _res_ref.data_is_owned = true;
11642         Transaction_free(_res_ref);
11643 }
11644
11645 void  __attribute__((export_name("TS_Witness_free"))) TS_Witness_free(int8_tArray _res) {
11646         LDKWitness _res_ref;
11647         _res_ref.datalen = _res->arr_len;
11648         _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes");
11649         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
11650         _res_ref.data_is_owned = true;
11651         Witness_free(_res_ref);
11652 }
11653
11654 uint64_t  __attribute__((export_name("TS_TxOut_new"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
11655         LDKCVec_u8Z script_pubkey_ref;
11656         script_pubkey_ref.datalen = script_pubkey->arr_len;
11657         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
11658         memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen); FREE(script_pubkey);
11659         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11660         *ret_ref = TxOut_new(script_pubkey_ref, value);
11661         return tag_ptr(ret_ref, true);
11662 }
11663
11664 void  __attribute__((export_name("TS_TxOut_free"))) TS_TxOut_free(uint64_t _res) {
11665         if (!ptr_is_owned(_res)) return;
11666         void* _res_ptr = untag_ptr(_res);
11667         CHECK_ACCESS(_res_ptr);
11668         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
11669         FREE(untag_ptr(_res));
11670         TxOut_free(_res_conv);
11671 }
11672
11673 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
11674         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11675         *ret_ref = TxOut_clone(arg);
11676         return tag_ptr(ret_ref, true);
11677 }
11678 int64_t  __attribute__((export_name("TS_TxOut_clone_ptr"))) TS_TxOut_clone_ptr(uint64_t arg) {
11679         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
11680         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
11681         return ret_conv;
11682 }
11683
11684 uint64_t  __attribute__((export_name("TS_TxOut_clone"))) TS_TxOut_clone(uint64_t orig) {
11685         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
11686         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11687         *ret_ref = TxOut_clone(orig_conv);
11688         return tag_ptr(ret_ref, true);
11689 }
11690
11691 void  __attribute__((export_name("TS_Str_free"))) TS_Str_free(jstring _res) {
11692         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
11693         Str_free(dummy);
11694 }
11695
11696 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_some"))) TS_COption_HTLCClaimZ_some(uint32_t o) {
11697         LDKHTLCClaim o_conv = LDKHTLCClaim_from_js(o);
11698         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
11699         *ret_copy = COption_HTLCClaimZ_some(o_conv);
11700         uint64_t ret_ref = tag_ptr(ret_copy, true);
11701         return ret_ref;
11702 }
11703
11704 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_none"))) TS_COption_HTLCClaimZ_none() {
11705         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
11706         *ret_copy = COption_HTLCClaimZ_none();
11707         uint64_t ret_ref = tag_ptr(ret_copy, true);
11708         return ret_ref;
11709 }
11710
11711 void  __attribute__((export_name("TS_COption_HTLCClaimZ_free"))) TS_COption_HTLCClaimZ_free(uint64_t _res) {
11712         if (!ptr_is_owned(_res)) return;
11713         void* _res_ptr = untag_ptr(_res);
11714         CHECK_ACCESS(_res_ptr);
11715         LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr);
11716         FREE(untag_ptr(_res));
11717         COption_HTLCClaimZ_free(_res_conv);
11718 }
11719
11720 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_ok"))) TS_CResult_NoneNoneZ_ok() {
11721         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11722         *ret_conv = CResult_NoneNoneZ_ok();
11723         return tag_ptr(ret_conv, true);
11724 }
11725
11726 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_err"))) TS_CResult_NoneNoneZ_err() {
11727         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11728         *ret_conv = CResult_NoneNoneZ_err();
11729         return tag_ptr(ret_conv, true);
11730 }
11731
11732 jboolean  __attribute__((export_name("TS_CResult_NoneNoneZ_is_ok"))) TS_CResult_NoneNoneZ_is_ok(uint64_t o) {
11733         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
11734         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
11735         return ret_conv;
11736 }
11737
11738 void  __attribute__((export_name("TS_CResult_NoneNoneZ_free"))) TS_CResult_NoneNoneZ_free(uint64_t _res) {
11739         if (!ptr_is_owned(_res)) return;
11740         void* _res_ptr = untag_ptr(_res);
11741         CHECK_ACCESS(_res_ptr);
11742         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
11743         FREE(untag_ptr(_res));
11744         CResult_NoneNoneZ_free(_res_conv);
11745 }
11746
11747 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
11748         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11749         *ret_conv = CResult_NoneNoneZ_clone(arg);
11750         return tag_ptr(ret_conv, true);
11751 }
11752 int64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone_ptr"))) TS_CResult_NoneNoneZ_clone_ptr(uint64_t arg) {
11753         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
11754         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
11755         return ret_conv;
11756 }
11757
11758 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone"))) TS_CResult_NoneNoneZ_clone(uint64_t orig) {
11759         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
11760         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11761         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
11762         return tag_ptr(ret_conv, true);
11763 }
11764
11765 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(uint64_t o) {
11766         LDKCounterpartyCommitmentSecrets o_conv;
11767         o_conv.inner = untag_ptr(o);
11768         o_conv.is_owned = ptr_is_owned(o);
11769         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11770         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
11771         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11772         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
11773         return tag_ptr(ret_conv, true);
11774 }
11775
11776 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(uint64_t e) {
11777         void* e_ptr = untag_ptr(e);
11778         CHECK_ACCESS(e_ptr);
11779         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
11780         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
11781         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11782         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
11783         return tag_ptr(ret_conv, true);
11784 }
11785
11786 jboolean  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(uint64_t o) {
11787         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
11788         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
11789         return ret_conv;
11790 }
11791
11792 void  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(uint64_t _res) {
11793         if (!ptr_is_owned(_res)) return;
11794         void* _res_ptr = untag_ptr(_res);
11795         CHECK_ACCESS(_res_ptr);
11796         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
11797         FREE(untag_ptr(_res));
11798         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
11799 }
11800
11801 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
11802         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11803         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
11804         return tag_ptr(ret_conv, true);
11805 }
11806 int64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(uint64_t arg) {
11807         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
11808         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
11809         return ret_conv;
11810 }
11811
11812 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(uint64_t orig) {
11813         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
11814         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11815         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
11816         return tag_ptr(ret_conv, true);
11817 }
11818
11819 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint64_t o) {
11820         LDKTxCreationKeys o_conv;
11821         o_conv.inner = untag_ptr(o);
11822         o_conv.is_owned = ptr_is_owned(o);
11823         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11824         o_conv = TxCreationKeys_clone(&o_conv);
11825         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11826         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
11827         return tag_ptr(ret_conv, true);
11828 }
11829
11830 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint64_t e) {
11831         void* e_ptr = untag_ptr(e);
11832         CHECK_ACCESS(e_ptr);
11833         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
11834         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
11835         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11836         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
11837         return tag_ptr(ret_conv, true);
11838 }
11839
11840 jboolean  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_is_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint64_t o) {
11841         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
11842         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
11843         return ret_conv;
11844 }
11845
11846 void  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_free"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint64_t _res) {
11847         if (!ptr_is_owned(_res)) return;
11848         void* _res_ptr = untag_ptr(_res);
11849         CHECK_ACCESS(_res_ptr);
11850         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
11851         FREE(untag_ptr(_res));
11852         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
11853 }
11854
11855 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
11856         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11857         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
11858         return tag_ptr(ret_conv, true);
11859 }
11860 int64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
11861         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
11862         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
11863         return ret_conv;
11864 }
11865
11866 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint64_t orig) {
11867         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
11868         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11869         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
11870         return tag_ptr(ret_conv, true);
11871 }
11872
11873 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint64_t o) {
11874         LDKChannelPublicKeys o_conv;
11875         o_conv.inner = untag_ptr(o);
11876         o_conv.is_owned = ptr_is_owned(o);
11877         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11878         o_conv = ChannelPublicKeys_clone(&o_conv);
11879         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11880         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
11881         return tag_ptr(ret_conv, true);
11882 }
11883
11884 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint64_t e) {
11885         void* e_ptr = untag_ptr(e);
11886         CHECK_ACCESS(e_ptr);
11887         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
11888         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
11889         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11890         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
11891         return tag_ptr(ret_conv, true);
11892 }
11893
11894 jboolean  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint64_t o) {
11895         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
11896         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
11897         return ret_conv;
11898 }
11899
11900 void  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_free"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint64_t _res) {
11901         if (!ptr_is_owned(_res)) return;
11902         void* _res_ptr = untag_ptr(_res);
11903         CHECK_ACCESS(_res_ptr);
11904         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
11905         FREE(untag_ptr(_res));
11906         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
11907 }
11908
11909 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
11910         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11911         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
11912         return tag_ptr(ret_conv, true);
11913 }
11914 int64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
11915         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
11916         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
11917         return ret_conv;
11918 }
11919
11920 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint64_t orig) {
11921         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
11922         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11923         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
11924         return tag_ptr(ret_conv, true);
11925 }
11926
11927 uint64_t  __attribute__((export_name("TS_COption_u32Z_some"))) TS_COption_u32Z_some(int32_t o) {
11928         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11929         *ret_copy = COption_u32Z_some(o);
11930         uint64_t ret_ref = tag_ptr(ret_copy, true);
11931         return ret_ref;
11932 }
11933
11934 uint64_t  __attribute__((export_name("TS_COption_u32Z_none"))) TS_COption_u32Z_none() {
11935         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11936         *ret_copy = COption_u32Z_none();
11937         uint64_t ret_ref = tag_ptr(ret_copy, true);
11938         return ret_ref;
11939 }
11940
11941 void  __attribute__((export_name("TS_COption_u32Z_free"))) TS_COption_u32Z_free(uint64_t _res) {
11942         if (!ptr_is_owned(_res)) return;
11943         void* _res_ptr = untag_ptr(_res);
11944         CHECK_ACCESS(_res_ptr);
11945         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
11946         FREE(untag_ptr(_res));
11947         COption_u32Z_free(_res_conv);
11948 }
11949
11950 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
11951         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11952         *ret_copy = COption_u32Z_clone(arg);
11953         uint64_t ret_ref = tag_ptr(ret_copy, true);
11954         return ret_ref;
11955 }
11956 int64_t  __attribute__((export_name("TS_COption_u32Z_clone_ptr"))) TS_COption_u32Z_clone_ptr(uint64_t arg) {
11957         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
11958         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
11959         return ret_conv;
11960 }
11961
11962 uint64_t  __attribute__((export_name("TS_COption_u32Z_clone"))) TS_COption_u32Z_clone(uint64_t orig) {
11963         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
11964         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11965         *ret_copy = COption_u32Z_clone(orig_conv);
11966         uint64_t ret_ref = tag_ptr(ret_copy, true);
11967         return ret_ref;
11968 }
11969
11970 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint64_t o) {
11971         LDKHTLCOutputInCommitment o_conv;
11972         o_conv.inner = untag_ptr(o);
11973         o_conv.is_owned = ptr_is_owned(o);
11974         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11975         o_conv = HTLCOutputInCommitment_clone(&o_conv);
11976         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11977         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
11978         return tag_ptr(ret_conv, true);
11979 }
11980
11981 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint64_t e) {
11982         void* e_ptr = untag_ptr(e);
11983         CHECK_ACCESS(e_ptr);
11984         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
11985         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
11986         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11987         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
11988         return tag_ptr(ret_conv, true);
11989 }
11990
11991 jboolean  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint64_t o) {
11992         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
11993         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
11994         return ret_conv;
11995 }
11996
11997 void  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint64_t _res) {
11998         if (!ptr_is_owned(_res)) return;
11999         void* _res_ptr = untag_ptr(_res);
12000         CHECK_ACCESS(_res_ptr);
12001         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
12002         FREE(untag_ptr(_res));
12003         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
12004 }
12005
12006 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
12007         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
12008         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
12009         return tag_ptr(ret_conv, true);
12010 }
12011 int64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint64_t arg) {
12012         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
12013         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
12014         return ret_conv;
12015 }
12016
12017 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint64_t orig) {
12018         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
12019         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
12020         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
12021         return tag_ptr(ret_conv, true);
12022 }
12023
12024 uint32_t  __attribute__((export_name("TS_COption_NoneZ_some"))) TS_COption_NoneZ_some() {
12025         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
12026         return ret_conv;
12027 }
12028
12029 uint32_t  __attribute__((export_name("TS_COption_NoneZ_none"))) TS_COption_NoneZ_none() {
12030         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
12031         return ret_conv;
12032 }
12033
12034 void  __attribute__((export_name("TS_COption_NoneZ_free"))) TS_COption_NoneZ_free(uint32_t _res) {
12035         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
12036         COption_NoneZ_free(_res_conv);
12037 }
12038
12039 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
12040         LDKCounterpartyChannelTransactionParameters o_conv;
12041         o_conv.inner = untag_ptr(o);
12042         o_conv.is_owned = ptr_is_owned(o);
12043         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12044         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
12045         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
12046         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
12047         return tag_ptr(ret_conv, true);
12048 }
12049
12050 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
12051         void* e_ptr = untag_ptr(e);
12052         CHECK_ACCESS(e_ptr);
12053         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12054         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12055         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
12056         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
12057         return tag_ptr(ret_conv, true);
12058 }
12059
12060 jboolean  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
12061         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
12062         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
12063         return ret_conv;
12064 }
12065
12066 void  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
12067         if (!ptr_is_owned(_res)) return;
12068         void* _res_ptr = untag_ptr(_res);
12069         CHECK_ACCESS(_res_ptr);
12070         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
12071         FREE(untag_ptr(_res));
12072         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
12073 }
12074
12075 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
12076         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
12077         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
12078         return tag_ptr(ret_conv, true);
12079 }
12080 int64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
12081         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
12082         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
12083         return ret_conv;
12084 }
12085
12086 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
12087         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
12088         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
12089         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
12090         return tag_ptr(ret_conv, true);
12091 }
12092
12093 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
12094         LDKChannelTransactionParameters o_conv;
12095         o_conv.inner = untag_ptr(o);
12096         o_conv.is_owned = ptr_is_owned(o);
12097         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12098         o_conv = ChannelTransactionParameters_clone(&o_conv);
12099         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
12100         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
12101         return tag_ptr(ret_conv, true);
12102 }
12103
12104 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
12105         void* e_ptr = untag_ptr(e);
12106         CHECK_ACCESS(e_ptr);
12107         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12108         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12109         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
12110         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
12111         return tag_ptr(ret_conv, true);
12112 }
12113
12114 jboolean  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
12115         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
12116         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
12117         return ret_conv;
12118 }
12119
12120 void  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
12121         if (!ptr_is_owned(_res)) return;
12122         void* _res_ptr = untag_ptr(_res);
12123         CHECK_ACCESS(_res_ptr);
12124         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
12125         FREE(untag_ptr(_res));
12126         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
12127 }
12128
12129 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
12130         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
12131         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
12132         return tag_ptr(ret_conv, true);
12133 }
12134 int64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
12135         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
12136         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
12137         return ret_conv;
12138 }
12139
12140 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
12141         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
12142         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
12143         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
12144         return tag_ptr(ret_conv, true);
12145 }
12146
12147 void  __attribute__((export_name("TS_CVec_SignatureZ_free"))) TS_CVec_SignatureZ_free(ptrArray _res) {
12148         LDKCVec_SignatureZ _res_constr;
12149         _res_constr.datalen = _res->arr_len;
12150         if (_res_constr.datalen > 0)
12151                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
12152         else
12153                 _res_constr.data = NULL;
12154         int8_tArray* _res_vals = (void*) _res->elems;
12155         for (size_t m = 0; m < _res_constr.datalen; m++) {
12156                 int8_tArray _res_conv_12 = _res_vals[m];
12157                 LDKSignature _res_conv_12_ref;
12158                 CHECK(_res_conv_12->arr_len == 64);
12159                 memcpy(_res_conv_12_ref.compact_form, _res_conv_12->elems, 64); FREE(_res_conv_12);
12160                 _res_constr.data[m] = _res_conv_12_ref;
12161         }
12162         FREE(_res);
12163         CVec_SignatureZ_free(_res_constr);
12164 }
12165
12166 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
12167         LDKHolderCommitmentTransaction o_conv;
12168         o_conv.inner = untag_ptr(o);
12169         o_conv.is_owned = ptr_is_owned(o);
12170         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12171         o_conv = HolderCommitmentTransaction_clone(&o_conv);
12172         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12173         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
12174         return tag_ptr(ret_conv, true);
12175 }
12176
12177 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
12178         void* e_ptr = untag_ptr(e);
12179         CHECK_ACCESS(e_ptr);
12180         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12181         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12182         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12183         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
12184         return tag_ptr(ret_conv, true);
12185 }
12186
12187 jboolean  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
12188         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
12189         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
12190         return ret_conv;
12191 }
12192
12193 void  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
12194         if (!ptr_is_owned(_res)) return;
12195         void* _res_ptr = untag_ptr(_res);
12196         CHECK_ACCESS(_res_ptr);
12197         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
12198         FREE(untag_ptr(_res));
12199         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
12200 }
12201
12202 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12203         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12204         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
12205         return tag_ptr(ret_conv, true);
12206 }
12207 int64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
12208         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
12209         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12210         return ret_conv;
12211 }
12212
12213 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
12214         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
12215         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
12216         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
12217         return tag_ptr(ret_conv, true);
12218 }
12219
12220 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
12221         LDKBuiltCommitmentTransaction o_conv;
12222         o_conv.inner = untag_ptr(o);
12223         o_conv.is_owned = ptr_is_owned(o);
12224         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12225         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
12226         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12227         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
12228         return tag_ptr(ret_conv, true);
12229 }
12230
12231 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
12232         void* e_ptr = untag_ptr(e);
12233         CHECK_ACCESS(e_ptr);
12234         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12235         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12236         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12237         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
12238         return tag_ptr(ret_conv, true);
12239 }
12240
12241 jboolean  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
12242         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
12243         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
12244         return ret_conv;
12245 }
12246
12247 void  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
12248         if (!ptr_is_owned(_res)) return;
12249         void* _res_ptr = untag_ptr(_res);
12250         CHECK_ACCESS(_res_ptr);
12251         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
12252         FREE(untag_ptr(_res));
12253         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
12254 }
12255
12256 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12257         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12258         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
12259         return tag_ptr(ret_conv, true);
12260 }
12261 int64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
12262         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
12263         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12264         return ret_conv;
12265 }
12266
12267 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
12268         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
12269         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12270         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
12271         return tag_ptr(ret_conv, true);
12272 }
12273
12274 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint64_t o) {
12275         LDKTrustedClosingTransaction o_conv;
12276         o_conv.inner = untag_ptr(o);
12277         o_conv.is_owned = ptr_is_owned(o);
12278         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12279         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
12280         
12281         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
12282         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
12283         return tag_ptr(ret_conv, true);
12284 }
12285
12286 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_err"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
12287         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
12288         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
12289         return tag_ptr(ret_conv, true);
12290 }
12291
12292 jboolean  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_is_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint64_t o) {
12293         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
12294         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
12295         return ret_conv;
12296 }
12297
12298 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_free"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint64_t _res) {
12299         if (!ptr_is_owned(_res)) return;
12300         void* _res_ptr = untag_ptr(_res);
12301         CHECK_ACCESS(_res_ptr);
12302         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
12303         FREE(untag_ptr(_res));
12304         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
12305 }
12306
12307 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
12308         LDKCommitmentTransaction o_conv;
12309         o_conv.inner = untag_ptr(o);
12310         o_conv.is_owned = ptr_is_owned(o);
12311         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12312         o_conv = CommitmentTransaction_clone(&o_conv);
12313         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12314         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
12315         return tag_ptr(ret_conv, true);
12316 }
12317
12318 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint64_t e) {
12319         void* e_ptr = untag_ptr(e);
12320         CHECK_ACCESS(e_ptr);
12321         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12322         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12323         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12324         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
12325         return tag_ptr(ret_conv, true);
12326 }
12327
12328 jboolean  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
12329         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
12330         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
12331         return ret_conv;
12332 }
12333
12334 void  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_free"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
12335         if (!ptr_is_owned(_res)) return;
12336         void* _res_ptr = untag_ptr(_res);
12337         CHECK_ACCESS(_res_ptr);
12338         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
12339         FREE(untag_ptr(_res));
12340         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
12341 }
12342
12343 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12344         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12345         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
12346         return tag_ptr(ret_conv, true);
12347 }
12348 int64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
12349         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
12350         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12351         return ret_conv;
12352 }
12353
12354 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
12355         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
12356         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12357         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
12358         return tag_ptr(ret_conv, true);
12359 }
12360
12361 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint64_t o) {
12362         LDKTrustedCommitmentTransaction o_conv;
12363         o_conv.inner = untag_ptr(o);
12364         o_conv.is_owned = ptr_is_owned(o);
12365         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12366         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
12367         
12368         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
12369         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
12370         return tag_ptr(ret_conv, true);
12371 }
12372
12373 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
12374         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
12375         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
12376         return tag_ptr(ret_conv, true);
12377 }
12378
12379 jboolean  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint64_t o) {
12380         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
12381         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
12382         return ret_conv;
12383 }
12384
12385 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_free"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint64_t _res) {
12386         if (!ptr_is_owned(_res)) return;
12387         void* _res_ptr = untag_ptr(_res);
12388         CHECK_ACCESS(_res_ptr);
12389         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
12390         FREE(untag_ptr(_res));
12391         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
12392 }
12393
12394 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_ok"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
12395         LDKCVec_SignatureZ o_constr;
12396         o_constr.datalen = o->arr_len;
12397         if (o_constr.datalen > 0)
12398                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
12399         else
12400                 o_constr.data = NULL;
12401         int8_tArray* o_vals = (void*) o->elems;
12402         for (size_t m = 0; m < o_constr.datalen; m++) {
12403                 int8_tArray o_conv_12 = o_vals[m];
12404                 LDKSignature o_conv_12_ref;
12405                 CHECK(o_conv_12->arr_len == 64);
12406                 memcpy(o_conv_12_ref.compact_form, o_conv_12->elems, 64); FREE(o_conv_12);
12407                 o_constr.data[m] = o_conv_12_ref;
12408         }
12409         FREE(o);
12410         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12411         *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
12412         return tag_ptr(ret_conv, true);
12413 }
12414
12415 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_err"))) TS_CResult_CVec_SignatureZNoneZ_err() {
12416         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12417         *ret_conv = CResult_CVec_SignatureZNoneZ_err();
12418         return tag_ptr(ret_conv, true);
12419 }
12420
12421 jboolean  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_is_ok"))) TS_CResult_CVec_SignatureZNoneZ_is_ok(uint64_t o) {
12422         LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(o);
12423         jboolean ret_conv = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
12424         return ret_conv;
12425 }
12426
12427 void  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_free"))) TS_CResult_CVec_SignatureZNoneZ_free(uint64_t _res) {
12428         if (!ptr_is_owned(_res)) return;
12429         void* _res_ptr = untag_ptr(_res);
12430         CHECK_ACCESS(_res_ptr);
12431         LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
12432         FREE(untag_ptr(_res));
12433         CResult_CVec_SignatureZNoneZ_free(_res_conv);
12434 }
12435
12436 static inline uint64_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
12437         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12438         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
12439         return tag_ptr(ret_conv, true);
12440 }
12441 int64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone_ptr"))) TS_CResult_CVec_SignatureZNoneZ_clone_ptr(uint64_t arg) {
12442         LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(arg);
12443         int64_t ret_conv = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
12444         return ret_conv;
12445 }
12446
12447 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint64_t orig) {
12448         LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(orig);
12449         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12450         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
12451         return tag_ptr(ret_conv, true);
12452 }
12453
12454 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint64_t o) {
12455         LDKShutdownScript o_conv;
12456         o_conv.inner = untag_ptr(o);
12457         o_conv.is_owned = ptr_is_owned(o);
12458         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12459         o_conv = ShutdownScript_clone(&o_conv);
12460         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12461         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
12462         return tag_ptr(ret_conv, true);
12463 }
12464
12465 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint64_t e) {
12466         void* e_ptr = untag_ptr(e);
12467         CHECK_ACCESS(e_ptr);
12468         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12469         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12470         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12471         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
12472         return tag_ptr(ret_conv, true);
12473 }
12474
12475 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_is_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint64_t o) {
12476         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
12477         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
12478         return ret_conv;
12479 }
12480
12481 void  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_free"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint64_t _res) {
12482         if (!ptr_is_owned(_res)) return;
12483         void* _res_ptr = untag_ptr(_res);
12484         CHECK_ACCESS(_res_ptr);
12485         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
12486         FREE(untag_ptr(_res));
12487         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
12488 }
12489
12490 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
12491         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12492         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
12493         return tag_ptr(ret_conv, true);
12494 }
12495 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint64_t arg) {
12496         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
12497         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
12498         return ret_conv;
12499 }
12500
12501 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint64_t orig) {
12502         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
12503         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12504         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
12505         return tag_ptr(ret_conv, true);
12506 }
12507
12508 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint64_t o) {
12509         LDKShutdownScript o_conv;
12510         o_conv.inner = untag_ptr(o);
12511         o_conv.is_owned = ptr_is_owned(o);
12512         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12513         o_conv = ShutdownScript_clone(&o_conv);
12514         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12515         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
12516         return tag_ptr(ret_conv, true);
12517 }
12518
12519 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint64_t e) {
12520         LDKInvalidShutdownScript e_conv;
12521         e_conv.inner = untag_ptr(e);
12522         e_conv.is_owned = ptr_is_owned(e);
12523         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12524         e_conv = InvalidShutdownScript_clone(&e_conv);
12525         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12526         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
12527         return tag_ptr(ret_conv, true);
12528 }
12529
12530 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint64_t o) {
12531         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
12532         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
12533         return ret_conv;
12534 }
12535
12536 void  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint64_t _res) {
12537         if (!ptr_is_owned(_res)) return;
12538         void* _res_ptr = untag_ptr(_res);
12539         CHECK_ACCESS(_res_ptr);
12540         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
12541         FREE(untag_ptr(_res));
12542         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
12543 }
12544
12545 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
12546         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12547         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
12548         return tag_ptr(ret_conv, true);
12549 }
12550 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint64_t arg) {
12551         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
12552         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
12553         return ret_conv;
12554 }
12555
12556 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint64_t orig) {
12557         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
12558         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12559         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
12560         return tag_ptr(ret_conv, true);
12561 }
12562
12563 void  __attribute__((export_name("TS_CVec_PublicKeyZ_free"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
12564         LDKCVec_PublicKeyZ _res_constr;
12565         _res_constr.datalen = _res->arr_len;
12566         if (_res_constr.datalen > 0)
12567                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
12568         else
12569                 _res_constr.data = NULL;
12570         int8_tArray* _res_vals = (void*) _res->elems;
12571         for (size_t m = 0; m < _res_constr.datalen; m++) {
12572                 int8_tArray _res_conv_12 = _res_vals[m];
12573                 LDKPublicKey _res_conv_12_ref;
12574                 CHECK(_res_conv_12->arr_len == 33);
12575                 memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33); FREE(_res_conv_12);
12576                 _res_constr.data[m] = _res_conv_12_ref;
12577         }
12578         FREE(_res);
12579         CVec_PublicKeyZ_free(_res_constr);
12580 }
12581
12582 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_ok"))) TS_CResult_BlindedPathNoneZ_ok(uint64_t o) {
12583         LDKBlindedPath o_conv;
12584         o_conv.inner = untag_ptr(o);
12585         o_conv.is_owned = ptr_is_owned(o);
12586         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12587         o_conv = BlindedPath_clone(&o_conv);
12588         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
12589         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
12590         return tag_ptr(ret_conv, true);
12591 }
12592
12593 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_err"))) TS_CResult_BlindedPathNoneZ_err() {
12594         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
12595         *ret_conv = CResult_BlindedPathNoneZ_err();
12596         return tag_ptr(ret_conv, true);
12597 }
12598
12599 jboolean  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_is_ok"))) TS_CResult_BlindedPathNoneZ_is_ok(uint64_t o) {
12600         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
12601         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
12602         return ret_conv;
12603 }
12604
12605 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_free"))) TS_CResult_BlindedPathNoneZ_free(uint64_t _res) {
12606         if (!ptr_is_owned(_res)) return;
12607         void* _res_ptr = untag_ptr(_res);
12608         CHECK_ACCESS(_res_ptr);
12609         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
12610         FREE(untag_ptr(_res));
12611         CResult_BlindedPathNoneZ_free(_res_conv);
12612 }
12613
12614 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
12615         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
12616         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
12617         return tag_ptr(ret_conv, true);
12618 }
12619 int64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone_ptr"))) TS_CResult_BlindedPathNoneZ_clone_ptr(uint64_t arg) {
12620         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
12621         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
12622         return ret_conv;
12623 }
12624
12625 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone"))) TS_CResult_BlindedPathNoneZ_clone(uint64_t orig) {
12626         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
12627         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
12628         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
12629         return tag_ptr(ret_conv, true);
12630 }
12631
12632 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_ok"))) TS_CResult_BlindedPathDecodeErrorZ_ok(uint64_t o) {
12633         LDKBlindedPath o_conv;
12634         o_conv.inner = untag_ptr(o);
12635         o_conv.is_owned = ptr_is_owned(o);
12636         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12637         o_conv = BlindedPath_clone(&o_conv);
12638         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
12639         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
12640         return tag_ptr(ret_conv, true);
12641 }
12642
12643 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_err"))) TS_CResult_BlindedPathDecodeErrorZ_err(uint64_t e) {
12644         void* e_ptr = untag_ptr(e);
12645         CHECK_ACCESS(e_ptr);
12646         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12647         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12648         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
12649         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
12650         return tag_ptr(ret_conv, true);
12651 }
12652
12653 jboolean  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_is_ok"))) TS_CResult_BlindedPathDecodeErrorZ_is_ok(uint64_t o) {
12654         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
12655         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
12656         return ret_conv;
12657 }
12658
12659 void  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_free"))) TS_CResult_BlindedPathDecodeErrorZ_free(uint64_t _res) {
12660         if (!ptr_is_owned(_res)) return;
12661         void* _res_ptr = untag_ptr(_res);
12662         CHECK_ACCESS(_res_ptr);
12663         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
12664         FREE(untag_ptr(_res));
12665         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
12666 }
12667
12668 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
12669         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
12670         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
12671         return tag_ptr(ret_conv, true);
12672 }
12673 int64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedPathDecodeErrorZ_clone_ptr(uint64_t arg) {
12674         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
12675         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
12676         return ret_conv;
12677 }
12678
12679 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone"))) TS_CResult_BlindedPathDecodeErrorZ_clone(uint64_t orig) {
12680         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
12681         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
12682         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
12683         return tag_ptr(ret_conv, true);
12684 }
12685
12686 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_ok"))) TS_CResult_BlindedHopDecodeErrorZ_ok(uint64_t o) {
12687         LDKBlindedHop o_conv;
12688         o_conv.inner = untag_ptr(o);
12689         o_conv.is_owned = ptr_is_owned(o);
12690         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12691         o_conv = BlindedHop_clone(&o_conv);
12692         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
12693         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
12694         return tag_ptr(ret_conv, true);
12695 }
12696
12697 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_err"))) TS_CResult_BlindedHopDecodeErrorZ_err(uint64_t e) {
12698         void* e_ptr = untag_ptr(e);
12699         CHECK_ACCESS(e_ptr);
12700         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12701         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12702         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
12703         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
12704         return tag_ptr(ret_conv, true);
12705 }
12706
12707 jboolean  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopDecodeErrorZ_is_ok(uint64_t o) {
12708         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
12709         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
12710         return ret_conv;
12711 }
12712
12713 void  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_free"))) TS_CResult_BlindedHopDecodeErrorZ_free(uint64_t _res) {
12714         if (!ptr_is_owned(_res)) return;
12715         void* _res_ptr = untag_ptr(_res);
12716         CHECK_ACCESS(_res_ptr);
12717         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
12718         FREE(untag_ptr(_res));
12719         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
12720 }
12721
12722 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
12723         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
12724         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
12725         return tag_ptr(ret_conv, true);
12726 }
12727 int64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopDecodeErrorZ_clone_ptr(uint64_t arg) {
12728         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
12729         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
12730         return ret_conv;
12731 }
12732
12733 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone"))) TS_CResult_BlindedHopDecodeErrorZ_clone(uint64_t orig) {
12734         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
12735         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
12736         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
12737         return tag_ptr(ret_conv, true);
12738 }
12739
12740 void  __attribute__((export_name("TS_CVec_ChannelDetailsZ_free"))) TS_CVec_ChannelDetailsZ_free(uint64_tArray _res) {
12741         LDKCVec_ChannelDetailsZ _res_constr;
12742         _res_constr.datalen = _res->arr_len;
12743         if (_res_constr.datalen > 0)
12744                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
12745         else
12746                 _res_constr.data = NULL;
12747         uint64_t* _res_vals = _res->elems;
12748         for (size_t q = 0; q < _res_constr.datalen; q++) {
12749                 uint64_t _res_conv_16 = _res_vals[q];
12750                 LDKChannelDetails _res_conv_16_conv;
12751                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
12752                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
12753                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
12754                 _res_constr.data[q] = _res_conv_16_conv;
12755         }
12756         FREE(_res);
12757         CVec_ChannelDetailsZ_free(_res_constr);
12758 }
12759
12760 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_ok"))) TS_CResult_RouteLightningErrorZ_ok(uint64_t o) {
12761         LDKRoute o_conv;
12762         o_conv.inner = untag_ptr(o);
12763         o_conv.is_owned = ptr_is_owned(o);
12764         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12765         o_conv = Route_clone(&o_conv);
12766         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12767         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
12768         return tag_ptr(ret_conv, true);
12769 }
12770
12771 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_err"))) TS_CResult_RouteLightningErrorZ_err(uint64_t e) {
12772         LDKLightningError e_conv;
12773         e_conv.inner = untag_ptr(e);
12774         e_conv.is_owned = ptr_is_owned(e);
12775         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12776         e_conv = LightningError_clone(&e_conv);
12777         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12778         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
12779         return tag_ptr(ret_conv, true);
12780 }
12781
12782 jboolean  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_is_ok"))) TS_CResult_RouteLightningErrorZ_is_ok(uint64_t o) {
12783         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
12784         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
12785         return ret_conv;
12786 }
12787
12788 void  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_free"))) TS_CResult_RouteLightningErrorZ_free(uint64_t _res) {
12789         if (!ptr_is_owned(_res)) return;
12790         void* _res_ptr = untag_ptr(_res);
12791         CHECK_ACCESS(_res_ptr);
12792         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
12793         FREE(untag_ptr(_res));
12794         CResult_RouteLightningErrorZ_free(_res_conv);
12795 }
12796
12797 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
12798         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12799         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
12800         return tag_ptr(ret_conv, true);
12801 }
12802 int64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone_ptr"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint64_t arg) {
12803         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
12804         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
12805         return ret_conv;
12806 }
12807
12808 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone"))) TS_CResult_RouteLightningErrorZ_clone(uint64_t orig) {
12809         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
12810         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12811         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
12812         return tag_ptr(ret_conv, true);
12813 }
12814
12815 void  __attribute__((export_name("TS_CVec_RouteHopZ_free"))) TS_CVec_RouteHopZ_free(uint64_tArray _res) {
12816         LDKCVec_RouteHopZ _res_constr;
12817         _res_constr.datalen = _res->arr_len;
12818         if (_res_constr.datalen > 0)
12819                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12820         else
12821                 _res_constr.data = NULL;
12822         uint64_t* _res_vals = _res->elems;
12823         for (size_t k = 0; k < _res_constr.datalen; k++) {
12824                 uint64_t _res_conv_10 = _res_vals[k];
12825                 LDKRouteHop _res_conv_10_conv;
12826                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
12827                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
12828                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
12829                 _res_constr.data[k] = _res_conv_10_conv;
12830         }
12831         FREE(_res);
12832         CVec_RouteHopZ_free(_res_constr);
12833 }
12834
12835 uint64_t  __attribute__((export_name("TS_COption_u64Z_some"))) TS_COption_u64Z_some(int64_t o) {
12836         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12837         *ret_copy = COption_u64Z_some(o);
12838         uint64_t ret_ref = tag_ptr(ret_copy, true);
12839         return ret_ref;
12840 }
12841
12842 uint64_t  __attribute__((export_name("TS_COption_u64Z_none"))) TS_COption_u64Z_none() {
12843         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12844         *ret_copy = COption_u64Z_none();
12845         uint64_t ret_ref = tag_ptr(ret_copy, true);
12846         return ret_ref;
12847 }
12848
12849 void  __attribute__((export_name("TS_COption_u64Z_free"))) TS_COption_u64Z_free(uint64_t _res) {
12850         if (!ptr_is_owned(_res)) return;
12851         void* _res_ptr = untag_ptr(_res);
12852         CHECK_ACCESS(_res_ptr);
12853         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
12854         FREE(untag_ptr(_res));
12855         COption_u64Z_free(_res_conv);
12856 }
12857
12858 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
12859         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12860         *ret_copy = COption_u64Z_clone(arg);
12861         uint64_t ret_ref = tag_ptr(ret_copy, true);
12862         return ret_ref;
12863 }
12864 int64_t  __attribute__((export_name("TS_COption_u64Z_clone_ptr"))) TS_COption_u64Z_clone_ptr(uint64_t arg) {
12865         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
12866         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
12867         return ret_conv;
12868 }
12869
12870 uint64_t  __attribute__((export_name("TS_COption_u64Z_clone"))) TS_COption_u64Z_clone(uint64_t orig) {
12871         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
12872         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12873         *ret_copy = COption_u64Z_clone(orig_conv);
12874         uint64_t ret_ref = tag_ptr(ret_copy, true);
12875         return ret_ref;
12876 }
12877
12878 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_ok(uint64_t o) {
12879         LDKInFlightHtlcs o_conv;
12880         o_conv.inner = untag_ptr(o);
12881         o_conv.is_owned = ptr_is_owned(o);
12882         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12883         o_conv = InFlightHtlcs_clone(&o_conv);
12884         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
12885         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
12886         return tag_ptr(ret_conv, true);
12887 }
12888
12889 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_err(uint64_t e) {
12890         void* e_ptr = untag_ptr(e);
12891         CHECK_ACCESS(e_ptr);
12892         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12893         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12894         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
12895         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
12896         return tag_ptr(ret_conv, true);
12897 }
12898
12899 jboolean  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok(uint64_t o) {
12900         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
12901         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
12902         return ret_conv;
12903 }
12904
12905 void  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_free"))) TS_CResult_InFlightHtlcsDecodeErrorZ_free(uint64_t _res) {
12906         if (!ptr_is_owned(_res)) return;
12907         void* _res_ptr = untag_ptr(_res);
12908         CHECK_ACCESS(_res_ptr);
12909         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
12910         FREE(untag_ptr(_res));
12911         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
12912 }
12913
12914 static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) {
12915         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
12916         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg);
12917         return tag_ptr(ret_conv, true);
12918 }
12919 int64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(uint64_t arg) {
12920         LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg);
12921         int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv);
12922         return ret_conv;
12923 }
12924
12925 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone(uint64_t orig) {
12926         LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig);
12927         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
12928         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv);
12929         return tag_ptr(ret_conv, true);
12930 }
12931
12932 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_ok"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint64_t o) {
12933         LDKRouteHop o_conv;
12934         o_conv.inner = untag_ptr(o);
12935         o_conv.is_owned = ptr_is_owned(o);
12936         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12937         o_conv = RouteHop_clone(&o_conv);
12938         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12939         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
12940         return tag_ptr(ret_conv, true);
12941 }
12942
12943 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_err"))) TS_CResult_RouteHopDecodeErrorZ_err(uint64_t e) {
12944         void* e_ptr = untag_ptr(e);
12945         CHECK_ACCESS(e_ptr);
12946         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
12947         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
12948         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12949         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
12950         return tag_ptr(ret_conv, true);
12951 }
12952
12953 jboolean  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint64_t o) {
12954         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
12955         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
12956         return ret_conv;
12957 }
12958
12959 void  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_free"))) TS_CResult_RouteHopDecodeErrorZ_free(uint64_t _res) {
12960         if (!ptr_is_owned(_res)) return;
12961         void* _res_ptr = untag_ptr(_res);
12962         CHECK_ACCESS(_res_ptr);
12963         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
12964         FREE(untag_ptr(_res));
12965         CResult_RouteHopDecodeErrorZ_free(_res_conv);
12966 }
12967
12968 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
12969         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12970         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
12971         return tag_ptr(ret_conv, true);
12972 }
12973 int64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint64_t arg) {
12974         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
12975         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
12976         return ret_conv;
12977 }
12978
12979 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint64_t orig) {
12980         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
12981         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12982         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
12983         return tag_ptr(ret_conv, true);
12984 }
12985
12986 void  __attribute__((export_name("TS_CVec_CVec_RouteHopZZ_free"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
12987         LDKCVec_CVec_RouteHopZZ _res_constr;
12988         _res_constr.datalen = _res->arr_len;
12989         if (_res_constr.datalen > 0)
12990                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
12991         else
12992                 _res_constr.data = NULL;
12993         uint64_tArray* _res_vals = (void*) _res->elems;
12994         for (size_t m = 0; m < _res_constr.datalen; m++) {
12995                 uint64_tArray _res_conv_12 = _res_vals[m];
12996                 LDKCVec_RouteHopZ _res_conv_12_constr;
12997                 _res_conv_12_constr.datalen = _res_conv_12->arr_len;
12998                 if (_res_conv_12_constr.datalen > 0)
12999                         _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
13000                 else
13001                         _res_conv_12_constr.data = NULL;
13002                 uint64_t* _res_conv_12_vals = _res_conv_12->elems;
13003                 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
13004                         uint64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
13005                         LDKRouteHop _res_conv_12_conv_10_conv;
13006                         _res_conv_12_conv_10_conv.inner = untag_ptr(_res_conv_12_conv_10);
13007                         _res_conv_12_conv_10_conv.is_owned = ptr_is_owned(_res_conv_12_conv_10);
13008                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
13009                         _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
13010                 }
13011                 FREE(_res_conv_12);
13012                 _res_constr.data[m] = _res_conv_12_constr;
13013         }
13014         FREE(_res);
13015         CVec_CVec_RouteHopZZ_free(_res_constr);
13016 }
13017
13018 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_ok"))) TS_CResult_RouteDecodeErrorZ_ok(uint64_t o) {
13019         LDKRoute o_conv;
13020         o_conv.inner = untag_ptr(o);
13021         o_conv.is_owned = ptr_is_owned(o);
13022         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13023         o_conv = Route_clone(&o_conv);
13024         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
13025         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
13026         return tag_ptr(ret_conv, true);
13027 }
13028
13029 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_err"))) TS_CResult_RouteDecodeErrorZ_err(uint64_t e) {
13030         void* e_ptr = untag_ptr(e);
13031         CHECK_ACCESS(e_ptr);
13032         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13033         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13034         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
13035         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
13036         return tag_ptr(ret_conv, true);
13037 }
13038
13039 jboolean  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_is_ok"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint64_t o) {
13040         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
13041         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
13042         return ret_conv;
13043 }
13044
13045 void  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_free"))) TS_CResult_RouteDecodeErrorZ_free(uint64_t _res) {
13046         if (!ptr_is_owned(_res)) return;
13047         void* _res_ptr = untag_ptr(_res);
13048         CHECK_ACCESS(_res_ptr);
13049         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
13050         FREE(untag_ptr(_res));
13051         CResult_RouteDecodeErrorZ_free(_res_conv);
13052 }
13053
13054 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
13055         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
13056         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
13057         return tag_ptr(ret_conv, true);
13058 }
13059 int64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone_ptr"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint64_t arg) {
13060         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
13061         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
13062         return ret_conv;
13063 }
13064
13065 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone"))) TS_CResult_RouteDecodeErrorZ_clone(uint64_t orig) {
13066         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
13067         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
13068         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
13069         return tag_ptr(ret_conv, true);
13070 }
13071
13072 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_ok"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint64_t o) {
13073         LDKRouteParameters o_conv;
13074         o_conv.inner = untag_ptr(o);
13075         o_conv.is_owned = ptr_is_owned(o);
13076         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13077         o_conv = RouteParameters_clone(&o_conv);
13078         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
13079         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
13080         return tag_ptr(ret_conv, true);
13081 }
13082
13083 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_err"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint64_t e) {
13084         void* e_ptr = untag_ptr(e);
13085         CHECK_ACCESS(e_ptr);
13086         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13087         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13088         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
13089         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
13090         return tag_ptr(ret_conv, true);
13091 }
13092
13093 jboolean  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_is_ok"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint64_t o) {
13094         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
13095         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
13096         return ret_conv;
13097 }
13098
13099 void  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_free"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint64_t _res) {
13100         if (!ptr_is_owned(_res)) return;
13101         void* _res_ptr = untag_ptr(_res);
13102         CHECK_ACCESS(_res_ptr);
13103         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
13104         FREE(untag_ptr(_res));
13105         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
13106 }
13107
13108 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
13109         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
13110         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
13111         return tag_ptr(ret_conv, true);
13112 }
13113 int64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone_ptr"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
13114         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
13115         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
13116         return ret_conv;
13117 }
13118
13119 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint64_t orig) {
13120         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
13121         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
13122         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
13123         return tag_ptr(ret_conv, true);
13124 }
13125
13126 void  __attribute__((export_name("TS_CVec_RouteHintZ_free"))) TS_CVec_RouteHintZ_free(uint64_tArray _res) {
13127         LDKCVec_RouteHintZ _res_constr;
13128         _res_constr.datalen = _res->arr_len;
13129         if (_res_constr.datalen > 0)
13130                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
13131         else
13132                 _res_constr.data = NULL;
13133         uint64_t* _res_vals = _res->elems;
13134         for (size_t l = 0; l < _res_constr.datalen; l++) {
13135                 uint64_t _res_conv_11 = _res_vals[l];
13136                 LDKRouteHint _res_conv_11_conv;
13137                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
13138                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
13139                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
13140                 _res_constr.data[l] = _res_conv_11_conv;
13141         }
13142         FREE(_res);
13143         CVec_RouteHintZ_free(_res_constr);
13144 }
13145
13146 void  __attribute__((export_name("TS_CVec_u64Z_free"))) TS_CVec_u64Z_free(int64_tArray _res) {
13147         LDKCVec_u64Z _res_constr;
13148         _res_constr.datalen = _res->arr_len;
13149         if (_res_constr.datalen > 0)
13150                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
13151         else
13152                 _res_constr.data = NULL;
13153         int64_t* _res_vals = _res->elems;
13154         for (size_t i = 0; i < _res_constr.datalen; i++) {
13155                 int64_t _res_conv_8 = _res_vals[i];
13156                 _res_constr.data[i] = _res_conv_8;
13157         }
13158         FREE(_res);
13159         CVec_u64Z_free(_res_constr);
13160 }
13161
13162 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_ok(uint64_t o) {
13163         LDKPaymentParameters o_conv;
13164         o_conv.inner = untag_ptr(o);
13165         o_conv.is_owned = ptr_is_owned(o);
13166         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13167         o_conv = PaymentParameters_clone(&o_conv);
13168         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
13169         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
13170         return tag_ptr(ret_conv, true);
13171 }
13172
13173 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_err"))) TS_CResult_PaymentParametersDecodeErrorZ_err(uint64_t e) {
13174         void* e_ptr = untag_ptr(e);
13175         CHECK_ACCESS(e_ptr);
13176         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13177         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13178         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
13179         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
13180         return tag_ptr(ret_conv, true);
13181 }
13182
13183 jboolean  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_is_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_is_ok(uint64_t o) {
13184         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
13185         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
13186         return ret_conv;
13187 }
13188
13189 void  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_free"))) TS_CResult_PaymentParametersDecodeErrorZ_free(uint64_t _res) {
13190         if (!ptr_is_owned(_res)) return;
13191         void* _res_ptr = untag_ptr(_res);
13192         CHECK_ACCESS(_res_ptr);
13193         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
13194         FREE(untag_ptr(_res));
13195         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
13196 }
13197
13198 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
13199         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
13200         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
13201         return tag_ptr(ret_conv, true);
13202 }
13203 int64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
13204         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
13205         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
13206         return ret_conv;
13207 }
13208
13209 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone"))) TS_CResult_PaymentParametersDecodeErrorZ_clone(uint64_t orig) {
13210         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
13211         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
13212         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
13213         return tag_ptr(ret_conv, true);
13214 }
13215
13216 void  __attribute__((export_name("TS_CVec_RouteHintHopZ_free"))) TS_CVec_RouteHintHopZ_free(uint64_tArray _res) {
13217         LDKCVec_RouteHintHopZ _res_constr;
13218         _res_constr.datalen = _res->arr_len;
13219         if (_res_constr.datalen > 0)
13220                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
13221         else
13222                 _res_constr.data = NULL;
13223         uint64_t* _res_vals = _res->elems;
13224         for (size_t o = 0; o < _res_constr.datalen; o++) {
13225                 uint64_t _res_conv_14 = _res_vals[o];
13226                 LDKRouteHintHop _res_conv_14_conv;
13227                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
13228                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
13229                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
13230                 _res_constr.data[o] = _res_conv_14_conv;
13231         }
13232         FREE(_res);
13233         CVec_RouteHintHopZ_free(_res_constr);
13234 }
13235
13236 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_ok"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint64_t o) {
13237         LDKRouteHint o_conv;
13238         o_conv.inner = untag_ptr(o);
13239         o_conv.is_owned = ptr_is_owned(o);
13240         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13241         o_conv = RouteHint_clone(&o_conv);
13242         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
13243         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
13244         return tag_ptr(ret_conv, true);
13245 }
13246
13247 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_err"))) TS_CResult_RouteHintDecodeErrorZ_err(uint64_t e) {
13248         void* e_ptr = untag_ptr(e);
13249         CHECK_ACCESS(e_ptr);
13250         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13251         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13252         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
13253         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
13254         return tag_ptr(ret_conv, true);
13255 }
13256
13257 jboolean  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_is_ok"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint64_t o) {
13258         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
13259         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
13260         return ret_conv;
13261 }
13262
13263 void  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_free"))) TS_CResult_RouteHintDecodeErrorZ_free(uint64_t _res) {
13264         if (!ptr_is_owned(_res)) return;
13265         void* _res_ptr = untag_ptr(_res);
13266         CHECK_ACCESS(_res_ptr);
13267         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
13268         FREE(untag_ptr(_res));
13269         CResult_RouteHintDecodeErrorZ_free(_res_conv);
13270 }
13271
13272 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
13273         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
13274         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
13275         return tag_ptr(ret_conv, true);
13276 }
13277 int64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint64_t arg) {
13278         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
13279         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
13280         return ret_conv;
13281 }
13282
13283 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint64_t orig) {
13284         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
13285         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
13286         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
13287         return tag_ptr(ret_conv, true);
13288 }
13289
13290 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint64_t o) {
13291         LDKRouteHintHop o_conv;
13292         o_conv.inner = untag_ptr(o);
13293         o_conv.is_owned = ptr_is_owned(o);
13294         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13295         o_conv = RouteHintHop_clone(&o_conv);
13296         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
13297         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
13298         return tag_ptr(ret_conv, true);
13299 }
13300
13301 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_err"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint64_t e) {
13302         void* e_ptr = untag_ptr(e);
13303         CHECK_ACCESS(e_ptr);
13304         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13305         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13306         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
13307         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
13308         return tag_ptr(ret_conv, true);
13309 }
13310
13311 jboolean  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint64_t o) {
13312         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
13313         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
13314         return ret_conv;
13315 }
13316
13317 void  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_free"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint64_t _res) {
13318         if (!ptr_is_owned(_res)) return;
13319         void* _res_ptr = untag_ptr(_res);
13320         CHECK_ACCESS(_res_ptr);
13321         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
13322         FREE(untag_ptr(_res));
13323         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
13324 }
13325
13326 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
13327         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
13328         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
13329         return tag_ptr(ret_conv, true);
13330 }
13331 int64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint64_t arg) {
13332         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
13333         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
13334         return ret_conv;
13335 }
13336
13337 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint64_t orig) {
13338         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
13339         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
13340         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
13341         return tag_ptr(ret_conv, true);
13342 }
13343
13344 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_ok(uint64_t o) {
13345         void* o_ptr = untag_ptr(o);
13346         CHECK_ACCESS(o_ptr);
13347         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
13348         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
13349         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
13350         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
13351         return tag_ptr(ret_conv, true);
13352 }
13353
13354 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_err(uint64_t e) {
13355         void* e_ptr = untag_ptr(e);
13356         CHECK_ACCESS(e_ptr);
13357         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13358         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13359         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
13360         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
13361         return tag_ptr(ret_conv, true);
13362 }
13363
13364 jboolean  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_is_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_is_ok(uint64_t o) {
13365         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
13366         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
13367         return ret_conv;
13368 }
13369
13370 void  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_free"))) TS_CResult_PaymentPurposeDecodeErrorZ_free(uint64_t _res) {
13371         if (!ptr_is_owned(_res)) return;
13372         void* _res_ptr = untag_ptr(_res);
13373         CHECK_ACCESS(_res_ptr);
13374         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
13375         FREE(untag_ptr(_res));
13376         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
13377 }
13378
13379 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
13380         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
13381         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
13382         return tag_ptr(ret_conv, true);
13383 }
13384 int64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr(uint64_t arg) {
13385         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
13386         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
13387         return ret_conv;
13388 }
13389
13390 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone(uint64_t orig) {
13391         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
13392         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
13393         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
13394         return tag_ptr(ret_conv, true);
13395 }
13396
13397 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_some"))) TS_COption_ClosureReasonZ_some(uint64_t o) {
13398         void* o_ptr = untag_ptr(o);
13399         CHECK_ACCESS(o_ptr);
13400         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
13401         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
13402         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
13403         *ret_copy = COption_ClosureReasonZ_some(o_conv);
13404         uint64_t ret_ref = tag_ptr(ret_copy, true);
13405         return ret_ref;
13406 }
13407
13408 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_none"))) TS_COption_ClosureReasonZ_none() {
13409         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
13410         *ret_copy = COption_ClosureReasonZ_none();
13411         uint64_t ret_ref = tag_ptr(ret_copy, true);
13412         return ret_ref;
13413 }
13414
13415 void  __attribute__((export_name("TS_COption_ClosureReasonZ_free"))) TS_COption_ClosureReasonZ_free(uint64_t _res) {
13416         if (!ptr_is_owned(_res)) return;
13417         void* _res_ptr = untag_ptr(_res);
13418         CHECK_ACCESS(_res_ptr);
13419         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
13420         FREE(untag_ptr(_res));
13421         COption_ClosureReasonZ_free(_res_conv);
13422 }
13423
13424 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
13425         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
13426         *ret_copy = COption_ClosureReasonZ_clone(arg);
13427         uint64_t ret_ref = tag_ptr(ret_copy, true);
13428         return ret_ref;
13429 }
13430 int64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone_ptr"))) TS_COption_ClosureReasonZ_clone_ptr(uint64_t arg) {
13431         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
13432         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
13433         return ret_conv;
13434 }
13435
13436 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone"))) TS_COption_ClosureReasonZ_clone(uint64_t orig) {
13437         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
13438         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
13439         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
13440         uint64_t ret_ref = tag_ptr(ret_copy, true);
13441         return ret_ref;
13442 }
13443
13444 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint64_t o) {
13445         void* o_ptr = untag_ptr(o);
13446         CHECK_ACCESS(o_ptr);
13447         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
13448         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
13449         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13450         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
13451         return tag_ptr(ret_conv, true);
13452 }
13453
13454 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint64_t e) {
13455         void* e_ptr = untag_ptr(e);
13456         CHECK_ACCESS(e_ptr);
13457         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13458         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13459         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13460         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
13461         return tag_ptr(ret_conv, true);
13462 }
13463
13464 jboolean  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint64_t o) {
13465         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
13466         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
13467         return ret_conv;
13468 }
13469
13470 void  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_free"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint64_t _res) {
13471         if (!ptr_is_owned(_res)) return;
13472         void* _res_ptr = untag_ptr(_res);
13473         CHECK_ACCESS(_res_ptr);
13474         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
13475         FREE(untag_ptr(_res));
13476         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
13477 }
13478
13479 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
13480         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13481         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
13482         return tag_ptr(ret_conv, true);
13483 }
13484 int64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint64_t arg) {
13485         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
13486         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
13487         return ret_conv;
13488 }
13489
13490 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint64_t orig) {
13491         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
13492         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13493         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
13494         return tag_ptr(ret_conv, true);
13495 }
13496
13497 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_some"))) TS_COption_HTLCDestinationZ_some(uint64_t o) {
13498         void* o_ptr = untag_ptr(o);
13499         CHECK_ACCESS(o_ptr);
13500         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
13501         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
13502         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13503         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
13504         uint64_t ret_ref = tag_ptr(ret_copy, true);
13505         return ret_ref;
13506 }
13507
13508 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_none"))) TS_COption_HTLCDestinationZ_none() {
13509         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13510         *ret_copy = COption_HTLCDestinationZ_none();
13511         uint64_t ret_ref = tag_ptr(ret_copy, true);
13512         return ret_ref;
13513 }
13514
13515 void  __attribute__((export_name("TS_COption_HTLCDestinationZ_free"))) TS_COption_HTLCDestinationZ_free(uint64_t _res) {
13516         if (!ptr_is_owned(_res)) return;
13517         void* _res_ptr = untag_ptr(_res);
13518         CHECK_ACCESS(_res_ptr);
13519         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
13520         FREE(untag_ptr(_res));
13521         COption_HTLCDestinationZ_free(_res_conv);
13522 }
13523
13524 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
13525         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13526         *ret_copy = COption_HTLCDestinationZ_clone(arg);
13527         uint64_t ret_ref = tag_ptr(ret_copy, true);
13528         return ret_ref;
13529 }
13530 int64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone_ptr"))) TS_COption_HTLCDestinationZ_clone_ptr(uint64_t arg) {
13531         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
13532         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
13533         return ret_conv;
13534 }
13535
13536 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone"))) TS_COption_HTLCDestinationZ_clone(uint64_t orig) {
13537         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
13538         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13539         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
13540         uint64_t ret_ref = tag_ptr(ret_copy, true);
13541         return ret_ref;
13542 }
13543
13544 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok(uint64_t o) {
13545         void* o_ptr = untag_ptr(o);
13546         CHECK_ACCESS(o_ptr);
13547         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
13548         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
13549         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13550         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
13551         return tag_ptr(ret_conv, true);
13552 }
13553
13554 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err(uint64_t e) {
13555         void* e_ptr = untag_ptr(e);
13556         CHECK_ACCESS(e_ptr);
13557         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13558         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13559         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13560         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
13561         return tag_ptr(ret_conv, true);
13562 }
13563
13564 jboolean  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(uint64_t o) {
13565         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
13566         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
13567         return ret_conv;
13568 }
13569
13570 void  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free(uint64_t _res) {
13571         if (!ptr_is_owned(_res)) return;
13572         void* _res_ptr = untag_ptr(_res);
13573         CHECK_ACCESS(_res_ptr);
13574         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
13575         FREE(untag_ptr(_res));
13576         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
13577 }
13578
13579 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
13580         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13581         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
13582         return tag_ptr(ret_conv, true);
13583 }
13584 int64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(uint64_t arg) {
13585         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
13586         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
13587         return ret_conv;
13588 }
13589
13590 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone(uint64_t orig) {
13591         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
13592         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13593         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
13594         return tag_ptr(ret_conv, true);
13595 }
13596
13597 uint64_t  __attribute__((export_name("TS_COption_u128Z_some"))) TS_COption_u128Z_some(int8_tArray o) {
13598         LDKU128 o_ref;
13599         CHECK(o->arr_len == 16);
13600         memcpy(o_ref.le_bytes, o->elems, 16); FREE(o);
13601         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
13602         *ret_copy = COption_u128Z_some(o_ref);
13603         uint64_t ret_ref = tag_ptr(ret_copy, true);
13604         return ret_ref;
13605 }
13606
13607 uint64_t  __attribute__((export_name("TS_COption_u128Z_none"))) TS_COption_u128Z_none() {
13608         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
13609         *ret_copy = COption_u128Z_none();
13610         uint64_t ret_ref = tag_ptr(ret_copy, true);
13611         return ret_ref;
13612 }
13613
13614 void  __attribute__((export_name("TS_COption_u128Z_free"))) TS_COption_u128Z_free(uint64_t _res) {
13615         if (!ptr_is_owned(_res)) return;
13616         void* _res_ptr = untag_ptr(_res);
13617         CHECK_ACCESS(_res_ptr);
13618         LDKCOption_u128Z _res_conv = *(LDKCOption_u128Z*)(_res_ptr);
13619         FREE(untag_ptr(_res));
13620         COption_u128Z_free(_res_conv);
13621 }
13622
13623 static inline uint64_t COption_u128Z_clone_ptr(LDKCOption_u128Z *NONNULL_PTR arg) {
13624         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
13625         *ret_copy = COption_u128Z_clone(arg);
13626         uint64_t ret_ref = tag_ptr(ret_copy, true);
13627         return ret_ref;
13628 }
13629 int64_t  __attribute__((export_name("TS_COption_u128Z_clone_ptr"))) TS_COption_u128Z_clone_ptr(uint64_t arg) {
13630         LDKCOption_u128Z* arg_conv = (LDKCOption_u128Z*)untag_ptr(arg);
13631         int64_t ret_conv = COption_u128Z_clone_ptr(arg_conv);
13632         return ret_conv;
13633 }
13634
13635 uint64_t  __attribute__((export_name("TS_COption_u128Z_clone"))) TS_COption_u128Z_clone(uint64_t orig) {
13636         LDKCOption_u128Z* orig_conv = (LDKCOption_u128Z*)untag_ptr(orig);
13637         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
13638         *ret_copy = COption_u128Z_clone(orig_conv);
13639         uint64_t ret_ref = tag_ptr(ret_copy, true);
13640         return ret_ref;
13641 }
13642
13643 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_some"))) TS_COption_NetworkUpdateZ_some(uint64_t o) {
13644         void* o_ptr = untag_ptr(o);
13645         CHECK_ACCESS(o_ptr);
13646         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
13647         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
13648         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13649         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
13650         uint64_t ret_ref = tag_ptr(ret_copy, true);
13651         return ret_ref;
13652 }
13653
13654 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_none"))) TS_COption_NetworkUpdateZ_none() {
13655         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13656         *ret_copy = COption_NetworkUpdateZ_none();
13657         uint64_t ret_ref = tag_ptr(ret_copy, true);
13658         return ret_ref;
13659 }
13660
13661 void  __attribute__((export_name("TS_COption_NetworkUpdateZ_free"))) TS_COption_NetworkUpdateZ_free(uint64_t _res) {
13662         if (!ptr_is_owned(_res)) return;
13663         void* _res_ptr = untag_ptr(_res);
13664         CHECK_ACCESS(_res_ptr);
13665         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
13666         FREE(untag_ptr(_res));
13667         COption_NetworkUpdateZ_free(_res_conv);
13668 }
13669
13670 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
13671         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13672         *ret_copy = COption_NetworkUpdateZ_clone(arg);
13673         uint64_t ret_ref = tag_ptr(ret_copy, true);
13674         return ret_ref;
13675 }
13676 int64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone_ptr"))) TS_COption_NetworkUpdateZ_clone_ptr(uint64_t arg) {
13677         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
13678         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
13679         return ret_conv;
13680 }
13681
13682 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone"))) TS_COption_NetworkUpdateZ_clone(uint64_t orig) {
13683         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
13684         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13685         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
13686         uint64_t ret_ref = tag_ptr(ret_copy, true);
13687         return ret_ref;
13688 }
13689
13690 void  __attribute__((export_name("TS_CVec_SpendableOutputDescriptorZ_free"))) TS_CVec_SpendableOutputDescriptorZ_free(uint64_tArray _res) {
13691         LDKCVec_SpendableOutputDescriptorZ _res_constr;
13692         _res_constr.datalen = _res->arr_len;
13693         if (_res_constr.datalen > 0)
13694                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
13695         else
13696                 _res_constr.data = NULL;
13697         uint64_t* _res_vals = _res->elems;
13698         for (size_t b = 0; b < _res_constr.datalen; b++) {
13699                 uint64_t _res_conv_27 = _res_vals[b];
13700                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
13701                 CHECK_ACCESS(_res_conv_27_ptr);
13702                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
13703                 FREE(untag_ptr(_res_conv_27));
13704                 _res_constr.data[b] = _res_conv_27_conv;
13705         }
13706         FREE(_res);
13707         CVec_SpendableOutputDescriptorZ_free(_res_constr);
13708 }
13709
13710 uint64_t  __attribute__((export_name("TS_COption_EventZ_some"))) TS_COption_EventZ_some(uint64_t o) {
13711         void* o_ptr = untag_ptr(o);
13712         CHECK_ACCESS(o_ptr);
13713         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
13714         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
13715         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13716         *ret_copy = COption_EventZ_some(o_conv);
13717         uint64_t ret_ref = tag_ptr(ret_copy, true);
13718         return ret_ref;
13719 }
13720
13721 uint64_t  __attribute__((export_name("TS_COption_EventZ_none"))) TS_COption_EventZ_none() {
13722         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13723         *ret_copy = COption_EventZ_none();
13724         uint64_t ret_ref = tag_ptr(ret_copy, true);
13725         return ret_ref;
13726 }
13727
13728 void  __attribute__((export_name("TS_COption_EventZ_free"))) TS_COption_EventZ_free(uint64_t _res) {
13729         if (!ptr_is_owned(_res)) return;
13730         void* _res_ptr = untag_ptr(_res);
13731         CHECK_ACCESS(_res_ptr);
13732         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
13733         FREE(untag_ptr(_res));
13734         COption_EventZ_free(_res_conv);
13735 }
13736
13737 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
13738         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13739         *ret_copy = COption_EventZ_clone(arg);
13740         uint64_t ret_ref = tag_ptr(ret_copy, true);
13741         return ret_ref;
13742 }
13743 int64_t  __attribute__((export_name("TS_COption_EventZ_clone_ptr"))) TS_COption_EventZ_clone_ptr(uint64_t arg) {
13744         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
13745         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
13746         return ret_conv;
13747 }
13748
13749 uint64_t  __attribute__((export_name("TS_COption_EventZ_clone"))) TS_COption_EventZ_clone(uint64_t orig) {
13750         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
13751         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13752         *ret_copy = COption_EventZ_clone(orig_conv);
13753         uint64_t ret_ref = tag_ptr(ret_copy, true);
13754         return ret_ref;
13755 }
13756
13757 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_ok"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint64_t o) {
13758         void* o_ptr = untag_ptr(o);
13759         CHECK_ACCESS(o_ptr);
13760         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
13761         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
13762         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13763         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
13764         return tag_ptr(ret_conv, true);
13765 }
13766
13767 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_err"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint64_t e) {
13768         void* e_ptr = untag_ptr(e);
13769         CHECK_ACCESS(e_ptr);
13770         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
13771         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
13772         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13773         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
13774         return tag_ptr(ret_conv, true);
13775 }
13776
13777 jboolean  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_is_ok"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint64_t o) {
13778         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
13779         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
13780         return ret_conv;
13781 }
13782
13783 void  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_free"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint64_t _res) {
13784         if (!ptr_is_owned(_res)) return;
13785         void* _res_ptr = untag_ptr(_res);
13786         CHECK_ACCESS(_res_ptr);
13787         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
13788         FREE(untag_ptr(_res));
13789         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
13790 }
13791
13792 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
13793         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13794         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
13795         return tag_ptr(ret_conv, true);
13796 }
13797 int64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint64_t arg) {
13798         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
13799         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
13800         return ret_conv;
13801 }
13802
13803 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint64_t orig) {
13804         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
13805         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13806         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
13807         return tag_ptr(ret_conv, true);
13808 }
13809
13810 void  __attribute__((export_name("TS_CVec_MessageSendEventZ_free"))) TS_CVec_MessageSendEventZ_free(uint64_tArray _res) {
13811         LDKCVec_MessageSendEventZ _res_constr;
13812         _res_constr.datalen = _res->arr_len;
13813         if (_res_constr.datalen > 0)
13814                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
13815         else
13816                 _res_constr.data = NULL;
13817         uint64_t* _res_vals = _res->elems;
13818         for (size_t s = 0; s < _res_constr.datalen; s++) {
13819                 uint64_t _res_conv_18 = _res_vals[s];
13820                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
13821                 CHECK_ACCESS(_res_conv_18_ptr);
13822                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
13823                 FREE(untag_ptr(_res_conv_18));
13824                 _res_constr.data[s] = _res_conv_18_conv;
13825         }
13826         FREE(_res);
13827         CVec_MessageSendEventZ_free(_res_constr);
13828 }
13829
13830 uint64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_ok"))) TS_CResult_TxOutAccessErrorZ_ok(uint64_t o) {
13831         void* o_ptr = untag_ptr(o);
13832         CHECK_ACCESS(o_ptr);
13833         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
13834         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
13835         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
13836         *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
13837         return tag_ptr(ret_conv, true);
13838 }
13839
13840 uint64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_err"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
13841         LDKAccessError e_conv = LDKAccessError_from_js(e);
13842         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
13843         *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
13844         return tag_ptr(ret_conv, true);
13845 }
13846
13847 jboolean  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_is_ok"))) TS_CResult_TxOutAccessErrorZ_is_ok(uint64_t o) {
13848         LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(o);
13849         jboolean ret_conv = CResult_TxOutAccessErrorZ_is_ok(o_conv);
13850         return ret_conv;
13851 }
13852
13853 void  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_free"))) TS_CResult_TxOutAccessErrorZ_free(uint64_t _res) {
13854         if (!ptr_is_owned(_res)) return;
13855         void* _res_ptr = untag_ptr(_res);
13856         CHECK_ACCESS(_res_ptr);
13857         LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
13858         FREE(untag_ptr(_res));
13859         CResult_TxOutAccessErrorZ_free(_res_conv);
13860 }
13861
13862 static inline uint64_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
13863         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
13864         *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
13865         return tag_ptr(ret_conv, true);
13866 }
13867 int64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone_ptr"))) TS_CResult_TxOutAccessErrorZ_clone_ptr(uint64_t arg) {
13868         LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(arg);
13869         int64_t ret_conv = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
13870         return ret_conv;
13871 }
13872
13873 uint64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone"))) TS_CResult_TxOutAccessErrorZ_clone(uint64_t orig) {
13874         LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(orig);
13875         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
13876         *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
13877         return tag_ptr(ret_conv, true);
13878 }
13879
13880 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
13881         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13882         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
13883         return tag_ptr(ret_conv, true);
13884 }
13885 int64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone_ptr"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint64_t arg) {
13886         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
13887         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
13888         return ret_conv;
13889 }
13890
13891 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone"))) TS_C2Tuple_usizeTransactionZ_clone(uint64_t orig) {
13892         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
13893         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13894         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
13895         return tag_ptr(ret_conv, true);
13896 }
13897
13898 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_new"))) TS_C2Tuple_usizeTransactionZ_new(uint32_t a, int8_tArray b) {
13899         LDKTransaction b_ref;
13900         b_ref.datalen = b->arr_len;
13901         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
13902         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
13903         b_ref.data_is_owned = true;
13904         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13905         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
13906         return tag_ptr(ret_conv, true);
13907 }
13908
13909 void  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_free"))) TS_C2Tuple_usizeTransactionZ_free(uint64_t _res) {
13910         if (!ptr_is_owned(_res)) return;
13911         void* _res_ptr = untag_ptr(_res);
13912         CHECK_ACCESS(_res_ptr);
13913         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
13914         FREE(untag_ptr(_res));
13915         C2Tuple_usizeTransactionZ_free(_res_conv);
13916 }
13917
13918 void  __attribute__((export_name("TS_CVec_C2Tuple_usizeTransactionZZ_free"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint64_tArray _res) {
13919         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
13920         _res_constr.datalen = _res->arr_len;
13921         if (_res_constr.datalen > 0)
13922                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
13923         else
13924                 _res_constr.data = NULL;
13925         uint64_t* _res_vals = _res->elems;
13926         for (size_t c = 0; c < _res_constr.datalen; c++) {
13927                 uint64_t _res_conv_28 = _res_vals[c];
13928                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
13929                 CHECK_ACCESS(_res_conv_28_ptr);
13930                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
13931                 FREE(untag_ptr(_res_conv_28));
13932                 _res_constr.data[c] = _res_conv_28_conv;
13933         }
13934         FREE(_res);
13935         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
13936 }
13937
13938 static inline uint64_t C2Tuple_TxidBlockHashZ_clone_ptr(LDKC2Tuple_TxidBlockHashZ *NONNULL_PTR arg) {
13939         LDKC2Tuple_TxidBlockHashZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
13940         *ret_conv = C2Tuple_TxidBlockHashZ_clone(arg);
13941         return tag_ptr(ret_conv, true);
13942 }
13943 int64_t  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_clone_ptr"))) TS_C2Tuple_TxidBlockHashZ_clone_ptr(uint64_t arg) {
13944         LDKC2Tuple_TxidBlockHashZ* arg_conv = (LDKC2Tuple_TxidBlockHashZ*)untag_ptr(arg);
13945         int64_t ret_conv = C2Tuple_TxidBlockHashZ_clone_ptr(arg_conv);
13946         return ret_conv;
13947 }
13948
13949 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_clone"))) TS_C2Tuple_TxidBlockHashZ_clone(uint64_t orig) {
13950         LDKC2Tuple_TxidBlockHashZ* orig_conv = (LDKC2Tuple_TxidBlockHashZ*)untag_ptr(orig);
13951         LDKC2Tuple_TxidBlockHashZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
13952         *ret_conv = C2Tuple_TxidBlockHashZ_clone(orig_conv);
13953         return tag_ptr(ret_conv, true);
13954 }
13955
13956 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_new"))) TS_C2Tuple_TxidBlockHashZ_new(int8_tArray a, int8_tArray b) {
13957         LDKThirtyTwoBytes a_ref;
13958         CHECK(a->arr_len == 32);
13959         memcpy(a_ref.data, a->elems, 32); FREE(a);
13960         LDKThirtyTwoBytes b_ref;
13961         CHECK(b->arr_len == 32);
13962         memcpy(b_ref.data, b->elems, 32); FREE(b);
13963         LDKC2Tuple_TxidBlockHashZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
13964         *ret_conv = C2Tuple_TxidBlockHashZ_new(a_ref, b_ref);
13965         return tag_ptr(ret_conv, true);
13966 }
13967
13968 void  __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_free"))) TS_C2Tuple_TxidBlockHashZ_free(uint64_t _res) {
13969         if (!ptr_is_owned(_res)) return;
13970         void* _res_ptr = untag_ptr(_res);
13971         CHECK_ACCESS(_res_ptr);
13972         LDKC2Tuple_TxidBlockHashZ _res_conv = *(LDKC2Tuple_TxidBlockHashZ*)(_res_ptr);
13973         FREE(untag_ptr(_res));
13974         C2Tuple_TxidBlockHashZ_free(_res_conv);
13975 }
13976
13977 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidBlockHashZZ_free"))) TS_CVec_C2Tuple_TxidBlockHashZZ_free(uint64_tArray _res) {
13978         LDKCVec_C2Tuple_TxidBlockHashZZ _res_constr;
13979         _res_constr.datalen = _res->arr_len;
13980         if (_res_constr.datalen > 0)
13981                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKCVec_C2Tuple_TxidBlockHashZZ Elements");
13982         else
13983                 _res_constr.data = NULL;
13984         uint64_t* _res_vals = _res->elems;
13985         for (size_t z = 0; z < _res_constr.datalen; z++) {
13986                 uint64_t _res_conv_25 = _res_vals[z];
13987                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
13988                 CHECK_ACCESS(_res_conv_25_ptr);
13989                 LDKC2Tuple_TxidBlockHashZ _res_conv_25_conv = *(LDKC2Tuple_TxidBlockHashZ*)(_res_conv_25_ptr);
13990                 FREE(untag_ptr(_res_conv_25));
13991                 _res_constr.data[z] = _res_conv_25_conv;
13992         }
13993         FREE(_res);
13994         CVec_C2Tuple_TxidBlockHashZZ_free(_res_constr);
13995 }
13996
13997 void  __attribute__((export_name("TS_CVec_MonitorEventZ_free"))) TS_CVec_MonitorEventZ_free(uint64_tArray _res) {
13998         LDKCVec_MonitorEventZ _res_constr;
13999         _res_constr.datalen = _res->arr_len;
14000         if (_res_constr.datalen > 0)
14001                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
14002         else
14003                 _res_constr.data = NULL;
14004         uint64_t* _res_vals = _res->elems;
14005         for (size_t o = 0; o < _res_constr.datalen; o++) {
14006                 uint64_t _res_conv_14 = _res_vals[o];
14007                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
14008                 CHECK_ACCESS(_res_conv_14_ptr);
14009                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
14010                 FREE(untag_ptr(_res_conv_14));
14011                 _res_constr.data[o] = _res_conv_14_conv;
14012         }
14013         FREE(_res);
14014         CVec_MonitorEventZ_free(_res_constr);
14015 }
14016
14017 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
14018         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
14019         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
14020         return tag_ptr(ret_conv, true);
14021 }
14022 int64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(uint64_t arg) {
14023         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
14024         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
14025         return ret_conv;
14026 }
14027
14028 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(uint64_t orig) {
14029         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
14030         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
14031         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
14032         return tag_ptr(ret_conv, true);
14033 }
14034
14035 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(uint64_t a, uint64_tArray b, int8_tArray c) {
14036         LDKOutPoint a_conv;
14037         a_conv.inner = untag_ptr(a);
14038         a_conv.is_owned = ptr_is_owned(a);
14039         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
14040         a_conv = OutPoint_clone(&a_conv);
14041         LDKCVec_MonitorEventZ b_constr;
14042         b_constr.datalen = b->arr_len;
14043         if (b_constr.datalen > 0)
14044                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
14045         else
14046                 b_constr.data = NULL;
14047         uint64_t* b_vals = b->elems;
14048         for (size_t o = 0; o < b_constr.datalen; o++) {
14049                 uint64_t b_conv_14 = b_vals[o];
14050                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
14051                 CHECK_ACCESS(b_conv_14_ptr);
14052                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
14053                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
14054                 b_constr.data[o] = b_conv_14_conv;
14055         }
14056         FREE(b);
14057         LDKPublicKey c_ref;
14058         CHECK(c->arr_len == 33);
14059         memcpy(c_ref.compressed_form, c->elems, 33); FREE(c);
14060         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
14061         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
14062         return tag_ptr(ret_conv, true);
14063 }
14064
14065 void  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(uint64_t _res) {
14066         if (!ptr_is_owned(_res)) return;
14067         void* _res_ptr = untag_ptr(_res);
14068         CHECK_ACCESS(_res_ptr);
14069         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
14070         FREE(untag_ptr(_res));
14071         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
14072 }
14073
14074 void  __attribute__((export_name("TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free"))) TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(uint64_tArray _res) {
14075         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
14076         _res_constr.datalen = _res->arr_len;
14077         if (_res_constr.datalen > 0)
14078                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
14079         else
14080                 _res_constr.data = NULL;
14081         uint64_t* _res_vals = _res->elems;
14082         for (size_t x = 0; x < _res_constr.datalen; x++) {
14083                 uint64_t _res_conv_49 = _res_vals[x];
14084                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
14085                 CHECK_ACCESS(_res_conv_49_ptr);
14086                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
14087                 FREE(untag_ptr(_res_conv_49));
14088                 _res_constr.data[x] = _res_conv_49_conv;
14089         }
14090         FREE(_res);
14091         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
14092 }
14093
14094 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok(uint64_t o) {
14095         LDKFixedPenaltyScorer o_conv;
14096         o_conv.inner = untag_ptr(o);
14097         o_conv.is_owned = ptr_is_owned(o);
14098         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14099         o_conv = FixedPenaltyScorer_clone(&o_conv);
14100         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
14101         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
14102         return tag_ptr(ret_conv, true);
14103 }
14104
14105 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_err(uint64_t e) {
14106         void* e_ptr = untag_ptr(e);
14107         CHECK_ACCESS(e_ptr);
14108         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14109         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14110         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
14111         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
14112         return tag_ptr(ret_conv, true);
14113 }
14114
14115 jboolean  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(uint64_t o) {
14116         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
14117         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
14118         return ret_conv;
14119 }
14120
14121 void  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_free"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_free(uint64_t _res) {
14122         if (!ptr_is_owned(_res)) return;
14123         void* _res_ptr = untag_ptr(_res);
14124         CHECK_ACCESS(_res_ptr);
14125         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
14126         FREE(untag_ptr(_res));
14127         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
14128 }
14129
14130 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
14131         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
14132         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
14133         return tag_ptr(ret_conv, true);
14134 }
14135 int64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(uint64_t arg) {
14136         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
14137         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
14138         return ret_conv;
14139 }
14140
14141 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone(uint64_t orig) {
14142         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
14143         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
14144         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
14145         return tag_ptr(ret_conv, true);
14146 }
14147
14148 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
14149         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
14150         *ret_conv = C2Tuple_u64u64Z_clone(arg);
14151         return tag_ptr(ret_conv, true);
14152 }
14153 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone_ptr"))) TS_C2Tuple_u64u64Z_clone_ptr(uint64_t arg) {
14154         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
14155         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
14156         return ret_conv;
14157 }
14158
14159 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone"))) TS_C2Tuple_u64u64Z_clone(uint64_t orig) {
14160         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
14161         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
14162         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
14163         return tag_ptr(ret_conv, true);
14164 }
14165
14166 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_new"))) TS_C2Tuple_u64u64Z_new(int64_t a, int64_t b) {
14167         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
14168         *ret_conv = C2Tuple_u64u64Z_new(a, b);
14169         return tag_ptr(ret_conv, true);
14170 }
14171
14172 void  __attribute__((export_name("TS_C2Tuple_u64u64Z_free"))) TS_C2Tuple_u64u64Z_free(uint64_t _res) {
14173         if (!ptr_is_owned(_res)) return;
14174         void* _res_ptr = untag_ptr(_res);
14175         CHECK_ACCESS(_res_ptr);
14176         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
14177         FREE(untag_ptr(_res));
14178         C2Tuple_u64u64Z_free(_res_conv);
14179 }
14180
14181 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_some"))) TS_COption_C2Tuple_u64u64ZZ_some(uint64_t o) {
14182         void* o_ptr = untag_ptr(o);
14183         CHECK_ACCESS(o_ptr);
14184         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
14185         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
14186         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
14187         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
14188         uint64_t ret_ref = tag_ptr(ret_copy, true);
14189         return ret_ref;
14190 }
14191
14192 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_none"))) TS_COption_C2Tuple_u64u64ZZ_none() {
14193         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
14194         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
14195         uint64_t ret_ref = tag_ptr(ret_copy, true);
14196         return ret_ref;
14197 }
14198
14199 void  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_free"))) TS_COption_C2Tuple_u64u64ZZ_free(uint64_t _res) {
14200         if (!ptr_is_owned(_res)) return;
14201         void* _res_ptr = untag_ptr(_res);
14202         CHECK_ACCESS(_res_ptr);
14203         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
14204         FREE(untag_ptr(_res));
14205         COption_C2Tuple_u64u64ZZ_free(_res_conv);
14206 }
14207
14208 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
14209         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
14210         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
14211         uint64_t ret_ref = tag_ptr(ret_copy, true);
14212         return ret_ref;
14213 }
14214 int64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone_ptr"))) TS_COption_C2Tuple_u64u64ZZ_clone_ptr(uint64_t arg) {
14215         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
14216         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
14217         return ret_conv;
14218 }
14219
14220 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone"))) TS_COption_C2Tuple_u64u64ZZ_clone(uint64_t orig) {
14221         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
14222         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
14223         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
14224         uint64_t ret_ref = tag_ptr(ret_copy, true);
14225         return ret_ref;
14226 }
14227
14228 void  __attribute__((export_name("TS_CVec_NodeIdZ_free"))) TS_CVec_NodeIdZ_free(uint64_tArray _res) {
14229         LDKCVec_NodeIdZ _res_constr;
14230         _res_constr.datalen = _res->arr_len;
14231         if (_res_constr.datalen > 0)
14232                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
14233         else
14234                 _res_constr.data = NULL;
14235         uint64_t* _res_vals = _res->elems;
14236         for (size_t i = 0; i < _res_constr.datalen; i++) {
14237                 uint64_t _res_conv_8 = _res_vals[i];
14238                 LDKNodeId _res_conv_8_conv;
14239                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
14240                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
14241                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
14242                 _res_constr.data[i] = _res_conv_8_conv;
14243         }
14244         FREE(_res);
14245         CVec_NodeIdZ_free(_res_constr);
14246 }
14247
14248 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_ok(uint64_t o) {
14249         LDKProbabilisticScorer o_conv;
14250         o_conv.inner = untag_ptr(o);
14251         o_conv.is_owned = ptr_is_owned(o);
14252         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14253         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
14254         
14255         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
14256         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
14257         return tag_ptr(ret_conv, true);
14258 }
14259
14260 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_err(uint64_t e) {
14261         void* e_ptr = untag_ptr(e);
14262         CHECK_ACCESS(e_ptr);
14263         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14264         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14265         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
14266         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
14267         return tag_ptr(ret_conv, true);
14268 }
14269
14270 jboolean  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok(uint64_t o) {
14271         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
14272         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
14273         return ret_conv;
14274 }
14275
14276 void  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_free"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_free(uint64_t _res) {
14277         if (!ptr_is_owned(_res)) return;
14278         void* _res_ptr = untag_ptr(_res);
14279         CHECK_ACCESS(_res_ptr);
14280         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
14281         FREE(untag_ptr(_res));
14282         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
14283 }
14284
14285 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint64_t o) {
14286         LDKInitFeatures o_conv;
14287         o_conv.inner = untag_ptr(o);
14288         o_conv.is_owned = ptr_is_owned(o);
14289         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14290         o_conv = InitFeatures_clone(&o_conv);
14291         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
14292         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
14293         return tag_ptr(ret_conv, true);
14294 }
14295
14296 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_err"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint64_t e) {
14297         void* e_ptr = untag_ptr(e);
14298         CHECK_ACCESS(e_ptr);
14299         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14300         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14301         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
14302         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
14303         return tag_ptr(ret_conv, true);
14304 }
14305
14306 jboolean  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14307         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
14308         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
14309         return ret_conv;
14310 }
14311
14312 void  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_free"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint64_t _res) {
14313         if (!ptr_is_owned(_res)) return;
14314         void* _res_ptr = untag_ptr(_res);
14315         CHECK_ACCESS(_res_ptr);
14316         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
14317         FREE(untag_ptr(_res));
14318         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
14319 }
14320
14321 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14322         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
14323         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
14324         return tag_ptr(ret_conv, true);
14325 }
14326 int64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14327         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
14328         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14329         return ret_conv;
14330 }
14331
14332 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone"))) TS_CResult_InitFeaturesDecodeErrorZ_clone(uint64_t orig) {
14333         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
14334         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
14335         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
14336         return tag_ptr(ret_conv, true);
14337 }
14338
14339 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint64_t o) {
14340         LDKChannelFeatures o_conv;
14341         o_conv.inner = untag_ptr(o);
14342         o_conv.is_owned = ptr_is_owned(o);
14343         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14344         o_conv = ChannelFeatures_clone(&o_conv);
14345         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
14346         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
14347         return tag_ptr(ret_conv, true);
14348 }
14349
14350 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint64_t e) {
14351         void* e_ptr = untag_ptr(e);
14352         CHECK_ACCESS(e_ptr);
14353         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14354         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14355         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
14356         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
14357         return tag_ptr(ret_conv, true);
14358 }
14359
14360 jboolean  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14361         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
14362         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
14363         return ret_conv;
14364 }
14365
14366 void  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint64_t _res) {
14367         if (!ptr_is_owned(_res)) return;
14368         void* _res_ptr = untag_ptr(_res);
14369         CHECK_ACCESS(_res_ptr);
14370         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
14371         FREE(untag_ptr(_res));
14372         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
14373 }
14374
14375 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14376         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
14377         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
14378         return tag_ptr(ret_conv, true);
14379 }
14380 int64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14381         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
14382         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14383         return ret_conv;
14384 }
14385
14386 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone(uint64_t orig) {
14387         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
14388         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
14389         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
14390         return tag_ptr(ret_conv, true);
14391 }
14392
14393 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint64_t o) {
14394         LDKNodeFeatures o_conv;
14395         o_conv.inner = untag_ptr(o);
14396         o_conv.is_owned = ptr_is_owned(o);
14397         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14398         o_conv = NodeFeatures_clone(&o_conv);
14399         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
14400         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
14401         return tag_ptr(ret_conv, true);
14402 }
14403
14404 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint64_t e) {
14405         void* e_ptr = untag_ptr(e);
14406         CHECK_ACCESS(e_ptr);
14407         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14408         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14409         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
14410         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
14411         return tag_ptr(ret_conv, true);
14412 }
14413
14414 jboolean  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14415         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
14416         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
14417         return ret_conv;
14418 }
14419
14420 void  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_free"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint64_t _res) {
14421         if (!ptr_is_owned(_res)) return;
14422         void* _res_ptr = untag_ptr(_res);
14423         CHECK_ACCESS(_res_ptr);
14424         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
14425         FREE(untag_ptr(_res));
14426         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
14427 }
14428
14429 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14430         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
14431         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
14432         return tag_ptr(ret_conv, true);
14433 }
14434 int64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14435         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
14436         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14437         return ret_conv;
14438 }
14439
14440 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone(uint64_t orig) {
14441         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
14442         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
14443         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
14444         return tag_ptr(ret_conv, true);
14445 }
14446
14447 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
14448         LDKInvoiceFeatures o_conv;
14449         o_conv.inner = untag_ptr(o);
14450         o_conv.is_owned = ptr_is_owned(o);
14451         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14452         o_conv = InvoiceFeatures_clone(&o_conv);
14453         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
14454         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
14455         return tag_ptr(ret_conv, true);
14456 }
14457
14458 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
14459         void* e_ptr = untag_ptr(e);
14460         CHECK_ACCESS(e_ptr);
14461         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14462         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14463         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
14464         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
14465         return tag_ptr(ret_conv, true);
14466 }
14467
14468 jboolean  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14469         LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
14470         jboolean ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
14471         return ret_conv;
14472 }
14473
14474 void  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
14475         if (!ptr_is_owned(_res)) return;
14476         void* _res_ptr = untag_ptr(_res);
14477         CHECK_ACCESS(_res_ptr);
14478         LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
14479         FREE(untag_ptr(_res));
14480         CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
14481 }
14482
14483 static inline uint64_t CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14484         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
14485         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(arg);
14486         return tag_ptr(ret_conv, true);
14487 }
14488 int64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14489         LDKCResult_InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
14490         int64_t ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14491         return ret_conv;
14492 }
14493
14494 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
14495         LDKCResult_InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
14496         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
14497         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
14498         return tag_ptr(ret_conv, true);
14499 }
14500
14501 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint64_t o) {
14502         LDKChannelTypeFeatures o_conv;
14503         o_conv.inner = untag_ptr(o);
14504         o_conv.is_owned = ptr_is_owned(o);
14505         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14506         o_conv = ChannelTypeFeatures_clone(&o_conv);
14507         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14508         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
14509         return tag_ptr(ret_conv, true);
14510 }
14511
14512 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint64_t e) {
14513         void* e_ptr = untag_ptr(e);
14514         CHECK_ACCESS(e_ptr);
14515         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14516         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14517         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14518         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
14519         return tag_ptr(ret_conv, true);
14520 }
14521
14522 jboolean  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14523         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
14524         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
14525         return ret_conv;
14526 }
14527
14528 void  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint64_t _res) {
14529         if (!ptr_is_owned(_res)) return;
14530         void* _res_ptr = untag_ptr(_res);
14531         CHECK_ACCESS(_res_ptr);
14532         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
14533         FREE(untag_ptr(_res));
14534         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
14535 }
14536
14537 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14538         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14539         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
14540         return tag_ptr(ret_conv, true);
14541 }
14542 int64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14543         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
14544         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14545         return ret_conv;
14546 }
14547
14548 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone(uint64_t orig) {
14549         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
14550         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14551         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
14552         return tag_ptr(ret_conv, true);
14553 }
14554
14555 uint64_t  __attribute__((export_name("TS_CResult_OfferFeaturesDecodeErrorZ_ok"))) TS_CResult_OfferFeaturesDecodeErrorZ_ok(uint64_t o) {
14556         LDKOfferFeatures o_conv;
14557         o_conv.inner = untag_ptr(o);
14558         o_conv.is_owned = ptr_is_owned(o);
14559         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14560         o_conv = OfferFeatures_clone(&o_conv);
14561         LDKCResult_OfferFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferFeaturesDecodeErrorZ), "LDKCResult_OfferFeaturesDecodeErrorZ");
14562         *ret_conv = CResult_OfferFeaturesDecodeErrorZ_ok(o_conv);
14563         return tag_ptr(ret_conv, true);
14564 }
14565
14566 uint64_t  __attribute__((export_name("TS_CResult_OfferFeaturesDecodeErrorZ_err"))) TS_CResult_OfferFeaturesDecodeErrorZ_err(uint64_t e) {
14567         void* e_ptr = untag_ptr(e);
14568         CHECK_ACCESS(e_ptr);
14569         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14570         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14571         LDKCResult_OfferFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferFeaturesDecodeErrorZ), "LDKCResult_OfferFeaturesDecodeErrorZ");
14572         *ret_conv = CResult_OfferFeaturesDecodeErrorZ_err(e_conv);
14573         return tag_ptr(ret_conv, true);
14574 }
14575
14576 jboolean  __attribute__((export_name("TS_CResult_OfferFeaturesDecodeErrorZ_is_ok"))) TS_CResult_OfferFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14577         LDKCResult_OfferFeaturesDecodeErrorZ* o_conv = (LDKCResult_OfferFeaturesDecodeErrorZ*)untag_ptr(o);
14578         jboolean ret_conv = CResult_OfferFeaturesDecodeErrorZ_is_ok(o_conv);
14579         return ret_conv;
14580 }
14581
14582 void  __attribute__((export_name("TS_CResult_OfferFeaturesDecodeErrorZ_free"))) TS_CResult_OfferFeaturesDecodeErrorZ_free(uint64_t _res) {
14583         if (!ptr_is_owned(_res)) return;
14584         void* _res_ptr = untag_ptr(_res);
14585         CHECK_ACCESS(_res_ptr);
14586         LDKCResult_OfferFeaturesDecodeErrorZ _res_conv = *(LDKCResult_OfferFeaturesDecodeErrorZ*)(_res_ptr);
14587         FREE(untag_ptr(_res));
14588         CResult_OfferFeaturesDecodeErrorZ_free(_res_conv);
14589 }
14590
14591 static inline uint64_t CResult_OfferFeaturesDecodeErrorZ_clone_ptr(LDKCResult_OfferFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14592         LDKCResult_OfferFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferFeaturesDecodeErrorZ), "LDKCResult_OfferFeaturesDecodeErrorZ");
14593         *ret_conv = CResult_OfferFeaturesDecodeErrorZ_clone(arg);
14594         return tag_ptr(ret_conv, true);
14595 }
14596 int64_t  __attribute__((export_name("TS_CResult_OfferFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_OfferFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14597         LDKCResult_OfferFeaturesDecodeErrorZ* arg_conv = (LDKCResult_OfferFeaturesDecodeErrorZ*)untag_ptr(arg);
14598         int64_t ret_conv = CResult_OfferFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14599         return ret_conv;
14600 }
14601
14602 uint64_t  __attribute__((export_name("TS_CResult_OfferFeaturesDecodeErrorZ_clone"))) TS_CResult_OfferFeaturesDecodeErrorZ_clone(uint64_t orig) {
14603         LDKCResult_OfferFeaturesDecodeErrorZ* orig_conv = (LDKCResult_OfferFeaturesDecodeErrorZ*)untag_ptr(orig);
14604         LDKCResult_OfferFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferFeaturesDecodeErrorZ), "LDKCResult_OfferFeaturesDecodeErrorZ");
14605         *ret_conv = CResult_OfferFeaturesDecodeErrorZ_clone(orig_conv);
14606         return tag_ptr(ret_conv, true);
14607 }
14608
14609 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_ok"))) TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_ok(uint64_t o) {
14610         LDKInvoiceRequestFeatures o_conv;
14611         o_conv.inner = untag_ptr(o);
14612         o_conv.is_owned = ptr_is_owned(o);
14613         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14614         o_conv = InvoiceRequestFeatures_clone(&o_conv);
14615         LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ), "LDKCResult_InvoiceRequestFeaturesDecodeErrorZ");
14616         *ret_conv = CResult_InvoiceRequestFeaturesDecodeErrorZ_ok(o_conv);
14617         return tag_ptr(ret_conv, true);
14618 }
14619
14620 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_err"))) TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_err(uint64_t e) {
14621         void* e_ptr = untag_ptr(e);
14622         CHECK_ACCESS(e_ptr);
14623         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14624         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14625         LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ), "LDKCResult_InvoiceRequestFeaturesDecodeErrorZ");
14626         *ret_conv = CResult_InvoiceRequestFeaturesDecodeErrorZ_err(e_conv);
14627         return tag_ptr(ret_conv, true);
14628 }
14629
14630 jboolean  __attribute__((export_name("TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14631         LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceRequestFeaturesDecodeErrorZ*)untag_ptr(o);
14632         jboolean ret_conv = CResult_InvoiceRequestFeaturesDecodeErrorZ_is_ok(o_conv);
14633         return ret_conv;
14634 }
14635
14636 void  __attribute__((export_name("TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_free"))) TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_free(uint64_t _res) {
14637         if (!ptr_is_owned(_res)) return;
14638         void* _res_ptr = untag_ptr(_res);
14639         CHECK_ACCESS(_res_ptr);
14640         LDKCResult_InvoiceRequestFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ*)(_res_ptr);
14641         FREE(untag_ptr(_res));
14642         CResult_InvoiceRequestFeaturesDecodeErrorZ_free(_res_conv);
14643 }
14644
14645 static inline uint64_t CResult_InvoiceRequestFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14646         LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ), "LDKCResult_InvoiceRequestFeaturesDecodeErrorZ");
14647         *ret_conv = CResult_InvoiceRequestFeaturesDecodeErrorZ_clone(arg);
14648         return tag_ptr(ret_conv, true);
14649 }
14650 int64_t  __attribute__((export_name("TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14651         LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InvoiceRequestFeaturesDecodeErrorZ*)untag_ptr(arg);
14652         int64_t ret_conv = CResult_InvoiceRequestFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14653         return ret_conv;
14654 }
14655
14656 uint64_t  __attribute__((export_name("TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_clone"))) TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_clone(uint64_t orig) {
14657         LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InvoiceRequestFeaturesDecodeErrorZ*)untag_ptr(orig);
14658         LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ), "LDKCResult_InvoiceRequestFeaturesDecodeErrorZ");
14659         *ret_conv = CResult_InvoiceRequestFeaturesDecodeErrorZ_clone(orig_conv);
14660         return tag_ptr(ret_conv, true);
14661 }
14662
14663 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_ok"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint64_t o) {
14664         LDKNodeId o_conv;
14665         o_conv.inner = untag_ptr(o);
14666         o_conv.is_owned = ptr_is_owned(o);
14667         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14668         o_conv = NodeId_clone(&o_conv);
14669         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14670         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
14671         return tag_ptr(ret_conv, true);
14672 }
14673
14674 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_err"))) TS_CResult_NodeIdDecodeErrorZ_err(uint64_t e) {
14675         void* e_ptr = untag_ptr(e);
14676         CHECK_ACCESS(e_ptr);
14677         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14678         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14679         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14680         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
14681         return tag_ptr(ret_conv, true);
14682 }
14683
14684 jboolean  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_is_ok"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint64_t o) {
14685         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
14686         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
14687         return ret_conv;
14688 }
14689
14690 void  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_free"))) TS_CResult_NodeIdDecodeErrorZ_free(uint64_t _res) {
14691         if (!ptr_is_owned(_res)) return;
14692         void* _res_ptr = untag_ptr(_res);
14693         CHECK_ACCESS(_res_ptr);
14694         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
14695         FREE(untag_ptr(_res));
14696         CResult_NodeIdDecodeErrorZ_free(_res_conv);
14697 }
14698
14699 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
14700         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14701         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
14702         return tag_ptr(ret_conv, true);
14703 }
14704 int64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone_ptr"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint64_t arg) {
14705         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
14706         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
14707         return ret_conv;
14708 }
14709
14710 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint64_t orig) {
14711         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
14712         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14713         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
14714         return tag_ptr(ret_conv, true);
14715 }
14716
14717 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint64_t o) {
14718         void* o_ptr = untag_ptr(o);
14719         CHECK_ACCESS(o_ptr);
14720         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
14721         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
14722         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14723         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
14724         return tag_ptr(ret_conv, true);
14725 }
14726
14727 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint64_t e) {
14728         void* e_ptr = untag_ptr(e);
14729         CHECK_ACCESS(e_ptr);
14730         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14731         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14732         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14733         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
14734         return tag_ptr(ret_conv, true);
14735 }
14736
14737 jboolean  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint64_t o) {
14738         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
14739         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
14740         return ret_conv;
14741 }
14742
14743 void  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint64_t _res) {
14744         if (!ptr_is_owned(_res)) return;
14745         void* _res_ptr = untag_ptr(_res);
14746         CHECK_ACCESS(_res_ptr);
14747         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
14748         FREE(untag_ptr(_res));
14749         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
14750 }
14751
14752 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
14753         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14754         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
14755         return tag_ptr(ret_conv, true);
14756 }
14757 int64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint64_t arg) {
14758         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
14759         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
14760         return ret_conv;
14761 }
14762
14763 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint64_t orig) {
14764         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
14765         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14766         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
14767         return tag_ptr(ret_conv, true);
14768 }
14769
14770 uint64_t  __attribute__((export_name("TS_COption_AccessZ_some"))) TS_COption_AccessZ_some(uint64_t o) {
14771         void* o_ptr = untag_ptr(o);
14772         CHECK_ACCESS(o_ptr);
14773         LDKAccess o_conv = *(LDKAccess*)(o_ptr);
14774         if (o_conv.free == LDKAccess_JCalls_free) {
14775                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14776                 LDKAccess_JCalls_cloned(&o_conv);
14777         }
14778         LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
14779         *ret_copy = COption_AccessZ_some(o_conv);
14780         uint64_t ret_ref = tag_ptr(ret_copy, true);
14781         return ret_ref;
14782 }
14783
14784 uint64_t  __attribute__((export_name("TS_COption_AccessZ_none"))) TS_COption_AccessZ_none() {
14785         LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
14786         *ret_copy = COption_AccessZ_none();
14787         uint64_t ret_ref = tag_ptr(ret_copy, true);
14788         return ret_ref;
14789 }
14790
14791 void  __attribute__((export_name("TS_COption_AccessZ_free"))) TS_COption_AccessZ_free(uint64_t _res) {
14792         if (!ptr_is_owned(_res)) return;
14793         void* _res_ptr = untag_ptr(_res);
14794         CHECK_ACCESS(_res_ptr);
14795         LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
14796         FREE(untag_ptr(_res));
14797         COption_AccessZ_free(_res_conv);
14798 }
14799
14800 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_ok"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
14801         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
14802         *ret_conv = CResult_boolLightningErrorZ_ok(o);
14803         return tag_ptr(ret_conv, true);
14804 }
14805
14806 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_err"))) TS_CResult_boolLightningErrorZ_err(uint64_t e) {
14807         LDKLightningError e_conv;
14808         e_conv.inner = untag_ptr(e);
14809         e_conv.is_owned = ptr_is_owned(e);
14810         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14811         e_conv = LightningError_clone(&e_conv);
14812         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
14813         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
14814         return tag_ptr(ret_conv, true);
14815 }
14816
14817 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_is_ok"))) TS_CResult_boolLightningErrorZ_is_ok(uint64_t o) {
14818         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
14819         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
14820         return ret_conv;
14821 }
14822
14823 void  __attribute__((export_name("TS_CResult_boolLightningErrorZ_free"))) TS_CResult_boolLightningErrorZ_free(uint64_t _res) {
14824         if (!ptr_is_owned(_res)) return;
14825         void* _res_ptr = untag_ptr(_res);
14826         CHECK_ACCESS(_res_ptr);
14827         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
14828         FREE(untag_ptr(_res));
14829         CResult_boolLightningErrorZ_free(_res_conv);
14830 }
14831
14832 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
14833         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
14834         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
14835         return tag_ptr(ret_conv, true);
14836 }
14837 int64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone_ptr"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint64_t arg) {
14838         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
14839         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
14840         return ret_conv;
14841 }
14842
14843 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone"))) TS_CResult_boolLightningErrorZ_clone(uint64_t orig) {
14844         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
14845         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
14846         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
14847         return tag_ptr(ret_conv, true);
14848 }
14849
14850 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
14851         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
14852         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
14853         return tag_ptr(ret_conv, true);
14854 }
14855 int64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint64_t arg) {
14856         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
14857         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
14858         return ret_conv;
14859 }
14860
14861 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint64_t orig) {
14862         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
14863         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
14864         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
14865         return tag_ptr(ret_conv, true);
14866 }
14867
14868 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint64_t a, uint64_t b, uint64_t c) {
14869         LDKChannelAnnouncement a_conv;
14870         a_conv.inner = untag_ptr(a);
14871         a_conv.is_owned = ptr_is_owned(a);
14872         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
14873         a_conv = ChannelAnnouncement_clone(&a_conv);
14874         LDKChannelUpdate b_conv;
14875         b_conv.inner = untag_ptr(b);
14876         b_conv.is_owned = ptr_is_owned(b);
14877         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
14878         b_conv = ChannelUpdate_clone(&b_conv);
14879         LDKChannelUpdate c_conv;
14880         c_conv.inner = untag_ptr(c);
14881         c_conv.is_owned = ptr_is_owned(c);
14882         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
14883         c_conv = ChannelUpdate_clone(&c_conv);
14884         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
14885         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
14886         return tag_ptr(ret_conv, true);
14887 }
14888
14889 void  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint64_t _res) {
14890         if (!ptr_is_owned(_res)) return;
14891         void* _res_ptr = untag_ptr(_res);
14892         CHECK_ACCESS(_res_ptr);
14893         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
14894         FREE(untag_ptr(_res));
14895         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
14896 }
14897
14898 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(uint64_t o) {
14899         void* o_ptr = untag_ptr(o);
14900         CHECK_ACCESS(o_ptr);
14901         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
14902         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
14903         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
14904         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
14905         uint64_t ret_ref = tag_ptr(ret_copy, true);
14906         return ret_ref;
14907 }
14908
14909 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() {
14910         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
14911         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
14912         uint64_t ret_ref = tag_ptr(ret_copy, true);
14913         return ret_ref;
14914 }
14915
14916 void  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint64_t _res) {
14917         if (!ptr_is_owned(_res)) return;
14918         void* _res_ptr = untag_ptr(_res);
14919         CHECK_ACCESS(_res_ptr);
14920         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
14921         FREE(untag_ptr(_res));
14922         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
14923 }
14924
14925 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
14926         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
14927         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
14928         uint64_t ret_ref = tag_ptr(ret_copy, true);
14929         return ret_ref;
14930 }
14931 int64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(uint64_t arg) {
14932         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
14933         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
14934         return ret_conv;
14935 }
14936
14937 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(uint64_t orig) {
14938         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
14939         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
14940         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
14941         uint64_t ret_ref = tag_ptr(ret_copy, true);
14942         return ret_ref;
14943 }
14944
14945 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_ok"))) TS_CResult_NoneLightningErrorZ_ok() {
14946         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14947         *ret_conv = CResult_NoneLightningErrorZ_ok();
14948         return tag_ptr(ret_conv, true);
14949 }
14950
14951 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_err"))) TS_CResult_NoneLightningErrorZ_err(uint64_t e) {
14952         LDKLightningError e_conv;
14953         e_conv.inner = untag_ptr(e);
14954         e_conv.is_owned = ptr_is_owned(e);
14955         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14956         e_conv = LightningError_clone(&e_conv);
14957         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14958         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
14959         return tag_ptr(ret_conv, true);
14960 }
14961
14962 jboolean  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_is_ok"))) TS_CResult_NoneLightningErrorZ_is_ok(uint64_t o) {
14963         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
14964         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
14965         return ret_conv;
14966 }
14967
14968 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_free"))) TS_CResult_NoneLightningErrorZ_free(uint64_t _res) {
14969         if (!ptr_is_owned(_res)) return;
14970         void* _res_ptr = untag_ptr(_res);
14971         CHECK_ACCESS(_res_ptr);
14972         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
14973         FREE(untag_ptr(_res));
14974         CResult_NoneLightningErrorZ_free(_res_conv);
14975 }
14976
14977 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
14978         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14979         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
14980         return tag_ptr(ret_conv, true);
14981 }
14982 int64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone_ptr"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint64_t arg) {
14983         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
14984         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
14985         return ret_conv;
14986 }
14987
14988 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone"))) TS_CResult_NoneLightningErrorZ_clone(uint64_t orig) {
14989         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
14990         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14991         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
14992         return tag_ptr(ret_conv, true);
14993 }
14994
14995 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok(uint64_t o) {
14996         LDKChannelUpdateInfo o_conv;
14997         o_conv.inner = untag_ptr(o);
14998         o_conv.is_owned = ptr_is_owned(o);
14999         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15000         o_conv = ChannelUpdateInfo_clone(&o_conv);
15001         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
15002         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
15003         return tag_ptr(ret_conv, true);
15004 }
15005
15006 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_err(uint64_t e) {
15007         void* e_ptr = untag_ptr(e);
15008         CHECK_ACCESS(e_ptr);
15009         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15010         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15011         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
15012         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
15013         return tag_ptr(ret_conv, true);
15014 }
15015
15016 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(uint64_t o) {
15017         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
15018         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
15019         return ret_conv;
15020 }
15021
15022 void  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_free"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_free(uint64_t _res) {
15023         if (!ptr_is_owned(_res)) return;
15024         void* _res_ptr = untag_ptr(_res);
15025         CHECK_ACCESS(_res_ptr);
15026         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
15027         FREE(untag_ptr(_res));
15028         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
15029 }
15030
15031 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
15032         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
15033         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
15034         return tag_ptr(ret_conv, true);
15035 }
15036 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
15037         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
15038         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
15039         return ret_conv;
15040 }
15041
15042 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone(uint64_t orig) {
15043         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
15044         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
15045         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
15046         return tag_ptr(ret_conv, true);
15047 }
15048
15049 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint64_t o) {
15050         LDKChannelInfo o_conv;
15051         o_conv.inner = untag_ptr(o);
15052         o_conv.is_owned = ptr_is_owned(o);
15053         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15054         o_conv = ChannelInfo_clone(&o_conv);
15055         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
15056         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
15057         return tag_ptr(ret_conv, true);
15058 }
15059
15060 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_err"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint64_t e) {
15061         void* e_ptr = untag_ptr(e);
15062         CHECK_ACCESS(e_ptr);
15063         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15064         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15065         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
15066         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
15067         return tag_ptr(ret_conv, true);
15068 }
15069
15070 jboolean  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint64_t o) {
15071         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
15072         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
15073         return ret_conv;
15074 }
15075
15076 void  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_free"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint64_t _res) {
15077         if (!ptr_is_owned(_res)) return;
15078         void* _res_ptr = untag_ptr(_res);
15079         CHECK_ACCESS(_res_ptr);
15080         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
15081         FREE(untag_ptr(_res));
15082         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
15083 }
15084
15085 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
15086         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
15087         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
15088         return tag_ptr(ret_conv, true);
15089 }
15090 int64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
15091         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
15092         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
15093         return ret_conv;
15094 }
15095
15096 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint64_t orig) {
15097         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
15098         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
15099         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
15100         return tag_ptr(ret_conv, true);
15101 }
15102
15103 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint64_t o) {
15104         LDKRoutingFees o_conv;
15105         o_conv.inner = untag_ptr(o);
15106         o_conv.is_owned = ptr_is_owned(o);
15107         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15108         o_conv = RoutingFees_clone(&o_conv);
15109         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
15110         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
15111         return tag_ptr(ret_conv, true);
15112 }
15113
15114 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_err"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint64_t e) {
15115         void* e_ptr = untag_ptr(e);
15116         CHECK_ACCESS(e_ptr);
15117         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15118         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15119         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
15120         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
15121         return tag_ptr(ret_conv, true);
15122 }
15123
15124 jboolean  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_is_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint64_t o) {
15125         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
15126         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
15127         return ret_conv;
15128 }
15129
15130 void  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_free"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint64_t _res) {
15131         if (!ptr_is_owned(_res)) return;
15132         void* _res_ptr = untag_ptr(_res);
15133         CHECK_ACCESS(_res_ptr);
15134         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
15135         FREE(untag_ptr(_res));
15136         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
15137 }
15138
15139 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
15140         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
15141         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
15142         return tag_ptr(ret_conv, true);
15143 }
15144 int64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint64_t arg) {
15145         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
15146         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
15147         return ret_conv;
15148 }
15149
15150 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint64_t orig) {
15151         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
15152         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
15153         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
15154         return tag_ptr(ret_conv, true);
15155 }
15156
15157 void  __attribute__((export_name("TS_CVec_NetAddressZ_free"))) TS_CVec_NetAddressZ_free(uint64_tArray _res) {
15158         LDKCVec_NetAddressZ _res_constr;
15159         _res_constr.datalen = _res->arr_len;
15160         if (_res_constr.datalen > 0)
15161                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
15162         else
15163                 _res_constr.data = NULL;
15164         uint64_t* _res_vals = _res->elems;
15165         for (size_t m = 0; m < _res_constr.datalen; m++) {
15166                 uint64_t _res_conv_12 = _res_vals[m];
15167                 void* _res_conv_12_ptr = untag_ptr(_res_conv_12);
15168                 CHECK_ACCESS(_res_conv_12_ptr);
15169                 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
15170                 FREE(untag_ptr(_res_conv_12));
15171                 _res_constr.data[m] = _res_conv_12_conv;
15172         }
15173         FREE(_res);
15174         CVec_NetAddressZ_free(_res_constr);
15175 }
15176
15177 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint64_t o) {
15178         LDKNodeAnnouncementInfo o_conv;
15179         o_conv.inner = untag_ptr(o);
15180         o_conv.is_owned = ptr_is_owned(o);
15181         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15182         o_conv = NodeAnnouncementInfo_clone(&o_conv);
15183         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
15184         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
15185         return tag_ptr(ret_conv, true);
15186 }
15187
15188 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint64_t e) {
15189         void* e_ptr = untag_ptr(e);
15190         CHECK_ACCESS(e_ptr);
15191         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15192         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15193         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
15194         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
15195         return tag_ptr(ret_conv, true);
15196 }
15197
15198 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint64_t o) {
15199         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
15200         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
15201         return ret_conv;
15202 }
15203
15204 void  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint64_t _res) {
15205         if (!ptr_is_owned(_res)) return;
15206         void* _res_ptr = untag_ptr(_res);
15207         CHECK_ACCESS(_res_ptr);
15208         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
15209         FREE(untag_ptr(_res));
15210         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
15211 }
15212
15213 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
15214         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
15215         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
15216         return tag_ptr(ret_conv, true);
15217 }
15218 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
15219         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
15220         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
15221         return ret_conv;
15222 }
15223
15224 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint64_t orig) {
15225         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
15226         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
15227         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
15228         return tag_ptr(ret_conv, true);
15229 }
15230
15231 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_ok"))) TS_CResult_NodeAliasDecodeErrorZ_ok(uint64_t o) {
15232         LDKNodeAlias o_conv;
15233         o_conv.inner = untag_ptr(o);
15234         o_conv.is_owned = ptr_is_owned(o);
15235         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15236         o_conv = NodeAlias_clone(&o_conv);
15237         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
15238         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
15239         return tag_ptr(ret_conv, true);
15240 }
15241
15242 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_err"))) TS_CResult_NodeAliasDecodeErrorZ_err(uint64_t e) {
15243         void* e_ptr = untag_ptr(e);
15244         CHECK_ACCESS(e_ptr);
15245         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15246         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15247         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
15248         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
15249         return tag_ptr(ret_conv, true);
15250 }
15251
15252 jboolean  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_is_ok"))) TS_CResult_NodeAliasDecodeErrorZ_is_ok(uint64_t o) {
15253         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
15254         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
15255         return ret_conv;
15256 }
15257
15258 void  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_free"))) TS_CResult_NodeAliasDecodeErrorZ_free(uint64_t _res) {
15259         if (!ptr_is_owned(_res)) return;
15260         void* _res_ptr = untag_ptr(_res);
15261         CHECK_ACCESS(_res_ptr);
15262         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
15263         FREE(untag_ptr(_res));
15264         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
15265 }
15266
15267 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
15268         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
15269         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
15270         return tag_ptr(ret_conv, true);
15271 }
15272 int64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAliasDecodeErrorZ_clone_ptr(uint64_t arg) {
15273         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
15274         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
15275         return ret_conv;
15276 }
15277
15278 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone"))) TS_CResult_NodeAliasDecodeErrorZ_clone(uint64_t orig) {
15279         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
15280         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
15281         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
15282         return tag_ptr(ret_conv, true);
15283 }
15284
15285 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_ok"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint64_t o) {
15286         LDKNodeInfo o_conv;
15287         o_conv.inner = untag_ptr(o);
15288         o_conv.is_owned = ptr_is_owned(o);
15289         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15290         o_conv = NodeInfo_clone(&o_conv);
15291         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
15292         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
15293         return tag_ptr(ret_conv, true);
15294 }
15295
15296 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_err"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint64_t e) {
15297         void* e_ptr = untag_ptr(e);
15298         CHECK_ACCESS(e_ptr);
15299         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15300         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15301         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
15302         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
15303         return tag_ptr(ret_conv, true);
15304 }
15305
15306 jboolean  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint64_t o) {
15307         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
15308         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
15309         return ret_conv;
15310 }
15311
15312 void  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_free"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint64_t _res) {
15313         if (!ptr_is_owned(_res)) return;
15314         void* _res_ptr = untag_ptr(_res);
15315         CHECK_ACCESS(_res_ptr);
15316         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
15317         FREE(untag_ptr(_res));
15318         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
15319 }
15320
15321 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
15322         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
15323         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
15324         return tag_ptr(ret_conv, true);
15325 }
15326 int64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
15327         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
15328         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
15329         return ret_conv;
15330 }
15331
15332 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint64_t orig) {
15333         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
15334         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
15335         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
15336         return tag_ptr(ret_conv, true);
15337 }
15338
15339 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint64_t o) {
15340         LDKNetworkGraph o_conv;
15341         o_conv.inner = untag_ptr(o);
15342         o_conv.is_owned = ptr_is_owned(o);
15343         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15344         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
15345         
15346         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
15347         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
15348         return tag_ptr(ret_conv, true);
15349 }
15350
15351 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_err"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint64_t e) {
15352         void* e_ptr = untag_ptr(e);
15353         CHECK_ACCESS(e_ptr);
15354         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15355         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15356         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
15357         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
15358         return tag_ptr(ret_conv, true);
15359 }
15360
15361 jboolean  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_is_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint64_t o) {
15362         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
15363         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
15364         return ret_conv;
15365 }
15366
15367 void  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_free"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint64_t _res) {
15368         if (!ptr_is_owned(_res)) return;
15369         void* _res_ptr = untag_ptr(_res);
15370         CHECK_ACCESS(_res_ptr);
15371         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
15372         FREE(untag_ptr(_res));
15373         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
15374 }
15375
15376 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_some"))) TS_COption_CVec_NetAddressZZ_some(uint64_tArray o) {
15377         LDKCVec_NetAddressZ o_constr;
15378         o_constr.datalen = o->arr_len;
15379         if (o_constr.datalen > 0)
15380                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
15381         else
15382                 o_constr.data = NULL;
15383         uint64_t* o_vals = o->elems;
15384         for (size_t m = 0; m < o_constr.datalen; m++) {
15385                 uint64_t o_conv_12 = o_vals[m];
15386                 void* o_conv_12_ptr = untag_ptr(o_conv_12);
15387                 CHECK_ACCESS(o_conv_12_ptr);
15388                 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
15389                 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o_conv_12));
15390                 o_constr.data[m] = o_conv_12_conv;
15391         }
15392         FREE(o);
15393         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
15394         *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
15395         uint64_t ret_ref = tag_ptr(ret_copy, true);
15396         return ret_ref;
15397 }
15398
15399 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_none"))) TS_COption_CVec_NetAddressZZ_none() {
15400         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
15401         *ret_copy = COption_CVec_NetAddressZZ_none();
15402         uint64_t ret_ref = tag_ptr(ret_copy, true);
15403         return ret_ref;
15404 }
15405
15406 void  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_free"))) TS_COption_CVec_NetAddressZZ_free(uint64_t _res) {
15407         if (!ptr_is_owned(_res)) return;
15408         void* _res_ptr = untag_ptr(_res);
15409         CHECK_ACCESS(_res_ptr);
15410         LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
15411         FREE(untag_ptr(_res));
15412         COption_CVec_NetAddressZZ_free(_res_conv);
15413 }
15414
15415 static inline uint64_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
15416         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
15417         *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
15418         uint64_t ret_ref = tag_ptr(ret_copy, true);
15419         return ret_ref;
15420 }
15421 int64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone_ptr"))) TS_COption_CVec_NetAddressZZ_clone_ptr(uint64_t arg) {
15422         LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(arg);
15423         int64_t ret_conv = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
15424         return ret_conv;
15425 }
15426
15427 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone"))) TS_COption_CVec_NetAddressZZ_clone(uint64_t orig) {
15428         LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(orig);
15429         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
15430         *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
15431         uint64_t ret_ref = tag_ptr(ret_copy, true);
15432         return ret_ref;
15433 }
15434
15435 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
15436         LDKDelayedPaymentOutputDescriptor o_conv;
15437         o_conv.inner = untag_ptr(o);
15438         o_conv.is_owned = ptr_is_owned(o);
15439         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15440         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
15441         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15442         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
15443         return tag_ptr(ret_conv, true);
15444 }
15445
15446 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
15447         void* e_ptr = untag_ptr(e);
15448         CHECK_ACCESS(e_ptr);
15449         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15450         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15451         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15452         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
15453         return tag_ptr(ret_conv, true);
15454 }
15455
15456 jboolean  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
15457         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
15458         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
15459         return ret_conv;
15460 }
15461
15462 void  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
15463         if (!ptr_is_owned(_res)) return;
15464         void* _res_ptr = untag_ptr(_res);
15465         CHECK_ACCESS(_res_ptr);
15466         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
15467         FREE(untag_ptr(_res));
15468         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
15469 }
15470
15471 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
15472         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15473         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
15474         return tag_ptr(ret_conv, true);
15475 }
15476 int64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
15477         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
15478         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
15479         return ret_conv;
15480 }
15481
15482 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
15483         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
15484         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15485         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
15486         return tag_ptr(ret_conv, true);
15487 }
15488
15489 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
15490         LDKStaticPaymentOutputDescriptor o_conv;
15491         o_conv.inner = untag_ptr(o);
15492         o_conv.is_owned = ptr_is_owned(o);
15493         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15494         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
15495         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15496         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
15497         return tag_ptr(ret_conv, true);
15498 }
15499
15500 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
15501         void* e_ptr = untag_ptr(e);
15502         CHECK_ACCESS(e_ptr);
15503         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15504         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15505         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15506         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
15507         return tag_ptr(ret_conv, true);
15508 }
15509
15510 jboolean  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
15511         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
15512         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
15513         return ret_conv;
15514 }
15515
15516 void  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
15517         if (!ptr_is_owned(_res)) return;
15518         void* _res_ptr = untag_ptr(_res);
15519         CHECK_ACCESS(_res_ptr);
15520         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
15521         FREE(untag_ptr(_res));
15522         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
15523 }
15524
15525 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
15526         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15527         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
15528         return tag_ptr(ret_conv, true);
15529 }
15530 int64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
15531         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
15532         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
15533         return ret_conv;
15534 }
15535
15536 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
15537         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
15538         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15539         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
15540         return tag_ptr(ret_conv, true);
15541 }
15542
15543 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
15544         void* o_ptr = untag_ptr(o);
15545         CHECK_ACCESS(o_ptr);
15546         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
15547         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
15548         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15549         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
15550         return tag_ptr(ret_conv, true);
15551 }
15552
15553 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint64_t e) {
15554         void* e_ptr = untag_ptr(e);
15555         CHECK_ACCESS(e_ptr);
15556         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15557         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15558         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15559         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
15560         return tag_ptr(ret_conv, true);
15561 }
15562
15563 jboolean  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
15564         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
15565         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
15566         return ret_conv;
15567 }
15568
15569 void  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
15570         if (!ptr_is_owned(_res)) return;
15571         void* _res_ptr = untag_ptr(_res);
15572         CHECK_ACCESS(_res_ptr);
15573         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
15574         FREE(untag_ptr(_res));
15575         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
15576 }
15577
15578 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
15579         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15580         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
15581         return tag_ptr(ret_conv, true);
15582 }
15583 int64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
15584         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
15585         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
15586         return ret_conv;
15587 }
15588
15589 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
15590         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
15591         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15592         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
15593         return tag_ptr(ret_conv, true);
15594 }
15595
15596 void  __attribute__((export_name("TS_CVec_PaymentPreimageZ_free"))) TS_CVec_PaymentPreimageZ_free(ptrArray _res) {
15597         LDKCVec_PaymentPreimageZ _res_constr;
15598         _res_constr.datalen = _res->arr_len;
15599         if (_res_constr.datalen > 0)
15600                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
15601         else
15602                 _res_constr.data = NULL;
15603         int8_tArray* _res_vals = (void*) _res->elems;
15604         for (size_t m = 0; m < _res_constr.datalen; m++) {
15605                 int8_tArray _res_conv_12 = _res_vals[m];
15606                 LDKThirtyTwoBytes _res_conv_12_ref;
15607                 CHECK(_res_conv_12->arr_len == 32);
15608                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
15609                 _res_constr.data[m] = _res_conv_12_ref;
15610         }
15611         FREE(_res);
15612         CVec_PaymentPreimageZ_free(_res_constr);
15613 }
15614
15615 static inline uint64_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
15616         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15617         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
15618         return tag_ptr(ret_conv, true);
15619 }
15620 int64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(uint64_t arg) {
15621         LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(arg);
15622         int64_t ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
15623         return ret_conv;
15624 }
15625
15626 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint64_t orig) {
15627         LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(orig);
15628         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15629         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
15630         return tag_ptr(ret_conv, true);
15631 }
15632
15633 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_new"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
15634         LDKSignature a_ref;
15635         CHECK(a->arr_len == 64);
15636         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
15637         LDKCVec_SignatureZ b_constr;
15638         b_constr.datalen = b->arr_len;
15639         if (b_constr.datalen > 0)
15640                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15641         else
15642                 b_constr.data = NULL;
15643         int8_tArray* b_vals = (void*) b->elems;
15644         for (size_t m = 0; m < b_constr.datalen; m++) {
15645                 int8_tArray b_conv_12 = b_vals[m];
15646                 LDKSignature b_conv_12_ref;
15647                 CHECK(b_conv_12->arr_len == 64);
15648                 memcpy(b_conv_12_ref.compact_form, b_conv_12->elems, 64); FREE(b_conv_12);
15649                 b_constr.data[m] = b_conv_12_ref;
15650         }
15651         FREE(b);
15652         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15653         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
15654         return tag_ptr(ret_conv, true);
15655 }
15656
15657 void  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_free"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint64_t _res) {
15658         if (!ptr_is_owned(_res)) return;
15659         void* _res_ptr = untag_ptr(_res);
15660         CHECK_ACCESS(_res_ptr);
15661         LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
15662         FREE(untag_ptr(_res));
15663         C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
15664 }
15665
15666 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint64_t o) {
15667         void* o_ptr = untag_ptr(o);
15668         CHECK_ACCESS(o_ptr);
15669         LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
15670         o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(o));
15671         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15672         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
15673         return tag_ptr(ret_conv, true);
15674 }
15675
15676 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
15677         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15678         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
15679         return tag_ptr(ret_conv, true);
15680 }
15681
15682 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(uint64_t o) {
15683         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(o);
15684         jboolean ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
15685         return ret_conv;
15686 }
15687
15688 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint64_t _res) {
15689         if (!ptr_is_owned(_res)) return;
15690         void* _res_ptr = untag_ptr(_res);
15691         CHECK_ACCESS(_res_ptr);
15692         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
15693         FREE(untag_ptr(_res));
15694         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
15695 }
15696
15697 static inline uint64_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
15698         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15699         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
15700         return tag_ptr(ret_conv, true);
15701 }
15702 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(uint64_t arg) {
15703         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(arg);
15704         int64_t ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
15705         return ret_conv;
15706 }
15707
15708 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint64_t orig) {
15709         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(orig);
15710         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15711         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
15712         return tag_ptr(ret_conv, true);
15713 }
15714
15715 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_ok"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
15716         LDKSignature o_ref;
15717         CHECK(o->arr_len == 64);
15718         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
15719         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15720         *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
15721         return tag_ptr(ret_conv, true);
15722 }
15723
15724 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_err"))) TS_CResult_SignatureNoneZ_err() {
15725         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15726         *ret_conv = CResult_SignatureNoneZ_err();
15727         return tag_ptr(ret_conv, true);
15728 }
15729
15730 jboolean  __attribute__((export_name("TS_CResult_SignatureNoneZ_is_ok"))) TS_CResult_SignatureNoneZ_is_ok(uint64_t o) {
15731         LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(o);
15732         jboolean ret_conv = CResult_SignatureNoneZ_is_ok(o_conv);
15733         return ret_conv;
15734 }
15735
15736 void  __attribute__((export_name("TS_CResult_SignatureNoneZ_free"))) TS_CResult_SignatureNoneZ_free(uint64_t _res) {
15737         if (!ptr_is_owned(_res)) return;
15738         void* _res_ptr = untag_ptr(_res);
15739         CHECK_ACCESS(_res_ptr);
15740         LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
15741         FREE(untag_ptr(_res));
15742         CResult_SignatureNoneZ_free(_res_conv);
15743 }
15744
15745 static inline uint64_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
15746         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15747         *ret_conv = CResult_SignatureNoneZ_clone(arg);
15748         return tag_ptr(ret_conv, true);
15749 }
15750 int64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_clone_ptr"))) TS_CResult_SignatureNoneZ_clone_ptr(uint64_t arg) {
15751         LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(arg);
15752         int64_t ret_conv = CResult_SignatureNoneZ_clone_ptr(arg_conv);
15753         return ret_conv;
15754 }
15755
15756 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_clone"))) TS_CResult_SignatureNoneZ_clone(uint64_t orig) {
15757         LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(orig);
15758         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15759         *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
15760         return tag_ptr(ret_conv, true);
15761 }
15762
15763 static inline uint64_t C2Tuple_SignatureSignatureZ_clone_ptr(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR arg) {
15764         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
15765         *ret_conv = C2Tuple_SignatureSignatureZ_clone(arg);
15766         return tag_ptr(ret_conv, true);
15767 }
15768 int64_t  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_clone_ptr"))) TS_C2Tuple_SignatureSignatureZ_clone_ptr(uint64_t arg) {
15769         LDKC2Tuple_SignatureSignatureZ* arg_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(arg);
15770         int64_t ret_conv = C2Tuple_SignatureSignatureZ_clone_ptr(arg_conv);
15771         return ret_conv;
15772 }
15773
15774 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_clone"))) TS_C2Tuple_SignatureSignatureZ_clone(uint64_t orig) {
15775         LDKC2Tuple_SignatureSignatureZ* orig_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(orig);
15776         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
15777         *ret_conv = C2Tuple_SignatureSignatureZ_clone(orig_conv);
15778         return tag_ptr(ret_conv, true);
15779 }
15780
15781 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_new"))) TS_C2Tuple_SignatureSignatureZ_new(int8_tArray a, int8_tArray b) {
15782         LDKSignature a_ref;
15783         CHECK(a->arr_len == 64);
15784         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
15785         LDKSignature b_ref;
15786         CHECK(b->arr_len == 64);
15787         memcpy(b_ref.compact_form, b->elems, 64); FREE(b);
15788         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
15789         *ret_conv = C2Tuple_SignatureSignatureZ_new(a_ref, b_ref);
15790         return tag_ptr(ret_conv, true);
15791 }
15792
15793 void  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_free"))) TS_C2Tuple_SignatureSignatureZ_free(uint64_t _res) {
15794         if (!ptr_is_owned(_res)) return;
15795         void* _res_ptr = untag_ptr(_res);
15796         CHECK_ACCESS(_res_ptr);
15797         LDKC2Tuple_SignatureSignatureZ _res_conv = *(LDKC2Tuple_SignatureSignatureZ*)(_res_ptr);
15798         FREE(untag_ptr(_res));
15799         C2Tuple_SignatureSignatureZ_free(_res_conv);
15800 }
15801
15802 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_ok(uint64_t o) {
15803         void* o_ptr = untag_ptr(o);
15804         CHECK_ACCESS(o_ptr);
15805         LDKC2Tuple_SignatureSignatureZ o_conv = *(LDKC2Tuple_SignatureSignatureZ*)(o_ptr);
15806         o_conv = C2Tuple_SignatureSignatureZ_clone((LDKC2Tuple_SignatureSignatureZ*)untag_ptr(o));
15807         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
15808         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o_conv);
15809         return tag_ptr(ret_conv, true);
15810 }
15811
15812 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_err"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_err() {
15813         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
15814         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_err();
15815         return tag_ptr(ret_conv, true);
15816 }
15817
15818 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(uint64_t o) {
15819         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(o);
15820         jboolean ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o_conv);
15821         return ret_conv;
15822 }
15823
15824 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_free"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_free(uint64_t _res) {
15825         if (!ptr_is_owned(_res)) return;
15826         void* _res_ptr = untag_ptr(_res);
15827         CHECK_ACCESS(_res_ptr);
15828         LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(_res_ptr);
15829         FREE(untag_ptr(_res));
15830         CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res_conv);
15831 }
15832
15833 static inline uint64_t CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR arg) {
15834         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
15835         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(arg);
15836         return tag_ptr(ret_conv, true);
15837 }
15838 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(uint64_t arg) {
15839         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(arg);
15840         int64_t ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(arg_conv);
15841         return ret_conv;
15842 }
15843
15844 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone(uint64_t orig) {
15845         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(orig);
15846         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
15847         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig_conv);
15848         return tag_ptr(ret_conv, true);
15849 }
15850
15851 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_ok"))) TS_CResult_SecretKeyNoneZ_ok(int8_tArray o) {
15852         LDKSecretKey o_ref;
15853         CHECK(o->arr_len == 32);
15854         memcpy(o_ref.bytes, o->elems, 32); FREE(o);
15855         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
15856         *ret_conv = CResult_SecretKeyNoneZ_ok(o_ref);
15857         return tag_ptr(ret_conv, true);
15858 }
15859
15860 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_err"))) TS_CResult_SecretKeyNoneZ_err() {
15861         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
15862         *ret_conv = CResult_SecretKeyNoneZ_err();
15863         return tag_ptr(ret_conv, true);
15864 }
15865
15866 jboolean  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_is_ok"))) TS_CResult_SecretKeyNoneZ_is_ok(uint64_t o) {
15867         LDKCResult_SecretKeyNoneZ* o_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(o);
15868         jboolean ret_conv = CResult_SecretKeyNoneZ_is_ok(o_conv);
15869         return ret_conv;
15870 }
15871
15872 void  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_free"))) TS_CResult_SecretKeyNoneZ_free(uint64_t _res) {
15873         if (!ptr_is_owned(_res)) return;
15874         void* _res_ptr = untag_ptr(_res);
15875         CHECK_ACCESS(_res_ptr);
15876         LDKCResult_SecretKeyNoneZ _res_conv = *(LDKCResult_SecretKeyNoneZ*)(_res_ptr);
15877         FREE(untag_ptr(_res));
15878         CResult_SecretKeyNoneZ_free(_res_conv);
15879 }
15880
15881 static inline uint64_t CResult_SecretKeyNoneZ_clone_ptr(LDKCResult_SecretKeyNoneZ *NONNULL_PTR arg) {
15882         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
15883         *ret_conv = CResult_SecretKeyNoneZ_clone(arg);
15884         return tag_ptr(ret_conv, true);
15885 }
15886 int64_t  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_clone_ptr"))) TS_CResult_SecretKeyNoneZ_clone_ptr(uint64_t arg) {
15887         LDKCResult_SecretKeyNoneZ* arg_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(arg);
15888         int64_t ret_conv = CResult_SecretKeyNoneZ_clone_ptr(arg_conv);
15889         return ret_conv;
15890 }
15891
15892 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_clone"))) TS_CResult_SecretKeyNoneZ_clone(uint64_t orig) {
15893         LDKCResult_SecretKeyNoneZ* orig_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(orig);
15894         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
15895         *ret_conv = CResult_SecretKeyNoneZ_clone(orig_conv);
15896         return tag_ptr(ret_conv, true);
15897 }
15898
15899 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_ok"))) TS_CResult_PublicKeyNoneZ_ok(int8_tArray o) {
15900         LDKPublicKey o_ref;
15901         CHECK(o->arr_len == 33);
15902         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
15903         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
15904         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
15905         return tag_ptr(ret_conv, true);
15906 }
15907
15908 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_err"))) TS_CResult_PublicKeyNoneZ_err() {
15909         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
15910         *ret_conv = CResult_PublicKeyNoneZ_err();
15911         return tag_ptr(ret_conv, true);
15912 }
15913
15914 jboolean  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_is_ok"))) TS_CResult_PublicKeyNoneZ_is_ok(uint64_t o) {
15915         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
15916         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
15917         return ret_conv;
15918 }
15919
15920 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_free"))) TS_CResult_PublicKeyNoneZ_free(uint64_t _res) {
15921         if (!ptr_is_owned(_res)) return;
15922         void* _res_ptr = untag_ptr(_res);
15923         CHECK_ACCESS(_res_ptr);
15924         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
15925         FREE(untag_ptr(_res));
15926         CResult_PublicKeyNoneZ_free(_res_conv);
15927 }
15928
15929 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
15930         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
15931         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
15932         return tag_ptr(ret_conv, true);
15933 }
15934 int64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone_ptr"))) TS_CResult_PublicKeyNoneZ_clone_ptr(uint64_t arg) {
15935         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
15936         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
15937         return ret_conv;
15938 }
15939
15940 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone"))) TS_CResult_PublicKeyNoneZ_clone(uint64_t orig) {
15941         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
15942         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
15943         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
15944         return tag_ptr(ret_conv, true);
15945 }
15946
15947 uint64_t  __attribute__((export_name("TS_COption_ScalarZ_some"))) TS_COption_ScalarZ_some(uint64_t o) {
15948         void* o_ptr = untag_ptr(o);
15949         CHECK_ACCESS(o_ptr);
15950         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
15951         // WARNING: we may need a move here but no clone is available for LDKBigEndianScalar
15952         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
15953         *ret_copy = COption_ScalarZ_some(o_conv);
15954         uint64_t ret_ref = tag_ptr(ret_copy, true);
15955         return ret_ref;
15956 }
15957
15958 uint64_t  __attribute__((export_name("TS_COption_ScalarZ_none"))) TS_COption_ScalarZ_none() {
15959         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
15960         *ret_copy = COption_ScalarZ_none();
15961         uint64_t ret_ref = tag_ptr(ret_copy, true);
15962         return ret_ref;
15963 }
15964
15965 void  __attribute__((export_name("TS_COption_ScalarZ_free"))) TS_COption_ScalarZ_free(uint64_t _res) {
15966         if (!ptr_is_owned(_res)) return;
15967         void* _res_ptr = untag_ptr(_res);
15968         CHECK_ACCESS(_res_ptr);
15969         LDKCOption_ScalarZ _res_conv = *(LDKCOption_ScalarZ*)(_res_ptr);
15970         FREE(untag_ptr(_res));
15971         COption_ScalarZ_free(_res_conv);
15972 }
15973
15974 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_ok"))) TS_CResult_SharedSecretNoneZ_ok(int8_tArray o) {
15975         LDKThirtyTwoBytes o_ref;
15976         CHECK(o->arr_len == 32);
15977         memcpy(o_ref.data, o->elems, 32); FREE(o);
15978         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
15979         *ret_conv = CResult_SharedSecretNoneZ_ok(o_ref);
15980         return tag_ptr(ret_conv, true);
15981 }
15982
15983 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_err"))) TS_CResult_SharedSecretNoneZ_err() {
15984         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
15985         *ret_conv = CResult_SharedSecretNoneZ_err();
15986         return tag_ptr(ret_conv, true);
15987 }
15988
15989 jboolean  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_is_ok"))) TS_CResult_SharedSecretNoneZ_is_ok(uint64_t o) {
15990         LDKCResult_SharedSecretNoneZ* o_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(o);
15991         jboolean ret_conv = CResult_SharedSecretNoneZ_is_ok(o_conv);
15992         return ret_conv;
15993 }
15994
15995 void  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_free"))) TS_CResult_SharedSecretNoneZ_free(uint64_t _res) {
15996         if (!ptr_is_owned(_res)) return;
15997         void* _res_ptr = untag_ptr(_res);
15998         CHECK_ACCESS(_res_ptr);
15999         LDKCResult_SharedSecretNoneZ _res_conv = *(LDKCResult_SharedSecretNoneZ*)(_res_ptr);
16000         FREE(untag_ptr(_res));
16001         CResult_SharedSecretNoneZ_free(_res_conv);
16002 }
16003
16004 static inline uint64_t CResult_SharedSecretNoneZ_clone_ptr(LDKCResult_SharedSecretNoneZ *NONNULL_PTR arg) {
16005         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16006         *ret_conv = CResult_SharedSecretNoneZ_clone(arg);
16007         return tag_ptr(ret_conv, true);
16008 }
16009 int64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_clone_ptr"))) TS_CResult_SharedSecretNoneZ_clone_ptr(uint64_t arg) {
16010         LDKCResult_SharedSecretNoneZ* arg_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(arg);
16011         int64_t ret_conv = CResult_SharedSecretNoneZ_clone_ptr(arg_conv);
16012         return ret_conv;
16013 }
16014
16015 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_clone"))) TS_CResult_SharedSecretNoneZ_clone(uint64_t orig) {
16016         LDKCResult_SharedSecretNoneZ* orig_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(orig);
16017         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16018         *ret_conv = CResult_SharedSecretNoneZ_clone(orig_conv);
16019         return tag_ptr(ret_conv, true);
16020 }
16021
16022 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_ok"))) TS_CResult_SignDecodeErrorZ_ok(uint64_t o) {
16023         void* o_ptr = untag_ptr(o);
16024         CHECK_ACCESS(o_ptr);
16025         LDKSign o_conv = *(LDKSign*)(o_ptr);
16026         if (o_conv.free == LDKSign_JCalls_free) {
16027                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16028                 LDKSign_JCalls_cloned(&o_conv);
16029         }
16030         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
16031         *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
16032         return tag_ptr(ret_conv, true);
16033 }
16034
16035 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_err"))) TS_CResult_SignDecodeErrorZ_err(uint64_t e) {
16036         void* e_ptr = untag_ptr(e);
16037         CHECK_ACCESS(e_ptr);
16038         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16039         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16040         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
16041         *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
16042         return tag_ptr(ret_conv, true);
16043 }
16044
16045 jboolean  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_is_ok"))) TS_CResult_SignDecodeErrorZ_is_ok(uint64_t o) {
16046         LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(o);
16047         jboolean ret_conv = CResult_SignDecodeErrorZ_is_ok(o_conv);
16048         return ret_conv;
16049 }
16050
16051 void  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_free"))) TS_CResult_SignDecodeErrorZ_free(uint64_t _res) {
16052         if (!ptr_is_owned(_res)) return;
16053         void* _res_ptr = untag_ptr(_res);
16054         CHECK_ACCESS(_res_ptr);
16055         LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
16056         FREE(untag_ptr(_res));
16057         CResult_SignDecodeErrorZ_free(_res_conv);
16058 }
16059
16060 static inline uint64_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
16061         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
16062         *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
16063         return tag_ptr(ret_conv, true);
16064 }
16065 int64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone_ptr"))) TS_CResult_SignDecodeErrorZ_clone_ptr(uint64_t arg) {
16066         LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(arg);
16067         int64_t ret_conv = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
16068         return ret_conv;
16069 }
16070
16071 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone"))) TS_CResult_SignDecodeErrorZ_clone(uint64_t orig) {
16072         LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(orig);
16073         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
16074         *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
16075         return tag_ptr(ret_conv, true);
16076 }
16077
16078 void  __attribute__((export_name("TS_CVec_U5Z_free"))) TS_CVec_U5Z_free(ptrArray _res) {
16079         LDKCVec_U5Z _res_constr;
16080         _res_constr.datalen = _res->arr_len;
16081         if (_res_constr.datalen > 0)
16082                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
16083         else
16084                 _res_constr.data = NULL;
16085         int8_t* _res_vals = (void*) _res->elems;
16086         for (size_t h = 0; h < _res_constr.datalen; h++) {
16087                 int8_t _res_conv_7 = _res_vals[h];
16088                 
16089                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
16090         }
16091         FREE(_res);
16092         CVec_U5Z_free(_res_constr);
16093 }
16094
16095 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
16096         LDKRecoverableSignature o_ref;
16097         CHECK(o->arr_len == 68);
16098         memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
16099         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16100         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
16101         return tag_ptr(ret_conv, true);
16102 }
16103
16104 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_err"))) TS_CResult_RecoverableSignatureNoneZ_err() {
16105         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16106         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
16107         return tag_ptr(ret_conv, true);
16108 }
16109
16110 jboolean  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_is_ok"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint64_t o) {
16111         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
16112         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
16113         return ret_conv;
16114 }
16115
16116 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_free"))) TS_CResult_RecoverableSignatureNoneZ_free(uint64_t _res) {
16117         if (!ptr_is_owned(_res)) return;
16118         void* _res_ptr = untag_ptr(_res);
16119         CHECK_ACCESS(_res_ptr);
16120         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
16121         FREE(untag_ptr(_res));
16122         CResult_RecoverableSignatureNoneZ_free(_res_conv);
16123 }
16124
16125 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
16126         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16127         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
16128         return tag_ptr(ret_conv, true);
16129 }
16130 int64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone_ptr"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint64_t arg) {
16131         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
16132         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
16133         return ret_conv;
16134 }
16135
16136 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint64_t orig) {
16137         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
16138         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16139         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
16140         return tag_ptr(ret_conv, true);
16141 }
16142
16143 void  __attribute__((export_name("TS_CVec_u8Z_free"))) TS_CVec_u8Z_free(int8_tArray _res) {
16144         LDKCVec_u8Z _res_ref;
16145         _res_ref.datalen = _res->arr_len;
16146         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
16147         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
16148         CVec_u8Z_free(_res_ref);
16149 }
16150
16151 void  __attribute__((export_name("TS_CVec_CVec_u8ZZ_free"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
16152         LDKCVec_CVec_u8ZZ _res_constr;
16153         _res_constr.datalen = _res->arr_len;
16154         if (_res_constr.datalen > 0)
16155                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
16156         else
16157                 _res_constr.data = NULL;
16158         int8_tArray* _res_vals = (void*) _res->elems;
16159         for (size_t m = 0; m < _res_constr.datalen; m++) {
16160                 int8_tArray _res_conv_12 = _res_vals[m];
16161                 LDKCVec_u8Z _res_conv_12_ref;
16162                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
16163                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
16164                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
16165                 _res_constr.data[m] = _res_conv_12_ref;
16166         }
16167         FREE(_res);
16168         CVec_CVec_u8ZZ_free(_res_constr);
16169 }
16170
16171 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
16172         LDKCVec_CVec_u8ZZ o_constr;
16173         o_constr.datalen = o->arr_len;
16174         if (o_constr.datalen > 0)
16175                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
16176         else
16177                 o_constr.data = NULL;
16178         int8_tArray* o_vals = (void*) o->elems;
16179         for (size_t m = 0; m < o_constr.datalen; m++) {
16180                 int8_tArray o_conv_12 = o_vals[m];
16181                 LDKCVec_u8Z o_conv_12_ref;
16182                 o_conv_12_ref.datalen = o_conv_12->arr_len;
16183                 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
16184                 memcpy(o_conv_12_ref.data, o_conv_12->elems, o_conv_12_ref.datalen); FREE(o_conv_12);
16185                 o_constr.data[m] = o_conv_12_ref;
16186         }
16187         FREE(o);
16188         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16189         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
16190         return tag_ptr(ret_conv, true);
16191 }
16192
16193 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
16194         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16195         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
16196         return tag_ptr(ret_conv, true);
16197 }
16198
16199 jboolean  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok(uint64_t o) {
16200         LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(o);
16201         jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
16202         return ret_conv;
16203 }
16204
16205 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_free"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint64_t _res) {
16206         if (!ptr_is_owned(_res)) return;
16207         void* _res_ptr = untag_ptr(_res);
16208         CHECK_ACCESS(_res_ptr);
16209         LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
16210         FREE(untag_ptr(_res));
16211         CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
16212 }
16213
16214 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
16215         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16216         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
16217         return tag_ptr(ret_conv, true);
16218 }
16219 int64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(uint64_t arg) {
16220         LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(arg);
16221         int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
16222         return ret_conv;
16223 }
16224
16225 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint64_t orig) {
16226         LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(orig);
16227         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16228         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
16229         return tag_ptr(ret_conv, true);
16230 }
16231
16232 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint64_t o) {
16233         LDKInMemorySigner o_conv;
16234         o_conv.inner = untag_ptr(o);
16235         o_conv.is_owned = ptr_is_owned(o);
16236         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16237         o_conv = InMemorySigner_clone(&o_conv);
16238         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16239         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
16240         return tag_ptr(ret_conv, true);
16241 }
16242
16243 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_err"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint64_t e) {
16244         void* e_ptr = untag_ptr(e);
16245         CHECK_ACCESS(e_ptr);
16246         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16247         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16248         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16249         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
16250         return tag_ptr(ret_conv, true);
16251 }
16252
16253 jboolean  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_is_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint64_t o) {
16254         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
16255         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
16256         return ret_conv;
16257 }
16258
16259 void  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_free"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint64_t _res) {
16260         if (!ptr_is_owned(_res)) return;
16261         void* _res_ptr = untag_ptr(_res);
16262         CHECK_ACCESS(_res_ptr);
16263         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
16264         FREE(untag_ptr(_res));
16265         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
16266 }
16267
16268 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
16269         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16270         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
16271         return tag_ptr(ret_conv, true);
16272 }
16273 int64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint64_t arg) {
16274         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
16275         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
16276         return ret_conv;
16277 }
16278
16279 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint64_t orig) {
16280         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
16281         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16282         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
16283         return tag_ptr(ret_conv, true);
16284 }
16285
16286 void  __attribute__((export_name("TS_CVec_TxOutZ_free"))) TS_CVec_TxOutZ_free(uint64_tArray _res) {
16287         LDKCVec_TxOutZ _res_constr;
16288         _res_constr.datalen = _res->arr_len;
16289         if (_res_constr.datalen > 0)
16290                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
16291         else
16292                 _res_constr.data = NULL;
16293         uint64_t* _res_vals = _res->elems;
16294         for (size_t h = 0; h < _res_constr.datalen; h++) {
16295                 uint64_t _res_conv_7 = _res_vals[h];
16296                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
16297                 CHECK_ACCESS(_res_conv_7_ptr);
16298                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
16299                 FREE(untag_ptr(_res_conv_7));
16300                 _res_constr.data[h] = _res_conv_7_conv;
16301         }
16302         FREE(_res);
16303         CVec_TxOutZ_free(_res_constr);
16304 }
16305
16306 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_ok"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
16307         LDKTransaction o_ref;
16308         o_ref.datalen = o->arr_len;
16309         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
16310         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
16311         o_ref.data_is_owned = true;
16312         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16313         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
16314         return tag_ptr(ret_conv, true);
16315 }
16316
16317 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_err"))) TS_CResult_TransactionNoneZ_err() {
16318         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16319         *ret_conv = CResult_TransactionNoneZ_err();
16320         return tag_ptr(ret_conv, true);
16321 }
16322
16323 jboolean  __attribute__((export_name("TS_CResult_TransactionNoneZ_is_ok"))) TS_CResult_TransactionNoneZ_is_ok(uint64_t o) {
16324         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
16325         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
16326         return ret_conv;
16327 }
16328
16329 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_free"))) TS_CResult_TransactionNoneZ_free(uint64_t _res) {
16330         if (!ptr_is_owned(_res)) return;
16331         void* _res_ptr = untag_ptr(_res);
16332         CHECK_ACCESS(_res_ptr);
16333         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
16334         FREE(untag_ptr(_res));
16335         CResult_TransactionNoneZ_free(_res_conv);
16336 }
16337
16338 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
16339         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16340         *ret_conv = CResult_TransactionNoneZ_clone(arg);
16341         return tag_ptr(ret_conv, true);
16342 }
16343 int64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone_ptr"))) TS_CResult_TransactionNoneZ_clone_ptr(uint64_t arg) {
16344         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
16345         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
16346         return ret_conv;
16347 }
16348
16349 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone"))) TS_CResult_TransactionNoneZ_clone(uint64_t orig) {
16350         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
16351         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16352         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
16353         return tag_ptr(ret_conv, true);
16354 }
16355
16356 uint64_t  __attribute__((export_name("TS_COption_u16Z_some"))) TS_COption_u16Z_some(int16_t o) {
16357         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16358         *ret_copy = COption_u16Z_some(o);
16359         uint64_t ret_ref = tag_ptr(ret_copy, true);
16360         return ret_ref;
16361 }
16362
16363 uint64_t  __attribute__((export_name("TS_COption_u16Z_none"))) TS_COption_u16Z_none() {
16364         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16365         *ret_copy = COption_u16Z_none();
16366         uint64_t ret_ref = tag_ptr(ret_copy, true);
16367         return ret_ref;
16368 }
16369
16370 void  __attribute__((export_name("TS_COption_u16Z_free"))) TS_COption_u16Z_free(uint64_t _res) {
16371         if (!ptr_is_owned(_res)) return;
16372         void* _res_ptr = untag_ptr(_res);
16373         CHECK_ACCESS(_res_ptr);
16374         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
16375         FREE(untag_ptr(_res));
16376         COption_u16Z_free(_res_conv);
16377 }
16378
16379 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
16380         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16381         *ret_copy = COption_u16Z_clone(arg);
16382         uint64_t ret_ref = tag_ptr(ret_copy, true);
16383         return ret_ref;
16384 }
16385 int64_t  __attribute__((export_name("TS_COption_u16Z_clone_ptr"))) TS_COption_u16Z_clone_ptr(uint64_t arg) {
16386         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
16387         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
16388         return ret_conv;
16389 }
16390
16391 uint64_t  __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_clone(uint64_t orig) {
16392         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
16393         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16394         *ret_copy = COption_u16Z_clone(orig_conv);
16395         uint64_t ret_ref = tag_ptr(ret_copy, true);
16396         return ret_ref;
16397 }
16398
16399 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_ok"))) TS_CResult_NoneAPIErrorZ_ok() {
16400         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16401         *ret_conv = CResult_NoneAPIErrorZ_ok();
16402         return tag_ptr(ret_conv, true);
16403 }
16404
16405 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_err"))) TS_CResult_NoneAPIErrorZ_err(uint64_t e) {
16406         void* e_ptr = untag_ptr(e);
16407         CHECK_ACCESS(e_ptr);
16408         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16409         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
16410         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16411         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
16412         return tag_ptr(ret_conv, true);
16413 }
16414
16415 jboolean  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_is_ok"))) TS_CResult_NoneAPIErrorZ_is_ok(uint64_t o) {
16416         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
16417         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
16418         return ret_conv;
16419 }
16420
16421 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_free"))) TS_CResult_NoneAPIErrorZ_free(uint64_t _res) {
16422         if (!ptr_is_owned(_res)) return;
16423         void* _res_ptr = untag_ptr(_res);
16424         CHECK_ACCESS(_res_ptr);
16425         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
16426         FREE(untag_ptr(_res));
16427         CResult_NoneAPIErrorZ_free(_res_conv);
16428 }
16429
16430 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
16431         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16432         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
16433         return tag_ptr(ret_conv, true);
16434 }
16435 int64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone_ptr"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint64_t arg) {
16436         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
16437         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
16438         return ret_conv;
16439 }
16440
16441 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone"))) TS_CResult_NoneAPIErrorZ_clone(uint64_t orig) {
16442         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
16443         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16444         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
16445         return tag_ptr(ret_conv, true);
16446 }
16447
16448 void  __attribute__((export_name("TS_CVec_CResult_NoneAPIErrorZZ_free"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint64_tArray _res) {
16449         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
16450         _res_constr.datalen = _res->arr_len;
16451         if (_res_constr.datalen > 0)
16452                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
16453         else
16454                 _res_constr.data = NULL;
16455         uint64_t* _res_vals = _res->elems;
16456         for (size_t w = 0; w < _res_constr.datalen; w++) {
16457                 uint64_t _res_conv_22 = _res_vals[w];
16458                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
16459                 CHECK_ACCESS(_res_conv_22_ptr);
16460                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
16461                 FREE(untag_ptr(_res_conv_22));
16462                 _res_constr.data[w] = _res_conv_22_conv;
16463         }
16464         FREE(_res);
16465         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
16466 }
16467
16468 void  __attribute__((export_name("TS_CVec_APIErrorZ_free"))) TS_CVec_APIErrorZ_free(uint64_tArray _res) {
16469         LDKCVec_APIErrorZ _res_constr;
16470         _res_constr.datalen = _res->arr_len;
16471         if (_res_constr.datalen > 0)
16472                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
16473         else
16474                 _res_constr.data = NULL;
16475         uint64_t* _res_vals = _res->elems;
16476         for (size_t k = 0; k < _res_constr.datalen; k++) {
16477                 uint64_t _res_conv_10 = _res_vals[k];
16478                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
16479                 CHECK_ACCESS(_res_conv_10_ptr);
16480                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
16481                 FREE(untag_ptr(_res_conv_10));
16482                 _res_constr.data[k] = _res_conv_10_conv;
16483         }
16484         FREE(_res);
16485         CVec_APIErrorZ_free(_res_constr);
16486 }
16487
16488 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_ok"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) {
16489         LDKThirtyTwoBytes o_ref;
16490         CHECK(o->arr_len == 32);
16491         memcpy(o_ref.data, o->elems, 32); FREE(o);
16492         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
16493         *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
16494         return tag_ptr(ret_conv, true);
16495 }
16496
16497 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_err"))) TS_CResult__u832APIErrorZ_err(uint64_t e) {
16498         void* e_ptr = untag_ptr(e);
16499         CHECK_ACCESS(e_ptr);
16500         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16501         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
16502         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
16503         *ret_conv = CResult__u832APIErrorZ_err(e_conv);
16504         return tag_ptr(ret_conv, true);
16505 }
16506
16507 jboolean  __attribute__((export_name("TS_CResult__u832APIErrorZ_is_ok"))) TS_CResult__u832APIErrorZ_is_ok(uint64_t o) {
16508         LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(o);
16509         jboolean ret_conv = CResult__u832APIErrorZ_is_ok(o_conv);
16510         return ret_conv;
16511 }
16512
16513 void  __attribute__((export_name("TS_CResult__u832APIErrorZ_free"))) TS_CResult__u832APIErrorZ_free(uint64_t _res) {
16514         if (!ptr_is_owned(_res)) return;
16515         void* _res_ptr = untag_ptr(_res);
16516         CHECK_ACCESS(_res_ptr);
16517         LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
16518         FREE(untag_ptr(_res));
16519         CResult__u832APIErrorZ_free(_res_conv);
16520 }
16521
16522 static inline uint64_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
16523         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
16524         *ret_conv = CResult__u832APIErrorZ_clone(arg);
16525         return tag_ptr(ret_conv, true);
16526 }
16527 int64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_clone_ptr"))) TS_CResult__u832APIErrorZ_clone_ptr(uint64_t arg) {
16528         LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(arg);
16529         int64_t ret_conv = CResult__u832APIErrorZ_clone_ptr(arg_conv);
16530         return ret_conv;
16531 }
16532
16533 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_clone"))) TS_CResult__u832APIErrorZ_clone(uint64_t orig) {
16534         LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(orig);
16535         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
16536         *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
16537         return tag_ptr(ret_conv, true);
16538 }
16539
16540 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() {
16541         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
16542         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
16543         return tag_ptr(ret_conv, true);
16544 }
16545
16546 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint64_t e) {
16547         void* e_ptr = untag_ptr(e);
16548         CHECK_ACCESS(e_ptr);
16549         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
16550         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
16551         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
16552         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
16553         return tag_ptr(ret_conv, true);
16554 }
16555
16556 jboolean  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint64_t o) {
16557         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
16558         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
16559         return ret_conv;
16560 }
16561
16562 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint64_t _res) {
16563         if (!ptr_is_owned(_res)) return;
16564         void* _res_ptr = untag_ptr(_res);
16565         CHECK_ACCESS(_res_ptr);
16566         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
16567         FREE(untag_ptr(_res));
16568         CResult_NonePaymentSendFailureZ_free(_res_conv);
16569 }
16570
16571 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
16572         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
16573         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
16574         return tag_ptr(ret_conv, true);
16575 }
16576 int64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint64_t arg) {
16577         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
16578         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
16579         return ret_conv;
16580 }
16581
16582 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint64_t orig) {
16583         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
16584         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
16585         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
16586         return tag_ptr(ret_conv, true);
16587 }
16588
16589 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_ok"))) TS_CResult_PaymentHashPaymentSendFailureZ_ok(int8_tArray o) {
16590         LDKThirtyTwoBytes o_ref;
16591         CHECK(o->arr_len == 32);
16592         memcpy(o_ref.data, o->elems, 32); FREE(o);
16593         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
16594         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_ok(o_ref);
16595         return tag_ptr(ret_conv, true);
16596 }
16597
16598 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_err"))) TS_CResult_PaymentHashPaymentSendFailureZ_err(uint64_t e) {
16599         void* e_ptr = untag_ptr(e);
16600         CHECK_ACCESS(e_ptr);
16601         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
16602         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
16603         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
16604         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv);
16605         return tag_ptr(ret_conv, true);
16606 }
16607
16608 jboolean  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_is_ok"))) TS_CResult_PaymentHashPaymentSendFailureZ_is_ok(uint64_t o) {
16609         LDKCResult_PaymentHashPaymentSendFailureZ* o_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(o);
16610         jboolean ret_conv = CResult_PaymentHashPaymentSendFailureZ_is_ok(o_conv);
16611         return ret_conv;
16612 }
16613
16614 void  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_free"))) TS_CResult_PaymentHashPaymentSendFailureZ_free(uint64_t _res) {
16615         if (!ptr_is_owned(_res)) return;
16616         void* _res_ptr = untag_ptr(_res);
16617         CHECK_ACCESS(_res_ptr);
16618         LDKCResult_PaymentHashPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentHashPaymentSendFailureZ*)(_res_ptr);
16619         FREE(untag_ptr(_res));
16620         CResult_PaymentHashPaymentSendFailureZ_free(_res_conv);
16621 }
16622
16623 static inline uint64_t CResult_PaymentHashPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR arg) {
16624         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
16625         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(arg);
16626         return tag_ptr(ret_conv, true);
16627 }
16628 int64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_clone_ptr"))) TS_CResult_PaymentHashPaymentSendFailureZ_clone_ptr(uint64_t arg) {
16629         LDKCResult_PaymentHashPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(arg);
16630         int64_t ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone_ptr(arg_conv);
16631         return ret_conv;
16632 }
16633
16634 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_clone"))) TS_CResult_PaymentHashPaymentSendFailureZ_clone(uint64_t orig) {
16635         LDKCResult_PaymentHashPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(orig);
16636         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
16637         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(orig_conv);
16638         return tag_ptr(ret_conv, true);
16639 }
16640
16641 static inline uint64_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
16642         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
16643         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
16644         return tag_ptr(ret_conv, true);
16645 }
16646 int64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr(uint64_t arg) {
16647         LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(arg);
16648         int64_t ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
16649         return ret_conv;
16650 }
16651
16652 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint64_t orig) {
16653         LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(orig);
16654         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
16655         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
16656         return tag_ptr(ret_conv, true);
16657 }
16658
16659 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_new"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, int8_tArray b) {
16660         LDKThirtyTwoBytes a_ref;
16661         CHECK(a->arr_len == 32);
16662         memcpy(a_ref.data, a->elems, 32); FREE(a);
16663         LDKThirtyTwoBytes b_ref;
16664         CHECK(b->arr_len == 32);
16665         memcpy(b_ref.data, b->elems, 32); FREE(b);
16666         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
16667         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
16668         return tag_ptr(ret_conv, true);
16669 }
16670
16671 void  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_free"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint64_t _res) {
16672         if (!ptr_is_owned(_res)) return;
16673         void* _res_ptr = untag_ptr(_res);
16674         CHECK_ACCESS(_res_ptr);
16675         LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
16676         FREE(untag_ptr(_res));
16677         C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
16678 }
16679
16680 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint64_t o) {
16681         void* o_ptr = untag_ptr(o);
16682         CHECK_ACCESS(o_ptr);
16683         LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
16684         o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(o));
16685         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16686         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
16687         return tag_ptr(ret_conv, true);
16688 }
16689
16690 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint64_t e) {
16691         void* e_ptr = untag_ptr(e);
16692         CHECK_ACCESS(e_ptr);
16693         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
16694         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
16695         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16696         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
16697         return tag_ptr(ret_conv, true);
16698 }
16699
16700 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(uint64_t o) {
16701         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(o);
16702         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
16703         return ret_conv;
16704 }
16705
16706 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint64_t _res) {
16707         if (!ptr_is_owned(_res)) return;
16708         void* _res_ptr = untag_ptr(_res);
16709         CHECK_ACCESS(_res_ptr);
16710         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
16711         FREE(untag_ptr(_res));
16712         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
16713 }
16714
16715 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
16716         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16717         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
16718         return tag_ptr(ret_conv, true);
16719 }
16720 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(uint64_t arg) {
16721         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(arg);
16722         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
16723         return ret_conv;
16724 }
16725
16726 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint64_t orig) {
16727         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(orig);
16728         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16729         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
16730         return tag_ptr(ret_conv, true);
16731 }
16732
16733 void  __attribute__((export_name("TS_CVec_ThirtyTwoBytesZ_free"))) TS_CVec_ThirtyTwoBytesZ_free(ptrArray _res) {
16734         LDKCVec_ThirtyTwoBytesZ _res_constr;
16735         _res_constr.datalen = _res->arr_len;
16736         if (_res_constr.datalen > 0)
16737                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
16738         else
16739                 _res_constr.data = NULL;
16740         int8_tArray* _res_vals = (void*) _res->elems;
16741         for (size_t m = 0; m < _res_constr.datalen; m++) {
16742                 int8_tArray _res_conv_12 = _res_vals[m];
16743                 LDKThirtyTwoBytes _res_conv_12_ref;
16744                 CHECK(_res_conv_12->arr_len == 32);
16745                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
16746                 _res_constr.data[m] = _res_conv_12_ref;
16747         }
16748         FREE(_res);
16749         CVec_ThirtyTwoBytesZ_free(_res_constr);
16750 }
16751
16752 static inline uint64_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
16753         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16754         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
16755         return tag_ptr(ret_conv, true);
16756 }
16757 int64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(uint64_t arg) {
16758         LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(arg);
16759         int64_t ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
16760         return ret_conv;
16761 }
16762
16763 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint64_t orig) {
16764         LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(orig);
16765         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16766         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
16767         return tag_ptr(ret_conv, true);
16768 }
16769
16770 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_new"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
16771         LDKThirtyTwoBytes a_ref;
16772         CHECK(a->arr_len == 32);
16773         memcpy(a_ref.data, a->elems, 32); FREE(a);
16774         LDKThirtyTwoBytes b_ref;
16775         CHECK(b->arr_len == 32);
16776         memcpy(b_ref.data, b->elems, 32); FREE(b);
16777         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16778         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
16779         return tag_ptr(ret_conv, true);
16780 }
16781
16782 void  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_free"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint64_t _res) {
16783         if (!ptr_is_owned(_res)) return;
16784         void* _res_ptr = untag_ptr(_res);
16785         CHECK_ACCESS(_res_ptr);
16786         LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
16787         FREE(untag_ptr(_res));
16788         C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
16789 }
16790
16791 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(uint64_t o) {
16792         void* o_ptr = untag_ptr(o);
16793         CHECK_ACCESS(o_ptr);
16794         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
16795         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
16796         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16797         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
16798         return tag_ptr(ret_conv, true);
16799 }
16800
16801 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() {
16802         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16803         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
16804         return tag_ptr(ret_conv, true);
16805 }
16806
16807 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(uint64_t o) {
16808         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(o);
16809         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
16810         return ret_conv;
16811 }
16812
16813 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(uint64_t _res) {
16814         if (!ptr_is_owned(_res)) return;
16815         void* _res_ptr = untag_ptr(_res);
16816         CHECK_ACCESS(_res_ptr);
16817         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
16818         FREE(untag_ptr(_res));
16819         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
16820 }
16821
16822 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
16823         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16824         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
16825         return tag_ptr(ret_conv, true);
16826 }
16827 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(uint64_t arg) {
16828         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(arg);
16829         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
16830         return ret_conv;
16831 }
16832
16833 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(uint64_t orig) {
16834         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(orig);
16835         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16836         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
16837         return tag_ptr(ret_conv, true);
16838 }
16839
16840 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(uint64_t o) {
16841         void* o_ptr = untag_ptr(o);
16842         CHECK_ACCESS(o_ptr);
16843         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
16844         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
16845         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16846         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
16847         return tag_ptr(ret_conv, true);
16848 }
16849
16850 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(uint64_t e) {
16851         void* e_ptr = untag_ptr(e);
16852         CHECK_ACCESS(e_ptr);
16853         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16854         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
16855         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16856         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
16857         return tag_ptr(ret_conv, true);
16858 }
16859
16860 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(uint64_t o) {
16861         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(o);
16862         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
16863         return ret_conv;
16864 }
16865
16866 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(uint64_t _res) {
16867         if (!ptr_is_owned(_res)) return;
16868         void* _res_ptr = untag_ptr(_res);
16869         CHECK_ACCESS(_res_ptr);
16870         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
16871         FREE(untag_ptr(_res));
16872         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
16873 }
16874
16875 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
16876         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16877         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
16878         return tag_ptr(ret_conv, true);
16879 }
16880 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(uint64_t arg) {
16881         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(arg);
16882         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
16883         return ret_conv;
16884 }
16885
16886 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(uint64_t orig) {
16887         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(orig);
16888         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16889         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
16890         return tag_ptr(ret_conv, true);
16891 }
16892
16893 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_ok"))) TS_CResult_PaymentSecretNoneZ_ok(int8_tArray o) {
16894         LDKThirtyTwoBytes o_ref;
16895         CHECK(o->arr_len == 32);
16896         memcpy(o_ref.data, o->elems, 32); FREE(o);
16897         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16898         *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
16899         return tag_ptr(ret_conv, true);
16900 }
16901
16902 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_err"))) TS_CResult_PaymentSecretNoneZ_err() {
16903         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16904         *ret_conv = CResult_PaymentSecretNoneZ_err();
16905         return tag_ptr(ret_conv, true);
16906 }
16907
16908 jboolean  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_is_ok"))) TS_CResult_PaymentSecretNoneZ_is_ok(uint64_t o) {
16909         LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(o);
16910         jboolean ret_conv = CResult_PaymentSecretNoneZ_is_ok(o_conv);
16911         return ret_conv;
16912 }
16913
16914 void  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_free"))) TS_CResult_PaymentSecretNoneZ_free(uint64_t _res) {
16915         if (!ptr_is_owned(_res)) return;
16916         void* _res_ptr = untag_ptr(_res);
16917         CHECK_ACCESS(_res_ptr);
16918         LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
16919         FREE(untag_ptr(_res));
16920         CResult_PaymentSecretNoneZ_free(_res_conv);
16921 }
16922
16923 static inline uint64_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
16924         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16925         *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
16926         return tag_ptr(ret_conv, true);
16927 }
16928 int64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone_ptr"))) TS_CResult_PaymentSecretNoneZ_clone_ptr(uint64_t arg) {
16929         LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(arg);
16930         int64_t ret_conv = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
16931         return ret_conv;
16932 }
16933
16934 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone"))) TS_CResult_PaymentSecretNoneZ_clone(uint64_t orig) {
16935         LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(orig);
16936         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16937         *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
16938         return tag_ptr(ret_conv, true);
16939 }
16940
16941 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_ok"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
16942         LDKThirtyTwoBytes o_ref;
16943         CHECK(o->arr_len == 32);
16944         memcpy(o_ref.data, o->elems, 32); FREE(o);
16945         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16946         *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
16947         return tag_ptr(ret_conv, true);
16948 }
16949
16950 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_err"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint64_t e) {
16951         void* e_ptr = untag_ptr(e);
16952         CHECK_ACCESS(e_ptr);
16953         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16954         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
16955         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16956         *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
16957         return tag_ptr(ret_conv, true);
16958 }
16959
16960 jboolean  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_is_ok"))) TS_CResult_PaymentSecretAPIErrorZ_is_ok(uint64_t o) {
16961         LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(o);
16962         jboolean ret_conv = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
16963         return ret_conv;
16964 }
16965
16966 void  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_free"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint64_t _res) {
16967         if (!ptr_is_owned(_res)) return;
16968         void* _res_ptr = untag_ptr(_res);
16969         CHECK_ACCESS(_res_ptr);
16970         LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
16971         FREE(untag_ptr(_res));
16972         CResult_PaymentSecretAPIErrorZ_free(_res_conv);
16973 }
16974
16975 static inline uint64_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
16976         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16977         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
16978         return tag_ptr(ret_conv, true);
16979 }
16980 int64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone_ptr"))) TS_CResult_PaymentSecretAPIErrorZ_clone_ptr(uint64_t arg) {
16981         LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(arg);
16982         int64_t ret_conv = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
16983         return ret_conv;
16984 }
16985
16986 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint64_t orig) {
16987         LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(orig);
16988         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16989         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
16990         return tag_ptr(ret_conv, true);
16991 }
16992
16993 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_ok(int8_tArray o) {
16994         LDKThirtyTwoBytes o_ref;
16995         CHECK(o->arr_len == 32);
16996         memcpy(o_ref.data, o->elems, 32); FREE(o);
16997         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16998         *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
16999         return tag_ptr(ret_conv, true);
17000 }
17001
17002 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_err"))) TS_CResult_PaymentPreimageAPIErrorZ_err(uint64_t e) {
17003         void* e_ptr = untag_ptr(e);
17004         CHECK_ACCESS(e_ptr);
17005         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
17006         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
17007         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17008         *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
17009         return tag_ptr(ret_conv, true);
17010 }
17011
17012 jboolean  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_is_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_is_ok(uint64_t o) {
17013         LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(o);
17014         jboolean ret_conv = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
17015         return ret_conv;
17016 }
17017
17018 void  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_free"))) TS_CResult_PaymentPreimageAPIErrorZ_free(uint64_t _res) {
17019         if (!ptr_is_owned(_res)) return;
17020         void* _res_ptr = untag_ptr(_res);
17021         CHECK_ACCESS(_res_ptr);
17022         LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
17023         FREE(untag_ptr(_res));
17024         CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
17025 }
17026
17027 static inline uint64_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
17028         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17029         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
17030         return tag_ptr(ret_conv, true);
17031 }
17032 int64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr"))) TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr(uint64_t arg) {
17033         LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(arg);
17034         int64_t ret_conv = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
17035         return ret_conv;
17036 }
17037
17038 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone"))) TS_CResult_PaymentPreimageAPIErrorZ_clone(uint64_t orig) {
17039         LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(orig);
17040         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
17041         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
17042         return tag_ptr(ret_conv, true);
17043 }
17044
17045 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(uint64_t o) {
17046         LDKCounterpartyForwardingInfo o_conv;
17047         o_conv.inner = untag_ptr(o);
17048         o_conv.is_owned = ptr_is_owned(o);
17049         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17050         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
17051         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17052         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
17053         return tag_ptr(ret_conv, true);
17054 }
17055
17056 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(uint64_t e) {
17057         void* e_ptr = untag_ptr(e);
17058         CHECK_ACCESS(e_ptr);
17059         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17060         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17061         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17062         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
17063         return tag_ptr(ret_conv, true);
17064 }
17065
17066 jboolean  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(uint64_t o) {
17067         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
17068         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
17069         return ret_conv;
17070 }
17071
17072 void  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(uint64_t _res) {
17073         if (!ptr_is_owned(_res)) return;
17074         void* _res_ptr = untag_ptr(_res);
17075         CHECK_ACCESS(_res_ptr);
17076         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
17077         FREE(untag_ptr(_res));
17078         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
17079 }
17080
17081 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
17082         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17083         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
17084         return tag_ptr(ret_conv, true);
17085 }
17086 int64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
17087         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
17088         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
17089         return ret_conv;
17090 }
17091
17092 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(uint64_t orig) {
17093         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
17094         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
17095         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
17096         return tag_ptr(ret_conv, true);
17097 }
17098
17099 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_ok(uint64_t o) {
17100         LDKChannelCounterparty o_conv;
17101         o_conv.inner = untag_ptr(o);
17102         o_conv.is_owned = ptr_is_owned(o);
17103         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17104         o_conv = ChannelCounterparty_clone(&o_conv);
17105         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17106         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
17107         return tag_ptr(ret_conv, true);
17108 }
17109
17110 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_err(uint64_t e) {
17111         void* e_ptr = untag_ptr(e);
17112         CHECK_ACCESS(e_ptr);
17113         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17114         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17115         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17116         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
17117         return tag_ptr(ret_conv, true);
17118 }
17119
17120 jboolean  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(uint64_t o) {
17121         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
17122         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
17123         return ret_conv;
17124 }
17125
17126 void  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_free"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_free(uint64_t _res) {
17127         if (!ptr_is_owned(_res)) return;
17128         void* _res_ptr = untag_ptr(_res);
17129         CHECK_ACCESS(_res_ptr);
17130         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
17131         FREE(untag_ptr(_res));
17132         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
17133 }
17134
17135 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
17136         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17137         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
17138         return tag_ptr(ret_conv, true);
17139 }
17140 int64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(uint64_t arg) {
17141         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
17142         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
17143         return ret_conv;
17144 }
17145
17146 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone(uint64_t orig) {
17147         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
17148         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
17149         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
17150         return tag_ptr(ret_conv, true);
17151 }
17152
17153 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_ok(uint64_t o) {
17154         LDKChannelDetails o_conv;
17155         o_conv.inner = untag_ptr(o);
17156         o_conv.is_owned = ptr_is_owned(o);
17157         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17158         o_conv = ChannelDetails_clone(&o_conv);
17159         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17160         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
17161         return tag_ptr(ret_conv, true);
17162 }
17163
17164 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_err(uint64_t e) {
17165         void* e_ptr = untag_ptr(e);
17166         CHECK_ACCESS(e_ptr);
17167         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17168         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17169         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17170         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
17171         return tag_ptr(ret_conv, true);
17172 }
17173
17174 jboolean  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_is_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_is_ok(uint64_t o) {
17175         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
17176         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
17177         return ret_conv;
17178 }
17179
17180 void  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_free"))) TS_CResult_ChannelDetailsDecodeErrorZ_free(uint64_t _res) {
17181         if (!ptr_is_owned(_res)) return;
17182         void* _res_ptr = untag_ptr(_res);
17183         CHECK_ACCESS(_res_ptr);
17184         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
17185         FREE(untag_ptr(_res));
17186         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
17187 }
17188
17189 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
17190         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17191         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
17192         return tag_ptr(ret_conv, true);
17193 }
17194 int64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(uint64_t arg) {
17195         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
17196         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
17197         return ret_conv;
17198 }
17199
17200 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone(uint64_t orig) {
17201         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
17202         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
17203         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
17204         return tag_ptr(ret_conv, true);
17205 }
17206
17207 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_ok(uint64_t o) {
17208         LDKPhantomRouteHints o_conv;
17209         o_conv.inner = untag_ptr(o);
17210         o_conv.is_owned = ptr_is_owned(o);
17211         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17212         o_conv = PhantomRouteHints_clone(&o_conv);
17213         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17214         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
17215         return tag_ptr(ret_conv, true);
17216 }
17217
17218 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_err(uint64_t e) {
17219         void* e_ptr = untag_ptr(e);
17220         CHECK_ACCESS(e_ptr);
17221         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17222         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17223         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17224         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
17225         return tag_ptr(ret_conv, true);
17226 }
17227
17228 jboolean  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(uint64_t o) {
17229         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
17230         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
17231         return ret_conv;
17232 }
17233
17234 void  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_free"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_free(uint64_t _res) {
17235         if (!ptr_is_owned(_res)) return;
17236         void* _res_ptr = untag_ptr(_res);
17237         CHECK_ACCESS(_res_ptr);
17238         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
17239         FREE(untag_ptr(_res));
17240         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
17241 }
17242
17243 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
17244         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17245         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
17246         return tag_ptr(ret_conv, true);
17247 }
17248 int64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(uint64_t arg) {
17249         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
17250         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
17251         return ret_conv;
17252 }
17253
17254 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone(uint64_t orig) {
17255         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
17256         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
17257         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
17258         return tag_ptr(ret_conv, true);
17259 }
17260
17261 void  __attribute__((export_name("TS_CVec_ChannelMonitorZ_free"))) TS_CVec_ChannelMonitorZ_free(uint64_tArray _res) {
17262         LDKCVec_ChannelMonitorZ _res_constr;
17263         _res_constr.datalen = _res->arr_len;
17264         if (_res_constr.datalen > 0)
17265                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
17266         else
17267                 _res_constr.data = NULL;
17268         uint64_t* _res_vals = _res->elems;
17269         for (size_t q = 0; q < _res_constr.datalen; q++) {
17270                 uint64_t _res_conv_16 = _res_vals[q];
17271                 LDKChannelMonitor _res_conv_16_conv;
17272                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
17273                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
17274                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
17275                 _res_constr.data[q] = _res_conv_16_conv;
17276         }
17277         FREE(_res);
17278         CVec_ChannelMonitorZ_free(_res_constr);
17279 }
17280
17281 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_new"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint64_t b) {
17282         LDKThirtyTwoBytes a_ref;
17283         CHECK(a->arr_len == 32);
17284         memcpy(a_ref.data, a->elems, 32); FREE(a);
17285         LDKChannelManager b_conv;
17286         b_conv.inner = untag_ptr(b);
17287         b_conv.is_owned = ptr_is_owned(b);
17288         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
17289         // WARNING: we need a move here but no clone is available for LDKChannelManager
17290         
17291         LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
17292         *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
17293         return tag_ptr(ret_conv, true);
17294 }
17295
17296 void  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_free"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint64_t _res) {
17297         if (!ptr_is_owned(_res)) return;
17298         void* _res_ptr = untag_ptr(_res);
17299         CHECK_ACCESS(_res_ptr);
17300         LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
17301         FREE(untag_ptr(_res));
17302         C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
17303 }
17304
17305 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint64_t o) {
17306         void* o_ptr = untag_ptr(o);
17307         CHECK_ACCESS(o_ptr);
17308         LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
17309         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
17310         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
17311         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
17312         return tag_ptr(ret_conv, true);
17313 }
17314
17315 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint64_t e) {
17316         void* e_ptr = untag_ptr(e);
17317         CHECK_ACCESS(e_ptr);
17318         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17319         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17320         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
17321         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
17322         return tag_ptr(ret_conv, true);
17323 }
17324
17325 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(uint64_t o) {
17326         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(o);
17327         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
17328         return ret_conv;
17329 }
17330
17331 void  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint64_t _res) {
17332         if (!ptr_is_owned(_res)) return;
17333         void* _res_ptr = untag_ptr(_res);
17334         CHECK_ACCESS(_res_ptr);
17335         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
17336         FREE(untag_ptr(_res));
17337         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
17338 }
17339
17340 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint64_t o) {
17341         LDKChannelConfig o_conv;
17342         o_conv.inner = untag_ptr(o);
17343         o_conv.is_owned = ptr_is_owned(o);
17344         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17345         o_conv = ChannelConfig_clone(&o_conv);
17346         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
17347         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
17348         return tag_ptr(ret_conv, true);
17349 }
17350
17351 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_err"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint64_t e) {
17352         void* e_ptr = untag_ptr(e);
17353         CHECK_ACCESS(e_ptr);
17354         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17355         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17356         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
17357         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
17358         return tag_ptr(ret_conv, true);
17359 }
17360
17361 jboolean  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_is_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint64_t o) {
17362         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
17363         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
17364         return ret_conv;
17365 }
17366
17367 void  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_free"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint64_t _res) {
17368         if (!ptr_is_owned(_res)) return;
17369         void* _res_ptr = untag_ptr(_res);
17370         CHECK_ACCESS(_res_ptr);
17371         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
17372         FREE(untag_ptr(_res));
17373         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
17374 }
17375
17376 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
17377         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
17378         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
17379         return tag_ptr(ret_conv, true);
17380 }
17381 int64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint64_t arg) {
17382         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
17383         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
17384         return ret_conv;
17385 }
17386
17387 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint64_t orig) {
17388         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
17389         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
17390         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
17391         return tag_ptr(ret_conv, true);
17392 }
17393
17394 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint64_t o) {
17395         LDKOutPoint o_conv;
17396         o_conv.inner = untag_ptr(o);
17397         o_conv.is_owned = ptr_is_owned(o);
17398         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17399         o_conv = OutPoint_clone(&o_conv);
17400         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
17401         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
17402         return tag_ptr(ret_conv, true);
17403 }
17404
17405 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_err"))) TS_CResult_OutPointDecodeErrorZ_err(uint64_t e) {
17406         void* e_ptr = untag_ptr(e);
17407         CHECK_ACCESS(e_ptr);
17408         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17409         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17410         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
17411         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
17412         return tag_ptr(ret_conv, true);
17413 }
17414
17415 jboolean  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_is_ok"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint64_t o) {
17416         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
17417         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
17418         return ret_conv;
17419 }
17420
17421 void  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_free"))) TS_CResult_OutPointDecodeErrorZ_free(uint64_t _res) {
17422         if (!ptr_is_owned(_res)) return;
17423         void* _res_ptr = untag_ptr(_res);
17424         CHECK_ACCESS(_res_ptr);
17425         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
17426         FREE(untag_ptr(_res));
17427         CResult_OutPointDecodeErrorZ_free(_res_conv);
17428 }
17429
17430 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
17431         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
17432         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
17433         return tag_ptr(ret_conv, true);
17434 }
17435 int64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone_ptr"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint64_t arg) {
17436         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
17437         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
17438         return ret_conv;
17439 }
17440
17441 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone"))) TS_CResult_OutPointDecodeErrorZ_clone(uint64_t orig) {
17442         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
17443         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
17444         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
17445         return tag_ptr(ret_conv, true);
17446 }
17447
17448 uint64_t  __attribute__((export_name("TS_COption_TypeZ_some"))) TS_COption_TypeZ_some(uint64_t o) {
17449         void* o_ptr = untag_ptr(o);
17450         CHECK_ACCESS(o_ptr);
17451         LDKType o_conv = *(LDKType*)(o_ptr);
17452         if (o_conv.free == LDKType_JCalls_free) {
17453                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
17454                 LDKType_JCalls_cloned(&o_conv);
17455         }
17456         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
17457         *ret_copy = COption_TypeZ_some(o_conv);
17458         uint64_t ret_ref = tag_ptr(ret_copy, true);
17459         return ret_ref;
17460 }
17461
17462 uint64_t  __attribute__((export_name("TS_COption_TypeZ_none"))) TS_COption_TypeZ_none() {
17463         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
17464         *ret_copy = COption_TypeZ_none();
17465         uint64_t ret_ref = tag_ptr(ret_copy, true);
17466         return ret_ref;
17467 }
17468
17469 void  __attribute__((export_name("TS_COption_TypeZ_free"))) TS_COption_TypeZ_free(uint64_t _res) {
17470         if (!ptr_is_owned(_res)) return;
17471         void* _res_ptr = untag_ptr(_res);
17472         CHECK_ACCESS(_res_ptr);
17473         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
17474         FREE(untag_ptr(_res));
17475         COption_TypeZ_free(_res_conv);
17476 }
17477
17478 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
17479         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
17480         *ret_copy = COption_TypeZ_clone(arg);
17481         uint64_t ret_ref = tag_ptr(ret_copy, true);
17482         return ret_ref;
17483 }
17484 int64_t  __attribute__((export_name("TS_COption_TypeZ_clone_ptr"))) TS_COption_TypeZ_clone_ptr(uint64_t arg) {
17485         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
17486         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
17487         return ret_conv;
17488 }
17489
17490 uint64_t  __attribute__((export_name("TS_COption_TypeZ_clone"))) TS_COption_TypeZ_clone(uint64_t orig) {
17491         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
17492         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
17493         *ret_copy = COption_TypeZ_clone(orig_conv);
17494         uint64_t ret_ref = tag_ptr(ret_copy, true);
17495         return ret_ref;
17496 }
17497
17498 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint64_t o) {
17499         void* o_ptr = untag_ptr(o);
17500         CHECK_ACCESS(o_ptr);
17501         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
17502         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
17503         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
17504         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
17505         return tag_ptr(ret_conv, true);
17506 }
17507
17508 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_err"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint64_t e) {
17509         void* e_ptr = untag_ptr(e);
17510         CHECK_ACCESS(e_ptr);
17511         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17512         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17513         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
17514         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
17515         return tag_ptr(ret_conv, true);
17516 }
17517
17518 jboolean  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_is_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint64_t o) {
17519         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
17520         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
17521         return ret_conv;
17522 }
17523
17524 void  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_free"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint64_t _res) {
17525         if (!ptr_is_owned(_res)) return;
17526         void* _res_ptr = untag_ptr(_res);
17527         CHECK_ACCESS(_res_ptr);
17528         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
17529         FREE(untag_ptr(_res));
17530         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
17531 }
17532
17533 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
17534         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
17535         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
17536         return tag_ptr(ret_conv, true);
17537 }
17538 int64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint64_t arg) {
17539         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
17540         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
17541         return ret_conv;
17542 }
17543
17544 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint64_t orig) {
17545         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
17546         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
17547         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
17548         return tag_ptr(ret_conv, true);
17549 }
17550
17551 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_ok"))) TS_CResult_PaymentIdPaymentErrorZ_ok(int8_tArray o) {
17552         LDKThirtyTwoBytes o_ref;
17553         CHECK(o->arr_len == 32);
17554         memcpy(o_ref.data, o->elems, 32); FREE(o);
17555         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
17556         *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
17557         return tag_ptr(ret_conv, true);
17558 }
17559
17560 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_err"))) TS_CResult_PaymentIdPaymentErrorZ_err(uint64_t e) {
17561         void* e_ptr = untag_ptr(e);
17562         CHECK_ACCESS(e_ptr);
17563         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
17564         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
17565         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
17566         *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
17567         return tag_ptr(ret_conv, true);
17568 }
17569
17570 jboolean  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_is_ok"))) TS_CResult_PaymentIdPaymentErrorZ_is_ok(uint64_t o) {
17571         LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(o);
17572         jboolean ret_conv = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
17573         return ret_conv;
17574 }
17575
17576 void  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_free"))) TS_CResult_PaymentIdPaymentErrorZ_free(uint64_t _res) {
17577         if (!ptr_is_owned(_res)) return;
17578         void* _res_ptr = untag_ptr(_res);
17579         CHECK_ACCESS(_res_ptr);
17580         LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
17581         FREE(untag_ptr(_res));
17582         CResult_PaymentIdPaymentErrorZ_free(_res_conv);
17583 }
17584
17585 static inline uint64_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
17586         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
17587         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
17588         return tag_ptr(ret_conv, true);
17589 }
17590 int64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone_ptr"))) TS_CResult_PaymentIdPaymentErrorZ_clone_ptr(uint64_t arg) {
17591         LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(arg);
17592         int64_t ret_conv = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
17593         return ret_conv;
17594 }
17595
17596 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone"))) TS_CResult_PaymentIdPaymentErrorZ_clone(uint64_t orig) {
17597         LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(orig);
17598         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
17599         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
17600         return tag_ptr(ret_conv, true);
17601 }
17602
17603 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_ok"))) TS_CResult_NonePaymentErrorZ_ok() {
17604         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
17605         *ret_conv = CResult_NonePaymentErrorZ_ok();
17606         return tag_ptr(ret_conv, true);
17607 }
17608
17609 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_err"))) TS_CResult_NonePaymentErrorZ_err(uint64_t e) {
17610         void* e_ptr = untag_ptr(e);
17611         CHECK_ACCESS(e_ptr);
17612         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
17613         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
17614         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
17615         *ret_conv = CResult_NonePaymentErrorZ_err(e_conv);
17616         return tag_ptr(ret_conv, true);
17617 }
17618
17619 jboolean  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_is_ok"))) TS_CResult_NonePaymentErrorZ_is_ok(uint64_t o) {
17620         LDKCResult_NonePaymentErrorZ* o_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(o);
17621         jboolean ret_conv = CResult_NonePaymentErrorZ_is_ok(o_conv);
17622         return ret_conv;
17623 }
17624
17625 void  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_free"))) TS_CResult_NonePaymentErrorZ_free(uint64_t _res) {
17626         if (!ptr_is_owned(_res)) return;
17627         void* _res_ptr = untag_ptr(_res);
17628         CHECK_ACCESS(_res_ptr);
17629         LDKCResult_NonePaymentErrorZ _res_conv = *(LDKCResult_NonePaymentErrorZ*)(_res_ptr);
17630         FREE(untag_ptr(_res));
17631         CResult_NonePaymentErrorZ_free(_res_conv);
17632 }
17633
17634 static inline uint64_t CResult_NonePaymentErrorZ_clone_ptr(LDKCResult_NonePaymentErrorZ *NONNULL_PTR arg) {
17635         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
17636         *ret_conv = CResult_NonePaymentErrorZ_clone(arg);
17637         return tag_ptr(ret_conv, true);
17638 }
17639 int64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_clone_ptr"))) TS_CResult_NonePaymentErrorZ_clone_ptr(uint64_t arg) {
17640         LDKCResult_NonePaymentErrorZ* arg_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(arg);
17641         int64_t ret_conv = CResult_NonePaymentErrorZ_clone_ptr(arg_conv);
17642         return ret_conv;
17643 }
17644
17645 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_clone"))) TS_CResult_NonePaymentErrorZ_clone(uint64_t orig) {
17646         LDKCResult_NonePaymentErrorZ* orig_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(orig);
17647         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
17648         *ret_conv = CResult_NonePaymentErrorZ_clone(orig_conv);
17649         return tag_ptr(ret_conv, true);
17650 }
17651
17652 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_ok"))) TS_CResult_StringErrorZ_ok(jstring o) {
17653         LDKStr o_conv = str_ref_to_owned_c(o);
17654         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17655         *ret_conv = CResult_StringErrorZ_ok(o_conv);
17656         return tag_ptr(ret_conv, true);
17657 }
17658
17659 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_err"))) TS_CResult_StringErrorZ_err(uint32_t e) {
17660         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
17661         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17662         *ret_conv = CResult_StringErrorZ_err(e_conv);
17663         return tag_ptr(ret_conv, true);
17664 }
17665
17666 jboolean  __attribute__((export_name("TS_CResult_StringErrorZ_is_ok"))) TS_CResult_StringErrorZ_is_ok(uint64_t o) {
17667         LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)untag_ptr(o);
17668         jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv);
17669         return ret_conv;
17670 }
17671
17672 void  __attribute__((export_name("TS_CResult_StringErrorZ_free"))) TS_CResult_StringErrorZ_free(uint64_t _res) {
17673         if (!ptr_is_owned(_res)) return;
17674         void* _res_ptr = untag_ptr(_res);
17675         CHECK_ACCESS(_res_ptr);
17676         LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
17677         FREE(untag_ptr(_res));
17678         CResult_StringErrorZ_free(_res_conv);
17679 }
17680
17681 static inline uint64_t CResult_StringErrorZ_clone_ptr(LDKCResult_StringErrorZ *NONNULL_PTR arg) {
17682         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17683         *ret_conv = CResult_StringErrorZ_clone(arg);
17684         return tag_ptr(ret_conv, true);
17685 }
17686 int64_t  __attribute__((export_name("TS_CResult_StringErrorZ_clone_ptr"))) TS_CResult_StringErrorZ_clone_ptr(uint64_t arg) {
17687         LDKCResult_StringErrorZ* arg_conv = (LDKCResult_StringErrorZ*)untag_ptr(arg);
17688         int64_t ret_conv = CResult_StringErrorZ_clone_ptr(arg_conv);
17689         return ret_conv;
17690 }
17691
17692 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_clone"))) TS_CResult_StringErrorZ_clone(uint64_t orig) {
17693         LDKCResult_StringErrorZ* orig_conv = (LDKCResult_StringErrorZ*)untag_ptr(orig);
17694         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17695         *ret_conv = CResult_StringErrorZ_clone(orig_conv);
17696         return tag_ptr(ret_conv, true);
17697 }
17698
17699 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_ok"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
17700         LDKPublicKey o_ref;
17701         CHECK(o->arr_len == 33);
17702         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
17703         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
17704         *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
17705         return tag_ptr(ret_conv, true);
17706 }
17707
17708 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_err"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
17709         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
17710         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
17711         *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
17712         return tag_ptr(ret_conv, true);
17713 }
17714
17715 jboolean  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_is_ok"))) TS_CResult_PublicKeyErrorZ_is_ok(uint64_t o) {
17716         LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(o);
17717         jboolean ret_conv = CResult_PublicKeyErrorZ_is_ok(o_conv);
17718         return ret_conv;
17719 }
17720
17721 void  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_free"))) TS_CResult_PublicKeyErrorZ_free(uint64_t _res) {
17722         if (!ptr_is_owned(_res)) return;
17723         void* _res_ptr = untag_ptr(_res);
17724         CHECK_ACCESS(_res_ptr);
17725         LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
17726         FREE(untag_ptr(_res));
17727         CResult_PublicKeyErrorZ_free(_res_conv);
17728 }
17729
17730 static inline uint64_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
17731         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
17732         *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
17733         return tag_ptr(ret_conv, true);
17734 }
17735 int64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone_ptr"))) TS_CResult_PublicKeyErrorZ_clone_ptr(uint64_t arg) {
17736         LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(arg);
17737         int64_t ret_conv = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
17738         return ret_conv;
17739 }
17740
17741 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone"))) TS_CResult_PublicKeyErrorZ_clone(uint64_t orig) {
17742         LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(orig);
17743         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
17744         *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
17745         return tag_ptr(ret_conv, true);
17746 }
17747
17748 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint64_t o) {
17749         LDKChannelMonitorUpdate o_conv;
17750         o_conv.inner = untag_ptr(o);
17751         o_conv.is_owned = ptr_is_owned(o);
17752         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17753         o_conv = ChannelMonitorUpdate_clone(&o_conv);
17754         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17755         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
17756         return tag_ptr(ret_conv, true);
17757 }
17758
17759 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint64_t e) {
17760         void* e_ptr = untag_ptr(e);
17761         CHECK_ACCESS(e_ptr);
17762         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17763         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17764         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17765         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
17766         return tag_ptr(ret_conv, true);
17767 }
17768
17769 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint64_t o) {
17770         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
17771         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
17772         return ret_conv;
17773 }
17774
17775 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint64_t _res) {
17776         if (!ptr_is_owned(_res)) return;
17777         void* _res_ptr = untag_ptr(_res);
17778         CHECK_ACCESS(_res_ptr);
17779         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
17780         FREE(untag_ptr(_res));
17781         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
17782 }
17783
17784 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
17785         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17786         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
17787         return tag_ptr(ret_conv, true);
17788 }
17789 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
17790         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
17791         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
17792         return ret_conv;
17793 }
17794
17795 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint64_t orig) {
17796         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
17797         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17798         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
17799         return tag_ptr(ret_conv, true);
17800 }
17801
17802 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint64_t o) {
17803         void* o_ptr = untag_ptr(o);
17804         CHECK_ACCESS(o_ptr);
17805         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
17806         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
17807         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17808         *ret_copy = COption_MonitorEventZ_some(o_conv);
17809         uint64_t ret_ref = tag_ptr(ret_copy, true);
17810         return ret_ref;
17811 }
17812
17813 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() {
17814         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17815         *ret_copy = COption_MonitorEventZ_none();
17816         uint64_t ret_ref = tag_ptr(ret_copy, true);
17817         return ret_ref;
17818 }
17819
17820 void  __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint64_t _res) {
17821         if (!ptr_is_owned(_res)) return;
17822         void* _res_ptr = untag_ptr(_res);
17823         CHECK_ACCESS(_res_ptr);
17824         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
17825         FREE(untag_ptr(_res));
17826         COption_MonitorEventZ_free(_res_conv);
17827 }
17828
17829 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
17830         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17831         *ret_copy = COption_MonitorEventZ_clone(arg);
17832         uint64_t ret_ref = tag_ptr(ret_copy, true);
17833         return ret_ref;
17834 }
17835 int64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint64_t arg) {
17836         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
17837         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
17838         return ret_conv;
17839 }
17840
17841 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint64_t orig) {
17842         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
17843         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17844         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
17845         uint64_t ret_ref = tag_ptr(ret_copy, true);
17846         return ret_ref;
17847 }
17848
17849 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint64_t o) {
17850         void* o_ptr = untag_ptr(o);
17851         CHECK_ACCESS(o_ptr);
17852         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
17853         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
17854         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17855         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
17856         return tag_ptr(ret_conv, true);
17857 }
17858
17859 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint64_t e) {
17860         void* e_ptr = untag_ptr(e);
17861         CHECK_ACCESS(e_ptr);
17862         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17863         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17864         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17865         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
17866         return tag_ptr(ret_conv, true);
17867 }
17868
17869 jboolean  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint64_t o) {
17870         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
17871         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
17872         return ret_conv;
17873 }
17874
17875 void  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint64_t _res) {
17876         if (!ptr_is_owned(_res)) return;
17877         void* _res_ptr = untag_ptr(_res);
17878         CHECK_ACCESS(_res_ptr);
17879         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
17880         FREE(untag_ptr(_res));
17881         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
17882 }
17883
17884 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
17885         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17886         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
17887         return tag_ptr(ret_conv, true);
17888 }
17889 int64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint64_t arg) {
17890         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
17891         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
17892         return ret_conv;
17893 }
17894
17895 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint64_t orig) {
17896         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
17897         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17898         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
17899         return tag_ptr(ret_conv, true);
17900 }
17901
17902 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint64_t o) {
17903         LDKHTLCUpdate o_conv;
17904         o_conv.inner = untag_ptr(o);
17905         o_conv.is_owned = ptr_is_owned(o);
17906         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17907         o_conv = HTLCUpdate_clone(&o_conv);
17908         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17909         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
17910         return tag_ptr(ret_conv, true);
17911 }
17912
17913 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint64_t e) {
17914         void* e_ptr = untag_ptr(e);
17915         CHECK_ACCESS(e_ptr);
17916         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17917         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17918         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17919         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
17920         return tag_ptr(ret_conv, true);
17921 }
17922
17923 jboolean  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_is_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint64_t o) {
17924         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
17925         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
17926         return ret_conv;
17927 }
17928
17929 void  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_free"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint64_t _res) {
17930         if (!ptr_is_owned(_res)) return;
17931         void* _res_ptr = untag_ptr(_res);
17932         CHECK_ACCESS(_res_ptr);
17933         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
17934         FREE(untag_ptr(_res));
17935         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
17936 }
17937
17938 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
17939         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17940         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
17941         return tag_ptr(ret_conv, true);
17942 }
17943 int64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
17944         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
17945         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
17946         return ret_conv;
17947 }
17948
17949 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint64_t orig) {
17950         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
17951         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17952         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
17953         return tag_ptr(ret_conv, true);
17954 }
17955
17956 static inline uint64_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
17957         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
17958         *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
17959         return tag_ptr(ret_conv, true);
17960 }
17961 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone_ptr"))) TS_C2Tuple_OutPointScriptZ_clone_ptr(uint64_t arg) {
17962         LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(arg);
17963         int64_t ret_conv = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
17964         return ret_conv;
17965 }
17966
17967 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone"))) TS_C2Tuple_OutPointScriptZ_clone(uint64_t orig) {
17968         LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(orig);
17969         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
17970         *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
17971         return tag_ptr(ret_conv, true);
17972 }
17973
17974 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_new"))) TS_C2Tuple_OutPointScriptZ_new(uint64_t a, int8_tArray b) {
17975         LDKOutPoint a_conv;
17976         a_conv.inner = untag_ptr(a);
17977         a_conv.is_owned = ptr_is_owned(a);
17978         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
17979         a_conv = OutPoint_clone(&a_conv);
17980         LDKCVec_u8Z b_ref;
17981         b_ref.datalen = b->arr_len;
17982         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
17983         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
17984         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
17985         *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
17986         return tag_ptr(ret_conv, true);
17987 }
17988
17989 void  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_free"))) TS_C2Tuple_OutPointScriptZ_free(uint64_t _res) {
17990         if (!ptr_is_owned(_res)) return;
17991         void* _res_ptr = untag_ptr(_res);
17992         CHECK_ACCESS(_res_ptr);
17993         LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
17994         FREE(untag_ptr(_res));
17995         C2Tuple_OutPointScriptZ_free(_res_conv);
17996 }
17997
17998 static inline uint64_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
17999         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
18000         *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
18001         return tag_ptr(ret_conv, true);
18002 }
18003 int64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone_ptr"))) TS_C2Tuple_u32ScriptZ_clone_ptr(uint64_t arg) {
18004         LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(arg);
18005         int64_t ret_conv = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
18006         return ret_conv;
18007 }
18008
18009 uint64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone"))) TS_C2Tuple_u32ScriptZ_clone(uint64_t orig) {
18010         LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(orig);
18011         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
18012         *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
18013         return tag_ptr(ret_conv, true);
18014 }
18015
18016 uint64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_new"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
18017         LDKCVec_u8Z b_ref;
18018         b_ref.datalen = b->arr_len;
18019         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
18020         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
18021         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
18022         *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
18023         return tag_ptr(ret_conv, true);
18024 }
18025
18026 void  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_free"))) TS_C2Tuple_u32ScriptZ_free(uint64_t _res) {
18027         if (!ptr_is_owned(_res)) return;
18028         void* _res_ptr = untag_ptr(_res);
18029         CHECK_ACCESS(_res_ptr);
18030         LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
18031         FREE(untag_ptr(_res));
18032         C2Tuple_u32ScriptZ_free(_res_conv);
18033 }
18034
18035 void  __attribute__((export_name("TS_CVec_C2Tuple_u32ScriptZZ_free"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint64_tArray _res) {
18036         LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
18037         _res_constr.datalen = _res->arr_len;
18038         if (_res_constr.datalen > 0)
18039                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
18040         else
18041                 _res_constr.data = NULL;
18042         uint64_t* _res_vals = _res->elems;
18043         for (size_t v = 0; v < _res_constr.datalen; v++) {
18044                 uint64_t _res_conv_21 = _res_vals[v];
18045                 void* _res_conv_21_ptr = untag_ptr(_res_conv_21);
18046                 CHECK_ACCESS(_res_conv_21_ptr);
18047                 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
18048                 FREE(untag_ptr(_res_conv_21));
18049                 _res_constr.data[v] = _res_conv_21_conv;
18050         }
18051         FREE(_res);
18052         CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
18053 }
18054
18055 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
18056         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
18057         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
18058         return tag_ptr(ret_conv, true);
18059 }
18060 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(uint64_t arg) {
18061         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(arg);
18062         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
18063         return ret_conv;
18064 }
18065
18066 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint64_t orig) {
18067         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(orig);
18068         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
18069         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
18070         return tag_ptr(ret_conv, true);
18071 }
18072
18073 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint64_tArray b) {
18074         LDKThirtyTwoBytes a_ref;
18075         CHECK(a->arr_len == 32);
18076         memcpy(a_ref.data, a->elems, 32); FREE(a);
18077         LDKCVec_C2Tuple_u32ScriptZZ b_constr;
18078         b_constr.datalen = b->arr_len;
18079         if (b_constr.datalen > 0)
18080                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
18081         else
18082                 b_constr.data = NULL;
18083         uint64_t* b_vals = b->elems;
18084         for (size_t v = 0; v < b_constr.datalen; v++) {
18085                 uint64_t b_conv_21 = b_vals[v];
18086                 void* b_conv_21_ptr = untag_ptr(b_conv_21);
18087                 CHECK_ACCESS(b_conv_21_ptr);
18088                 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
18089                 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)untag_ptr(b_conv_21));
18090                 b_constr.data[v] = b_conv_21_conv;
18091         }
18092         FREE(b);
18093         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
18094         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
18095         return tag_ptr(ret_conv, true);
18096 }
18097
18098 void  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint64_t _res) {
18099         if (!ptr_is_owned(_res)) return;
18100         void* _res_ptr = untag_ptr(_res);
18101         CHECK_ACCESS(_res_ptr);
18102         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
18103         FREE(untag_ptr(_res));
18104         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
18105 }
18106
18107 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint64_tArray _res) {
18108         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
18109         _res_constr.datalen = _res->arr_len;
18110         if (_res_constr.datalen > 0)
18111                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
18112         else
18113                 _res_constr.data = NULL;
18114         uint64_t* _res_vals = _res->elems;
18115         for (size_t o = 0; o < _res_constr.datalen; o++) {
18116                 uint64_t _res_conv_40 = _res_vals[o];
18117                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
18118                 CHECK_ACCESS(_res_conv_40_ptr);
18119                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
18120                 FREE(untag_ptr(_res_conv_40));
18121                 _res_constr.data[o] = _res_conv_40_conv;
18122         }
18123         FREE(_res);
18124         CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
18125 }
18126
18127 void  __attribute__((export_name("TS_CVec_EventZ_free"))) TS_CVec_EventZ_free(uint64_tArray _res) {
18128         LDKCVec_EventZ _res_constr;
18129         _res_constr.datalen = _res->arr_len;
18130         if (_res_constr.datalen > 0)
18131                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
18132         else
18133                 _res_constr.data = NULL;
18134         uint64_t* _res_vals = _res->elems;
18135         for (size_t h = 0; h < _res_constr.datalen; h++) {
18136                 uint64_t _res_conv_7 = _res_vals[h];
18137                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
18138                 CHECK_ACCESS(_res_conv_7_ptr);
18139                 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
18140                 FREE(untag_ptr(_res_conv_7));
18141                 _res_constr.data[h] = _res_conv_7_conv;
18142         }
18143         FREE(_res);
18144         CVec_EventZ_free(_res_constr);
18145 }
18146
18147 void  __attribute__((export_name("TS_CVec_TransactionZ_free"))) TS_CVec_TransactionZ_free(ptrArray _res) {
18148         LDKCVec_TransactionZ _res_constr;
18149         _res_constr.datalen = _res->arr_len;
18150         if (_res_constr.datalen > 0)
18151                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
18152         else
18153                 _res_constr.data = NULL;
18154         int8_tArray* _res_vals = (void*) _res->elems;
18155         for (size_t m = 0; m < _res_constr.datalen; m++) {
18156                 int8_tArray _res_conv_12 = _res_vals[m];
18157                 LDKTransaction _res_conv_12_ref;
18158                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
18159                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
18160                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
18161                 _res_conv_12_ref.data_is_owned = true;
18162                 _res_constr.data[m] = _res_conv_12_ref;
18163         }
18164         FREE(_res);
18165         CVec_TransactionZ_free(_res_constr);
18166 }
18167
18168 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
18169         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18170         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
18171         return tag_ptr(ret_conv, true);
18172 }
18173 int64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone_ptr"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint64_t arg) {
18174         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
18175         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
18176         return ret_conv;
18177 }
18178
18179 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone"))) TS_C2Tuple_u32TxOutZ_clone(uint64_t orig) {
18180         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
18181         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18182         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
18183         return tag_ptr(ret_conv, true);
18184 }
18185
18186 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_new"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint64_t b) {
18187         void* b_ptr = untag_ptr(b);
18188         CHECK_ACCESS(b_ptr);
18189         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
18190         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
18191         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18192         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
18193         return tag_ptr(ret_conv, true);
18194 }
18195
18196 void  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_free"))) TS_C2Tuple_u32TxOutZ_free(uint64_t _res) {
18197         if (!ptr_is_owned(_res)) return;
18198         void* _res_ptr = untag_ptr(_res);
18199         CHECK_ACCESS(_res_ptr);
18200         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
18201         FREE(untag_ptr(_res));
18202         C2Tuple_u32TxOutZ_free(_res_conv);
18203 }
18204
18205 void  __attribute__((export_name("TS_CVec_C2Tuple_u32TxOutZZ_free"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint64_tArray _res) {
18206         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
18207         _res_constr.datalen = _res->arr_len;
18208         if (_res_constr.datalen > 0)
18209                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
18210         else
18211                 _res_constr.data = NULL;
18212         uint64_t* _res_vals = _res->elems;
18213         for (size_t u = 0; u < _res_constr.datalen; u++) {
18214                 uint64_t _res_conv_20 = _res_vals[u];
18215                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
18216                 CHECK_ACCESS(_res_conv_20_ptr);
18217                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
18218                 FREE(untag_ptr(_res_conv_20));
18219                 _res_constr.data[u] = _res_conv_20_conv;
18220         }
18221         FREE(_res);
18222         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
18223 }
18224
18225 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
18226         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18227         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
18228         return tag_ptr(ret_conv, true);
18229 }
18230 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint64_t arg) {
18231         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
18232         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
18233         return ret_conv;
18234 }
18235
18236 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint64_t orig) {
18237         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
18238         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18239         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
18240         return tag_ptr(ret_conv, true);
18241 }
18242
18243 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint64_tArray b) {
18244         LDKThirtyTwoBytes a_ref;
18245         CHECK(a->arr_len == 32);
18246         memcpy(a_ref.data, a->elems, 32); FREE(a);
18247         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
18248         b_constr.datalen = b->arr_len;
18249         if (b_constr.datalen > 0)
18250                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
18251         else
18252                 b_constr.data = NULL;
18253         uint64_t* b_vals = b->elems;
18254         for (size_t u = 0; u < b_constr.datalen; u++) {
18255                 uint64_t b_conv_20 = b_vals[u];
18256                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
18257                 CHECK_ACCESS(b_conv_20_ptr);
18258                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
18259                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
18260                 b_constr.data[u] = b_conv_20_conv;
18261         }
18262         FREE(b);
18263         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18264         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
18265         return tag_ptr(ret_conv, true);
18266 }
18267
18268 void  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint64_t _res) {
18269         if (!ptr_is_owned(_res)) return;
18270         void* _res_ptr = untag_ptr(_res);
18271         CHECK_ACCESS(_res_ptr);
18272         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
18273         FREE(untag_ptr(_res));
18274         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
18275 }
18276
18277 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint64_tArray _res) {
18278         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
18279         _res_constr.datalen = _res->arr_len;
18280         if (_res_constr.datalen > 0)
18281                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
18282         else
18283                 _res_constr.data = NULL;
18284         uint64_t* _res_vals = _res->elems;
18285         for (size_t n = 0; n < _res_constr.datalen; n++) {
18286                 uint64_t _res_conv_39 = _res_vals[n];
18287                 void* _res_conv_39_ptr = untag_ptr(_res_conv_39);
18288                 CHECK_ACCESS(_res_conv_39_ptr);
18289                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
18290                 FREE(untag_ptr(_res_conv_39));
18291                 _res_constr.data[n] = _res_conv_39_conv;
18292         }
18293         FREE(_res);
18294         CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
18295 }
18296
18297 void  __attribute__((export_name("TS_CVec_BalanceZ_free"))) TS_CVec_BalanceZ_free(uint64_tArray _res) {
18298         LDKCVec_BalanceZ _res_constr;
18299         _res_constr.datalen = _res->arr_len;
18300         if (_res_constr.datalen > 0)
18301                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
18302         else
18303                 _res_constr.data = NULL;
18304         uint64_t* _res_vals = _res->elems;
18305         for (size_t j = 0; j < _res_constr.datalen; j++) {
18306                 uint64_t _res_conv_9 = _res_vals[j];
18307                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
18308                 CHECK_ACCESS(_res_conv_9_ptr);
18309                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
18310                 FREE(untag_ptr(_res_conv_9));
18311                 _res_constr.data[j] = _res_conv_9_conv;
18312         }
18313         FREE(_res);
18314         CVec_BalanceZ_free(_res_constr);
18315 }
18316
18317 static inline uint64_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
18318         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18319         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
18320         return tag_ptr(ret_conv, true);
18321 }
18322 int64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr(uint64_t arg) {
18323         LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(arg);
18324         int64_t ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
18325         return ret_conv;
18326 }
18327
18328 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint64_t orig) {
18329         LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(orig);
18330         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18331         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
18332         return tag_ptr(ret_conv, true);
18333 }
18334
18335 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_new"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint64_t b) {
18336         LDKThirtyTwoBytes a_ref;
18337         CHECK(a->arr_len == 32);
18338         memcpy(a_ref.data, a->elems, 32); FREE(a);
18339         LDKChannelMonitor b_conv;
18340         b_conv.inner = untag_ptr(b);
18341         b_conv.is_owned = ptr_is_owned(b);
18342         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
18343         b_conv = ChannelMonitor_clone(&b_conv);
18344         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18345         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
18346         return tag_ptr(ret_conv, true);
18347 }
18348
18349 void  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_free"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint64_t _res) {
18350         if (!ptr_is_owned(_res)) return;
18351         void* _res_ptr = untag_ptr(_res);
18352         CHECK_ACCESS(_res_ptr);
18353         LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
18354         FREE(untag_ptr(_res));
18355         C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
18356 }
18357
18358 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint64_t o) {
18359         void* o_ptr = untag_ptr(o);
18360         CHECK_ACCESS(o_ptr);
18361         LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
18362         o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(o));
18363         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18364         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
18365         return tag_ptr(ret_conv, true);
18366 }
18367
18368 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint64_t e) {
18369         void* e_ptr = untag_ptr(e);
18370         CHECK_ACCESS(e_ptr);
18371         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18372         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18373         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18374         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
18375         return tag_ptr(ret_conv, true);
18376 }
18377
18378 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(uint64_t o) {
18379         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(o);
18380         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
18381         return ret_conv;
18382 }
18383
18384 void  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint64_t _res) {
18385         if (!ptr_is_owned(_res)) return;
18386         void* _res_ptr = untag_ptr(_res);
18387         CHECK_ACCESS(_res_ptr);
18388         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
18389         FREE(untag_ptr(_res));
18390         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
18391 }
18392
18393 static inline uint64_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
18394         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18395         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
18396         return tag_ptr(ret_conv, true);
18397 }
18398 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(uint64_t arg) {
18399         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
18400         int64_t ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
18401         return ret_conv;
18402 }
18403
18404 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint64_t orig) {
18405         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
18406         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18407         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
18408         return tag_ptr(ret_conv, true);
18409 }
18410
18411 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
18412         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
18413         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
18414         return tag_ptr(ret_conv, true);
18415 }
18416 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone_ptr"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint64_t arg) {
18417         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
18418         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
18419         return ret_conv;
18420 }
18421
18422 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint64_t orig) {
18423         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
18424         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
18425         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
18426         return tag_ptr(ret_conv, true);
18427 }
18428
18429 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_new"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint64_t b) {
18430         LDKPublicKey a_ref;
18431         CHECK(a->arr_len == 33);
18432         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
18433         void* b_ptr = untag_ptr(b);
18434         CHECK_ACCESS(b_ptr);
18435         LDKType b_conv = *(LDKType*)(b_ptr);
18436         if (b_conv.free == LDKType_JCalls_free) {
18437                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18438                 LDKType_JCalls_cloned(&b_conv);
18439         }
18440         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
18441         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
18442         return tag_ptr(ret_conv, true);
18443 }
18444
18445 void  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_free"))) TS_C2Tuple_PublicKeyTypeZ_free(uint64_t _res) {
18446         if (!ptr_is_owned(_res)) return;
18447         void* _res_ptr = untag_ptr(_res);
18448         CHECK_ACCESS(_res_ptr);
18449         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
18450         FREE(untag_ptr(_res));
18451         C2Tuple_PublicKeyTypeZ_free(_res_conv);
18452 }
18453
18454 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyTypeZZ_free"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint64_tArray _res) {
18455         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
18456         _res_constr.datalen = _res->arr_len;
18457         if (_res_constr.datalen > 0)
18458                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
18459         else
18460                 _res_constr.data = NULL;
18461         uint64_t* _res_vals = _res->elems;
18462         for (size_t z = 0; z < _res_constr.datalen; z++) {
18463                 uint64_t _res_conv_25 = _res_vals[z];
18464                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
18465                 CHECK_ACCESS(_res_conv_25_ptr);
18466                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
18467                 FREE(untag_ptr(_res_conv_25));
18468                 _res_constr.data[z] = _res_conv_25_conv;
18469         }
18470         FREE(_res);
18471         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
18472 }
18473
18474 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_some"))) TS_COption_CustomOnionMessageContentsZ_some(uint64_t o) {
18475         void* o_ptr = untag_ptr(o);
18476         CHECK_ACCESS(o_ptr);
18477         LDKCustomOnionMessageContents o_conv = *(LDKCustomOnionMessageContents*)(o_ptr);
18478         if (o_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
18479                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18480                 LDKCustomOnionMessageContents_JCalls_cloned(&o_conv);
18481         }
18482         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
18483         *ret_copy = COption_CustomOnionMessageContentsZ_some(o_conv);
18484         uint64_t ret_ref = tag_ptr(ret_copy, true);
18485         return ret_ref;
18486 }
18487
18488 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_none"))) TS_COption_CustomOnionMessageContentsZ_none() {
18489         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
18490         *ret_copy = COption_CustomOnionMessageContentsZ_none();
18491         uint64_t ret_ref = tag_ptr(ret_copy, true);
18492         return ret_ref;
18493 }
18494
18495 void  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_free"))) TS_COption_CustomOnionMessageContentsZ_free(uint64_t _res) {
18496         if (!ptr_is_owned(_res)) return;
18497         void* _res_ptr = untag_ptr(_res);
18498         CHECK_ACCESS(_res_ptr);
18499         LDKCOption_CustomOnionMessageContentsZ _res_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(_res_ptr);
18500         FREE(untag_ptr(_res));
18501         COption_CustomOnionMessageContentsZ_free(_res_conv);
18502 }
18503
18504 static inline uint64_t COption_CustomOnionMessageContentsZ_clone_ptr(LDKCOption_CustomOnionMessageContentsZ *NONNULL_PTR arg) {
18505         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
18506         *ret_copy = COption_CustomOnionMessageContentsZ_clone(arg);
18507         uint64_t ret_ref = tag_ptr(ret_copy, true);
18508         return ret_ref;
18509 }
18510 int64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_clone_ptr"))) TS_COption_CustomOnionMessageContentsZ_clone_ptr(uint64_t arg) {
18511         LDKCOption_CustomOnionMessageContentsZ* arg_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(arg);
18512         int64_t ret_conv = COption_CustomOnionMessageContentsZ_clone_ptr(arg_conv);
18513         return ret_conv;
18514 }
18515
18516 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_clone"))) TS_COption_CustomOnionMessageContentsZ_clone(uint64_t orig) {
18517         LDKCOption_CustomOnionMessageContentsZ* orig_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(orig);
18518         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
18519         *ret_copy = COption_CustomOnionMessageContentsZ_clone(orig_conv);
18520         uint64_t ret_ref = tag_ptr(ret_copy, true);
18521         return ret_ref;
18522 }
18523
18524 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(uint64_t o) {
18525         void* o_ptr = untag_ptr(o);
18526         CHECK_ACCESS(o_ptr);
18527         LDKCOption_CustomOnionMessageContentsZ o_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(o_ptr);
18528         o_conv = COption_CustomOnionMessageContentsZ_clone((LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(o));
18529         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
18530         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o_conv);
18531         return tag_ptr(ret_conv, true);
18532 }
18533
18534 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(uint64_t e) {
18535         void* e_ptr = untag_ptr(e);
18536         CHECK_ACCESS(e_ptr);
18537         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18538         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18539         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
18540         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e_conv);
18541         return tag_ptr(ret_conv, true);
18542 }
18543
18544 jboolean  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(uint64_t o) {
18545         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
18546         jboolean ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
18547         return ret_conv;
18548 }
18549
18550 void  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(uint64_t _res) {
18551         if (!ptr_is_owned(_res)) return;
18552         void* _res_ptr = untag_ptr(_res);
18553         CHECK_ACCESS(_res_ptr);
18554         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(_res_ptr);
18555         FREE(untag_ptr(_res));
18556         CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res_conv);
18557 }
18558
18559 static inline uint64_t CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
18560         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
18561         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(arg);
18562         return tag_ptr(ret_conv, true);
18563 }
18564 int64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(uint64_t arg) {
18565         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
18566         int64_t ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
18567         return ret_conv;
18568 }
18569
18570 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(uint64_t orig) {
18571         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
18572         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
18573         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(orig_conv);
18574         return tag_ptr(ret_conv, true);
18575 }
18576
18577 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_some"))) TS_COption_NetAddressZ_some(uint64_t o) {
18578         void* o_ptr = untag_ptr(o);
18579         CHECK_ACCESS(o_ptr);
18580         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
18581         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
18582         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18583         *ret_copy = COption_NetAddressZ_some(o_conv);
18584         uint64_t ret_ref = tag_ptr(ret_copy, true);
18585         return ret_ref;
18586 }
18587
18588 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_none"))) TS_COption_NetAddressZ_none() {
18589         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18590         *ret_copy = COption_NetAddressZ_none();
18591         uint64_t ret_ref = tag_ptr(ret_copy, true);
18592         return ret_ref;
18593 }
18594
18595 void  __attribute__((export_name("TS_COption_NetAddressZ_free"))) TS_COption_NetAddressZ_free(uint64_t _res) {
18596         if (!ptr_is_owned(_res)) return;
18597         void* _res_ptr = untag_ptr(_res);
18598         CHECK_ACCESS(_res_ptr);
18599         LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr);
18600         FREE(untag_ptr(_res));
18601         COption_NetAddressZ_free(_res_conv);
18602 }
18603
18604 static inline uint64_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) {
18605         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18606         *ret_copy = COption_NetAddressZ_clone(arg);
18607         uint64_t ret_ref = tag_ptr(ret_copy, true);
18608         return ret_ref;
18609 }
18610 int64_t  __attribute__((export_name("TS_COption_NetAddressZ_clone_ptr"))) TS_COption_NetAddressZ_clone_ptr(uint64_t arg) {
18611         LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)untag_ptr(arg);
18612         int64_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv);
18613         return ret_conv;
18614 }
18615
18616 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_clone"))) TS_COption_NetAddressZ_clone(uint64_t orig) {
18617         LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)untag_ptr(orig);
18618         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18619         *ret_copy = COption_NetAddressZ_clone(orig_conv);
18620         uint64_t ret_ref = tag_ptr(ret_copy, true);
18621         return ret_ref;
18622 }
18623
18624 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
18625         LDKCVec_u8Z o_ref;
18626         o_ref.datalen = o->arr_len;
18627         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
18628         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
18629         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18630         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
18631         return tag_ptr(ret_conv, true);
18632 }
18633
18634 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint64_t e) {
18635         LDKPeerHandleError e_conv;
18636         e_conv.inner = untag_ptr(e);
18637         e_conv.is_owned = ptr_is_owned(e);
18638         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18639         e_conv = PeerHandleError_clone(&e_conv);
18640         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18641         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
18642         return tag_ptr(ret_conv, true);
18643 }
18644
18645 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint64_t o) {
18646         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
18647         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
18648         return ret_conv;
18649 }
18650
18651 void  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint64_t _res) {
18652         if (!ptr_is_owned(_res)) return;
18653         void* _res_ptr = untag_ptr(_res);
18654         CHECK_ACCESS(_res_ptr);
18655         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
18656         FREE(untag_ptr(_res));
18657         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
18658 }
18659
18660 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
18661         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18662         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
18663         return tag_ptr(ret_conv, true);
18664 }
18665 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint64_t arg) {
18666         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
18667         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
18668         return ret_conv;
18669 }
18670
18671 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint64_t orig) {
18672         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
18673         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18674         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
18675         return tag_ptr(ret_conv, true);
18676 }
18677
18678 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() {
18679         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18680         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
18681         return tag_ptr(ret_conv, true);
18682 }
18683
18684 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint64_t e) {
18685         LDKPeerHandleError e_conv;
18686         e_conv.inner = untag_ptr(e);
18687         e_conv.is_owned = ptr_is_owned(e);
18688         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18689         e_conv = PeerHandleError_clone(&e_conv);
18690         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18691         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
18692         return tag_ptr(ret_conv, true);
18693 }
18694
18695 jboolean  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint64_t o) {
18696         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
18697         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
18698         return ret_conv;
18699 }
18700
18701 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint64_t _res) {
18702         if (!ptr_is_owned(_res)) return;
18703         void* _res_ptr = untag_ptr(_res);
18704         CHECK_ACCESS(_res_ptr);
18705         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
18706         FREE(untag_ptr(_res));
18707         CResult_NonePeerHandleErrorZ_free(_res_conv);
18708 }
18709
18710 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
18711         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18712         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
18713         return tag_ptr(ret_conv, true);
18714 }
18715 int64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint64_t arg) {
18716         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
18717         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
18718         return ret_conv;
18719 }
18720
18721 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint64_t orig) {
18722         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
18723         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18724         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
18725         return tag_ptr(ret_conv, true);
18726 }
18727
18728 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
18729         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18730         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
18731         return tag_ptr(ret_conv, true);
18732 }
18733
18734 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint64_t e) {
18735         LDKPeerHandleError e_conv;
18736         e_conv.inner = untag_ptr(e);
18737         e_conv.is_owned = ptr_is_owned(e);
18738         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18739         e_conv = PeerHandleError_clone(&e_conv);
18740         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18741         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
18742         return tag_ptr(ret_conv, true);
18743 }
18744
18745 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint64_t o) {
18746         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
18747         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
18748         return ret_conv;
18749 }
18750
18751 void  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint64_t _res) {
18752         if (!ptr_is_owned(_res)) return;
18753         void* _res_ptr = untag_ptr(_res);
18754         CHECK_ACCESS(_res_ptr);
18755         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
18756         FREE(untag_ptr(_res));
18757         CResult_boolPeerHandleErrorZ_free(_res_conv);
18758 }
18759
18760 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
18761         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18762         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
18763         return tag_ptr(ret_conv, true);
18764 }
18765 int64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint64_t arg) {
18766         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
18767         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
18768         return ret_conv;
18769 }
18770
18771 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint64_t orig) {
18772         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
18773         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18774         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
18775         return tag_ptr(ret_conv, true);
18776 }
18777
18778 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_ok"))) TS_CResult_NoneSendErrorZ_ok() {
18779         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
18780         *ret_conv = CResult_NoneSendErrorZ_ok();
18781         return tag_ptr(ret_conv, true);
18782 }
18783
18784 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_err"))) TS_CResult_NoneSendErrorZ_err(uint64_t e) {
18785         void* e_ptr = untag_ptr(e);
18786         CHECK_ACCESS(e_ptr);
18787         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
18788         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
18789         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
18790         *ret_conv = CResult_NoneSendErrorZ_err(e_conv);
18791         return tag_ptr(ret_conv, true);
18792 }
18793
18794 jboolean  __attribute__((export_name("TS_CResult_NoneSendErrorZ_is_ok"))) TS_CResult_NoneSendErrorZ_is_ok(uint64_t o) {
18795         LDKCResult_NoneSendErrorZ* o_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(o);
18796         jboolean ret_conv = CResult_NoneSendErrorZ_is_ok(o_conv);
18797         return ret_conv;
18798 }
18799
18800 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_free"))) TS_CResult_NoneSendErrorZ_free(uint64_t _res) {
18801         if (!ptr_is_owned(_res)) return;
18802         void* _res_ptr = untag_ptr(_res);
18803         CHECK_ACCESS(_res_ptr);
18804         LDKCResult_NoneSendErrorZ _res_conv = *(LDKCResult_NoneSendErrorZ*)(_res_ptr);
18805         FREE(untag_ptr(_res));
18806         CResult_NoneSendErrorZ_free(_res_conv);
18807 }
18808
18809 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_ok"))) TS_CResult_u32GraphSyncErrorZ_ok(int32_t o) {
18810         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
18811         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
18812         return tag_ptr(ret_conv, true);
18813 }
18814
18815 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_err"))) TS_CResult_u32GraphSyncErrorZ_err(uint64_t e) {
18816         void* e_ptr = untag_ptr(e);
18817         CHECK_ACCESS(e_ptr);
18818         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
18819         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
18820         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
18821         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
18822         return tag_ptr(ret_conv, true);
18823 }
18824
18825 jboolean  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_is_ok"))) TS_CResult_u32GraphSyncErrorZ_is_ok(uint64_t o) {
18826         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
18827         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
18828         return ret_conv;
18829 }
18830
18831 void  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_free"))) TS_CResult_u32GraphSyncErrorZ_free(uint64_t _res) {
18832         if (!ptr_is_owned(_res)) return;
18833         void* _res_ptr = untag_ptr(_res);
18834         CHECK_ACCESS(_res_ptr);
18835         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
18836         FREE(untag_ptr(_res));
18837         CResult_u32GraphSyncErrorZ_free(_res_conv);
18838 }
18839
18840 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_ok"))) TS_CResult_SiPrefixParseErrorZ_ok(uint32_t o) {
18841         LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
18842         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
18843         *ret_conv = CResult_SiPrefixParseErrorZ_ok(o_conv);
18844         return tag_ptr(ret_conv, true);
18845 }
18846
18847 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_err"))) TS_CResult_SiPrefixParseErrorZ_err(uint64_t e) {
18848         void* e_ptr = untag_ptr(e);
18849         CHECK_ACCESS(e_ptr);
18850         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
18851         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
18852         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
18853         *ret_conv = CResult_SiPrefixParseErrorZ_err(e_conv);
18854         return tag_ptr(ret_conv, true);
18855 }
18856
18857 jboolean  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_is_ok"))) TS_CResult_SiPrefixParseErrorZ_is_ok(uint64_t o) {
18858         LDKCResult_SiPrefixParseErrorZ* o_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(o);
18859         jboolean ret_conv = CResult_SiPrefixParseErrorZ_is_ok(o_conv);
18860         return ret_conv;
18861 }
18862
18863 void  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_free"))) TS_CResult_SiPrefixParseErrorZ_free(uint64_t _res) {
18864         if (!ptr_is_owned(_res)) return;
18865         void* _res_ptr = untag_ptr(_res);
18866         CHECK_ACCESS(_res_ptr);
18867         LDKCResult_SiPrefixParseErrorZ _res_conv = *(LDKCResult_SiPrefixParseErrorZ*)(_res_ptr);
18868         FREE(untag_ptr(_res));
18869         CResult_SiPrefixParseErrorZ_free(_res_conv);
18870 }
18871
18872 static inline uint64_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg) {
18873         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
18874         *ret_conv = CResult_SiPrefixParseErrorZ_clone(arg);
18875         return tag_ptr(ret_conv, true);
18876 }
18877 int64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone_ptr"))) TS_CResult_SiPrefixParseErrorZ_clone_ptr(uint64_t arg) {
18878         LDKCResult_SiPrefixParseErrorZ* arg_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(arg);
18879         int64_t ret_conv = CResult_SiPrefixParseErrorZ_clone_ptr(arg_conv);
18880         return ret_conv;
18881 }
18882
18883 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone"))) TS_CResult_SiPrefixParseErrorZ_clone(uint64_t orig) {
18884         LDKCResult_SiPrefixParseErrorZ* orig_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(orig);
18885         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
18886         *ret_conv = CResult_SiPrefixParseErrorZ_clone(orig_conv);
18887         return tag_ptr(ret_conv, true);
18888 }
18889
18890 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_ok(uint64_t o) {
18891         LDKInvoice o_conv;
18892         o_conv.inner = untag_ptr(o);
18893         o_conv.is_owned = ptr_is_owned(o);
18894         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18895         o_conv = Invoice_clone(&o_conv);
18896         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
18897         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_ok(o_conv);
18898         return tag_ptr(ret_conv, true);
18899 }
18900
18901 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_err(uint64_t e) {
18902         void* e_ptr = untag_ptr(e);
18903         CHECK_ACCESS(e_ptr);
18904         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
18905         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
18906         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
18907         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_err(e_conv);
18908         return tag_ptr(ret_conv, true);
18909 }
18910
18911 jboolean  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok(uint64_t o) {
18912         LDKCResult_InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
18913         jboolean ret_conv = CResult_InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
18914         return ret_conv;
18915 }
18916
18917 void  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_free"))) TS_CResult_InvoiceParseOrSemanticErrorZ_free(uint64_t _res) {
18918         if (!ptr_is_owned(_res)) return;
18919         void* _res_ptr = untag_ptr(_res);
18920         CHECK_ACCESS(_res_ptr);
18921         LDKCResult_InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_InvoiceParseOrSemanticErrorZ*)(_res_ptr);
18922         FREE(untag_ptr(_res));
18923         CResult_InvoiceParseOrSemanticErrorZ_free(_res_conv);
18924 }
18925
18926 static inline uint64_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
18927         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
18928         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(arg);
18929         return tag_ptr(ret_conv, true);
18930 }
18931 int64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(uint64_t arg) {
18932         LDKCResult_InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
18933         int64_t ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
18934         return ret_conv;
18935 }
18936
18937 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone(uint64_t orig) {
18938         LDKCResult_InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
18939         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
18940         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(orig_conv);
18941         return tag_ptr(ret_conv, true);
18942 }
18943
18944 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_ok(uint64_t o) {
18945         LDKSignedRawInvoice o_conv;
18946         o_conv.inner = untag_ptr(o);
18947         o_conv.is_owned = ptr_is_owned(o);
18948         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18949         o_conv = SignedRawInvoice_clone(&o_conv);
18950         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
18951         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_ok(o_conv);
18952         return tag_ptr(ret_conv, true);
18953 }
18954
18955 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_err(uint64_t e) {
18956         void* e_ptr = untag_ptr(e);
18957         CHECK_ACCESS(e_ptr);
18958         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
18959         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
18960         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
18961         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_err(e_conv);
18962         return tag_ptr(ret_conv, true);
18963 }
18964
18965 jboolean  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_is_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_is_ok(uint64_t o) {
18966         LDKCResult_SignedRawInvoiceParseErrorZ* o_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(o);
18967         jboolean ret_conv = CResult_SignedRawInvoiceParseErrorZ_is_ok(o_conv);
18968         return ret_conv;
18969 }
18970
18971 void  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_free"))) TS_CResult_SignedRawInvoiceParseErrorZ_free(uint64_t _res) {
18972         if (!ptr_is_owned(_res)) return;
18973         void* _res_ptr = untag_ptr(_res);
18974         CHECK_ACCESS(_res_ptr);
18975         LDKCResult_SignedRawInvoiceParseErrorZ _res_conv = *(LDKCResult_SignedRawInvoiceParseErrorZ*)(_res_ptr);
18976         FREE(untag_ptr(_res));
18977         CResult_SignedRawInvoiceParseErrorZ_free(_res_conv);
18978 }
18979
18980 static inline uint64_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg) {
18981         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
18982         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(arg);
18983         return tag_ptr(ret_conv, true);
18984 }
18985 int64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr(uint64_t arg) {
18986         LDKCResult_SignedRawInvoiceParseErrorZ* arg_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(arg);
18987         int64_t ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone_ptr(arg_conv);
18988         return ret_conv;
18989 }
18990
18991 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone(uint64_t orig) {
18992         LDKCResult_SignedRawInvoiceParseErrorZ* orig_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(orig);
18993         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
18994         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(orig_conv);
18995         return tag_ptr(ret_conv, true);
18996 }
18997
18998 static inline uint64_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
18999         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
19000         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
19001         return tag_ptr(ret_conv, true);
19002 }
19003 int64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(uint64_t arg) {
19004         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(arg);
19005         int64_t ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
19006         return ret_conv;
19007 }
19008
19009 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint64_t orig) {
19010         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(orig);
19011         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
19012         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
19013         return tag_ptr(ret_conv, true);
19014 }
19015
19016 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint64_t a, int8_tArray b, uint64_t c) {
19017         LDKRawInvoice a_conv;
19018         a_conv.inner = untag_ptr(a);
19019         a_conv.is_owned = ptr_is_owned(a);
19020         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19021         a_conv = RawInvoice_clone(&a_conv);
19022         LDKThirtyTwoBytes b_ref;
19023         CHECK(b->arr_len == 32);
19024         memcpy(b_ref.data, b->elems, 32); FREE(b);
19025         LDKInvoiceSignature c_conv;
19026         c_conv.inner = untag_ptr(c);
19027         c_conv.is_owned = ptr_is_owned(c);
19028         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
19029         c_conv = InvoiceSignature_clone(&c_conv);
19030         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
19031         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
19032         return tag_ptr(ret_conv, true);
19033 }
19034
19035 void  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint64_t _res) {
19036         if (!ptr_is_owned(_res)) return;
19037         void* _res_ptr = untag_ptr(_res);
19038         CHECK_ACCESS(_res_ptr);
19039         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
19040         FREE(untag_ptr(_res));
19041         C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
19042 }
19043
19044 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_ok"))) TS_CResult_PayeePubKeyErrorZ_ok(uint64_t o) {
19045         LDKPayeePubKey o_conv;
19046         o_conv.inner = untag_ptr(o);
19047         o_conv.is_owned = ptr_is_owned(o);
19048         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19049         o_conv = PayeePubKey_clone(&o_conv);
19050         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
19051         *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
19052         return tag_ptr(ret_conv, true);
19053 }
19054
19055 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_err"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
19056         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
19057         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
19058         *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
19059         return tag_ptr(ret_conv, true);
19060 }
19061
19062 jboolean  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_is_ok"))) TS_CResult_PayeePubKeyErrorZ_is_ok(uint64_t o) {
19063         LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(o);
19064         jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
19065         return ret_conv;
19066 }
19067
19068 void  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_free"))) TS_CResult_PayeePubKeyErrorZ_free(uint64_t _res) {
19069         if (!ptr_is_owned(_res)) return;
19070         void* _res_ptr = untag_ptr(_res);
19071         CHECK_ACCESS(_res_ptr);
19072         LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
19073         FREE(untag_ptr(_res));
19074         CResult_PayeePubKeyErrorZ_free(_res_conv);
19075 }
19076
19077 static inline uint64_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
19078         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
19079         *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
19080         return tag_ptr(ret_conv, true);
19081 }
19082 int64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone_ptr"))) TS_CResult_PayeePubKeyErrorZ_clone_ptr(uint64_t arg) {
19083         LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(arg);
19084         int64_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
19085         return ret_conv;
19086 }
19087
19088 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone"))) TS_CResult_PayeePubKeyErrorZ_clone(uint64_t orig) {
19089         LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(orig);
19090         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
19091         *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
19092         return tag_ptr(ret_conv, true);
19093 }
19094
19095 void  __attribute__((export_name("TS_CVec_PrivateRouteZ_free"))) TS_CVec_PrivateRouteZ_free(uint64_tArray _res) {
19096         LDKCVec_PrivateRouteZ _res_constr;
19097         _res_constr.datalen = _res->arr_len;
19098         if (_res_constr.datalen > 0)
19099                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
19100         else
19101                 _res_constr.data = NULL;
19102         uint64_t* _res_vals = _res->elems;
19103         for (size_t o = 0; o < _res_constr.datalen; o++) {
19104                 uint64_t _res_conv_14 = _res_vals[o];
19105                 LDKPrivateRoute _res_conv_14_conv;
19106                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
19107                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
19108                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
19109                 _res_constr.data[o] = _res_conv_14_conv;
19110         }
19111         FREE(_res);
19112         CVec_PrivateRouteZ_free(_res_constr);
19113 }
19114
19115 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint64_t o) {
19116         LDKPositiveTimestamp o_conv;
19117         o_conv.inner = untag_ptr(o);
19118         o_conv.is_owned = ptr_is_owned(o);
19119         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19120         o_conv = PositiveTimestamp_clone(&o_conv);
19121         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19122         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
19123         return tag_ptr(ret_conv, true);
19124 }
19125
19126 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_err"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
19127         LDKCreationError e_conv = LDKCreationError_from_js(e);
19128         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19129         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
19130         return tag_ptr(ret_conv, true);
19131 }
19132
19133 jboolean  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_is_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint64_t o) {
19134         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
19135         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
19136         return ret_conv;
19137 }
19138
19139 void  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_free"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint64_t _res) {
19140         if (!ptr_is_owned(_res)) return;
19141         void* _res_ptr = untag_ptr(_res);
19142         CHECK_ACCESS(_res_ptr);
19143         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
19144         FREE(untag_ptr(_res));
19145         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
19146 }
19147
19148 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
19149         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19150         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
19151         return tag_ptr(ret_conv, true);
19152 }
19153 int64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint64_t arg) {
19154         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
19155         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
19156         return ret_conv;
19157 }
19158
19159 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint64_t orig) {
19160         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
19161         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
19162         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
19163         return tag_ptr(ret_conv, true);
19164 }
19165
19166 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_ok"))) TS_CResult_NoneSemanticErrorZ_ok() {
19167         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19168         *ret_conv = CResult_NoneSemanticErrorZ_ok();
19169         return tag_ptr(ret_conv, true);
19170 }
19171
19172 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_err"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) {
19173         LDKSemanticError e_conv = LDKSemanticError_from_js(e);
19174         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19175         *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
19176         return tag_ptr(ret_conv, true);
19177 }
19178
19179 jboolean  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_is_ok"))) TS_CResult_NoneSemanticErrorZ_is_ok(uint64_t o) {
19180         LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(o);
19181         jboolean ret_conv = CResult_NoneSemanticErrorZ_is_ok(o_conv);
19182         return ret_conv;
19183 }
19184
19185 void  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_free"))) TS_CResult_NoneSemanticErrorZ_free(uint64_t _res) {
19186         if (!ptr_is_owned(_res)) return;
19187         void* _res_ptr = untag_ptr(_res);
19188         CHECK_ACCESS(_res_ptr);
19189         LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
19190         FREE(untag_ptr(_res));
19191         CResult_NoneSemanticErrorZ_free(_res_conv);
19192 }
19193
19194 static inline uint64_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
19195         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19196         *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
19197         return tag_ptr(ret_conv, true);
19198 }
19199 int64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone_ptr"))) TS_CResult_NoneSemanticErrorZ_clone_ptr(uint64_t arg) {
19200         LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(arg);
19201         int64_t ret_conv = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
19202         return ret_conv;
19203 }
19204
19205 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone"))) TS_CResult_NoneSemanticErrorZ_clone(uint64_t orig) {
19206         LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(orig);
19207         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
19208         *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
19209         return tag_ptr(ret_conv, true);
19210 }
19211
19212 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_ok"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint64_t o) {
19213         LDKInvoice o_conv;
19214         o_conv.inner = untag_ptr(o);
19215         o_conv.is_owned = ptr_is_owned(o);
19216         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19217         o_conv = Invoice_clone(&o_conv);
19218         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
19219         *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
19220         return tag_ptr(ret_conv, true);
19221 }
19222
19223 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_err"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) {
19224         LDKSemanticError e_conv = LDKSemanticError_from_js(e);
19225         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
19226         *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
19227         return tag_ptr(ret_conv, true);
19228 }
19229
19230 jboolean  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_is_ok"))) TS_CResult_InvoiceSemanticErrorZ_is_ok(uint64_t o) {
19231         LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(o);
19232         jboolean ret_conv = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
19233         return ret_conv;
19234 }
19235
19236 void  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_free"))) TS_CResult_InvoiceSemanticErrorZ_free(uint64_t _res) {
19237         if (!ptr_is_owned(_res)) return;
19238         void* _res_ptr = untag_ptr(_res);
19239         CHECK_ACCESS(_res_ptr);
19240         LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
19241         FREE(untag_ptr(_res));
19242         CResult_InvoiceSemanticErrorZ_free(_res_conv);
19243 }
19244
19245 static inline uint64_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
19246         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
19247         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
19248         return tag_ptr(ret_conv, true);
19249 }
19250 int64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceSemanticErrorZ_clone_ptr(uint64_t arg) {
19251         LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(arg);
19252         int64_t ret_conv = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
19253         return ret_conv;
19254 }
19255
19256 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint64_t orig) {
19257         LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(orig);
19258         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
19259         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
19260         return tag_ptr(ret_conv, true);
19261 }
19262
19263 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_ok"))) TS_CResult_DescriptionCreationErrorZ_ok(uint64_t o) {
19264         LDKDescription o_conv;
19265         o_conv.inner = untag_ptr(o);
19266         o_conv.is_owned = ptr_is_owned(o);
19267         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19268         o_conv = Description_clone(&o_conv);
19269         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
19270         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
19271         return tag_ptr(ret_conv, true);
19272 }
19273
19274 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_err"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
19275         LDKCreationError e_conv = LDKCreationError_from_js(e);
19276         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
19277         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
19278         return tag_ptr(ret_conv, true);
19279 }
19280
19281 jboolean  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_is_ok"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint64_t o) {
19282         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
19283         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
19284         return ret_conv;
19285 }
19286
19287 void  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_free"))) TS_CResult_DescriptionCreationErrorZ_free(uint64_t _res) {
19288         if (!ptr_is_owned(_res)) return;
19289         void* _res_ptr = untag_ptr(_res);
19290         CHECK_ACCESS(_res_ptr);
19291         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
19292         FREE(untag_ptr(_res));
19293         CResult_DescriptionCreationErrorZ_free(_res_conv);
19294 }
19295
19296 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
19297         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
19298         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
19299         return tag_ptr(ret_conv, true);
19300 }
19301 int64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone_ptr"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint64_t arg) {
19302         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
19303         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
19304         return ret_conv;
19305 }
19306
19307 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone"))) TS_CResult_DescriptionCreationErrorZ_clone(uint64_t orig) {
19308         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
19309         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
19310         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
19311         return tag_ptr(ret_conv, true);
19312 }
19313
19314 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_ok"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint64_t o) {
19315         LDKPrivateRoute o_conv;
19316         o_conv.inner = untag_ptr(o);
19317         o_conv.is_owned = ptr_is_owned(o);
19318         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19319         o_conv = PrivateRoute_clone(&o_conv);
19320         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
19321         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
19322         return tag_ptr(ret_conv, true);
19323 }
19324
19325 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_err"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
19326         LDKCreationError e_conv = LDKCreationError_from_js(e);
19327         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
19328         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
19329         return tag_ptr(ret_conv, true);
19330 }
19331
19332 jboolean  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_is_ok"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint64_t o) {
19333         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
19334         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
19335         return ret_conv;
19336 }
19337
19338 void  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_free"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint64_t _res) {
19339         if (!ptr_is_owned(_res)) return;
19340         void* _res_ptr = untag_ptr(_res);
19341         CHECK_ACCESS(_res_ptr);
19342         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
19343         FREE(untag_ptr(_res));
19344         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
19345 }
19346
19347 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
19348         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
19349         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
19350         return tag_ptr(ret_conv, true);
19351 }
19352 int64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone_ptr"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint64_t arg) {
19353         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
19354         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
19355         return ret_conv;
19356 }
19357
19358 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint64_t orig) {
19359         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
19360         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
19361         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
19362         return tag_ptr(ret_conv, true);
19363 }
19364
19365 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_ok"))) TS_CResult_NoneErrorZ_ok() {
19366         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
19367         *ret_conv = CResult_NoneErrorZ_ok();
19368         return tag_ptr(ret_conv, true);
19369 }
19370
19371 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_err"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
19372         LDKIOError e_conv = LDKIOError_from_js(e);
19373         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
19374         *ret_conv = CResult_NoneErrorZ_err(e_conv);
19375         return tag_ptr(ret_conv, true);
19376 }
19377
19378 jboolean  __attribute__((export_name("TS_CResult_NoneErrorZ_is_ok"))) TS_CResult_NoneErrorZ_is_ok(uint64_t o) {
19379         LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)untag_ptr(o);
19380         jboolean ret_conv = CResult_NoneErrorZ_is_ok(o_conv);
19381         return ret_conv;
19382 }
19383
19384 void  __attribute__((export_name("TS_CResult_NoneErrorZ_free"))) TS_CResult_NoneErrorZ_free(uint64_t _res) {
19385         if (!ptr_is_owned(_res)) return;
19386         void* _res_ptr = untag_ptr(_res);
19387         CHECK_ACCESS(_res_ptr);
19388         LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
19389         FREE(untag_ptr(_res));
19390         CResult_NoneErrorZ_free(_res_conv);
19391 }
19392
19393 static inline uint64_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
19394         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
19395         *ret_conv = CResult_NoneErrorZ_clone(arg);
19396         return tag_ptr(ret_conv, true);
19397 }
19398 int64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_clone_ptr"))) TS_CResult_NoneErrorZ_clone_ptr(uint64_t arg) {
19399         LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)untag_ptr(arg);
19400         int64_t ret_conv = CResult_NoneErrorZ_clone_ptr(arg_conv);
19401         return ret_conv;
19402 }
19403
19404 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_clone"))) TS_CResult_NoneErrorZ_clone(uint64_t orig) {
19405         LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)untag_ptr(orig);
19406         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
19407         *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
19408         return tag_ptr(ret_conv, true);
19409 }
19410
19411 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_ok"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint64_t o) {
19412         void* o_ptr = untag_ptr(o);
19413         CHECK_ACCESS(o_ptr);
19414         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
19415         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
19416         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19417         *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
19418         return tag_ptr(ret_conv, true);
19419 }
19420
19421 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_err"))) TS_CResult_NetAddressDecodeErrorZ_err(uint64_t e) {
19422         void* e_ptr = untag_ptr(e);
19423         CHECK_ACCESS(e_ptr);
19424         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19425         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19426         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19427         *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
19428         return tag_ptr(ret_conv, true);
19429 }
19430
19431 jboolean  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_is_ok"))) TS_CResult_NetAddressDecodeErrorZ_is_ok(uint64_t o) {
19432         LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(o);
19433         jboolean ret_conv = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
19434         return ret_conv;
19435 }
19436
19437 void  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_free"))) TS_CResult_NetAddressDecodeErrorZ_free(uint64_t _res) {
19438         if (!ptr_is_owned(_res)) return;
19439         void* _res_ptr = untag_ptr(_res);
19440         CHECK_ACCESS(_res_ptr);
19441         LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
19442         FREE(untag_ptr(_res));
19443         CResult_NetAddressDecodeErrorZ_free(_res_conv);
19444 }
19445
19446 static inline uint64_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
19447         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19448         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
19449         return tag_ptr(ret_conv, true);
19450 }
19451 int64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone_ptr"))) TS_CResult_NetAddressDecodeErrorZ_clone_ptr(uint64_t arg) {
19452         LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(arg);
19453         int64_t ret_conv = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
19454         return ret_conv;
19455 }
19456
19457 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint64_t orig) {
19458         LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(orig);
19459         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19460         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
19461         return tag_ptr(ret_conv, true);
19462 }
19463
19464 void  __attribute__((export_name("TS_CVec_UpdateAddHTLCZ_free"))) TS_CVec_UpdateAddHTLCZ_free(uint64_tArray _res) {
19465         LDKCVec_UpdateAddHTLCZ _res_constr;
19466         _res_constr.datalen = _res->arr_len;
19467         if (_res_constr.datalen > 0)
19468                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
19469         else
19470                 _res_constr.data = NULL;
19471         uint64_t* _res_vals = _res->elems;
19472         for (size_t p = 0; p < _res_constr.datalen; p++) {
19473                 uint64_t _res_conv_15 = _res_vals[p];
19474                 LDKUpdateAddHTLC _res_conv_15_conv;
19475                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
19476                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
19477                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
19478                 _res_constr.data[p] = _res_conv_15_conv;
19479         }
19480         FREE(_res);
19481         CVec_UpdateAddHTLCZ_free(_res_constr);
19482 }
19483
19484 void  __attribute__((export_name("TS_CVec_UpdateFulfillHTLCZ_free"))) TS_CVec_UpdateFulfillHTLCZ_free(uint64_tArray _res) {
19485         LDKCVec_UpdateFulfillHTLCZ _res_constr;
19486         _res_constr.datalen = _res->arr_len;
19487         if (_res_constr.datalen > 0)
19488                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
19489         else
19490                 _res_constr.data = NULL;
19491         uint64_t* _res_vals = _res->elems;
19492         for (size_t t = 0; t < _res_constr.datalen; t++) {
19493                 uint64_t _res_conv_19 = _res_vals[t];
19494                 LDKUpdateFulfillHTLC _res_conv_19_conv;
19495                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
19496                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
19497                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
19498                 _res_constr.data[t] = _res_conv_19_conv;
19499         }
19500         FREE(_res);
19501         CVec_UpdateFulfillHTLCZ_free(_res_constr);
19502 }
19503
19504 void  __attribute__((export_name("TS_CVec_UpdateFailHTLCZ_free"))) TS_CVec_UpdateFailHTLCZ_free(uint64_tArray _res) {
19505         LDKCVec_UpdateFailHTLCZ _res_constr;
19506         _res_constr.datalen = _res->arr_len;
19507         if (_res_constr.datalen > 0)
19508                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
19509         else
19510                 _res_constr.data = NULL;
19511         uint64_t* _res_vals = _res->elems;
19512         for (size_t q = 0; q < _res_constr.datalen; q++) {
19513                 uint64_t _res_conv_16 = _res_vals[q];
19514                 LDKUpdateFailHTLC _res_conv_16_conv;
19515                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
19516                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
19517                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
19518                 _res_constr.data[q] = _res_conv_16_conv;
19519         }
19520         FREE(_res);
19521         CVec_UpdateFailHTLCZ_free(_res_constr);
19522 }
19523
19524 void  __attribute__((export_name("TS_CVec_UpdateFailMalformedHTLCZ_free"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint64_tArray _res) {
19525         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
19526         _res_constr.datalen = _res->arr_len;
19527         if (_res_constr.datalen > 0)
19528                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
19529         else
19530                 _res_constr.data = NULL;
19531         uint64_t* _res_vals = _res->elems;
19532         for (size_t z = 0; z < _res_constr.datalen; z++) {
19533                 uint64_t _res_conv_25 = _res_vals[z];
19534                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
19535                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
19536                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
19537                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
19538                 _res_constr.data[z] = _res_conv_25_conv;
19539         }
19540         FREE(_res);
19541         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
19542 }
19543
19544 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint64_t o) {
19545         LDKAcceptChannel o_conv;
19546         o_conv.inner = untag_ptr(o);
19547         o_conv.is_owned = ptr_is_owned(o);
19548         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19549         o_conv = AcceptChannel_clone(&o_conv);
19550         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
19551         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
19552         return tag_ptr(ret_conv, true);
19553 }
19554
19555 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_err"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint64_t e) {
19556         void* e_ptr = untag_ptr(e);
19557         CHECK_ACCESS(e_ptr);
19558         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19559         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19560         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
19561         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
19562         return tag_ptr(ret_conv, true);
19563 }
19564
19565 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint64_t o) {
19566         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
19567         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
19568         return ret_conv;
19569 }
19570
19571 void  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_free"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint64_t _res) {
19572         if (!ptr_is_owned(_res)) return;
19573         void* _res_ptr = untag_ptr(_res);
19574         CHECK_ACCESS(_res_ptr);
19575         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
19576         FREE(untag_ptr(_res));
19577         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
19578 }
19579
19580 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
19581         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
19582         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
19583         return tag_ptr(ret_conv, true);
19584 }
19585 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
19586         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
19587         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
19588         return ret_conv;
19589 }
19590
19591 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint64_t orig) {
19592         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
19593         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
19594         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
19595         return tag_ptr(ret_conv, true);
19596 }
19597
19598 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint64_t o) {
19599         LDKAnnouncementSignatures o_conv;
19600         o_conv.inner = untag_ptr(o);
19601         o_conv.is_owned = ptr_is_owned(o);
19602         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19603         o_conv = AnnouncementSignatures_clone(&o_conv);
19604         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
19605         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
19606         return tag_ptr(ret_conv, true);
19607 }
19608
19609 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint64_t e) {
19610         void* e_ptr = untag_ptr(e);
19611         CHECK_ACCESS(e_ptr);
19612         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19613         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19614         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
19615         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
19616         return tag_ptr(ret_conv, true);
19617 }
19618
19619 jboolean  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint64_t o) {
19620         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
19621         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
19622         return ret_conv;
19623 }
19624
19625 void  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_free"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint64_t _res) {
19626         if (!ptr_is_owned(_res)) return;
19627         void* _res_ptr = untag_ptr(_res);
19628         CHECK_ACCESS(_res_ptr);
19629         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
19630         FREE(untag_ptr(_res));
19631         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
19632 }
19633
19634 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
19635         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
19636         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
19637         return tag_ptr(ret_conv, true);
19638 }
19639 int64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
19640         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
19641         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
19642         return ret_conv;
19643 }
19644
19645 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint64_t orig) {
19646         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
19647         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
19648         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
19649         return tag_ptr(ret_conv, true);
19650 }
19651
19652 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint64_t o) {
19653         LDKChannelReestablish o_conv;
19654         o_conv.inner = untag_ptr(o);
19655         o_conv.is_owned = ptr_is_owned(o);
19656         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19657         o_conv = ChannelReestablish_clone(&o_conv);
19658         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
19659         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
19660         return tag_ptr(ret_conv, true);
19661 }
19662
19663 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint64_t e) {
19664         void* e_ptr = untag_ptr(e);
19665         CHECK_ACCESS(e_ptr);
19666         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19667         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19668         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
19669         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
19670         return tag_ptr(ret_conv, true);
19671 }
19672
19673 jboolean  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_is_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint64_t o) {
19674         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
19675         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
19676         return ret_conv;
19677 }
19678
19679 void  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_free"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint64_t _res) {
19680         if (!ptr_is_owned(_res)) return;
19681         void* _res_ptr = untag_ptr(_res);
19682         CHECK_ACCESS(_res_ptr);
19683         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
19684         FREE(untag_ptr(_res));
19685         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
19686 }
19687
19688 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
19689         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
19690         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
19691         return tag_ptr(ret_conv, true);
19692 }
19693 int64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint64_t arg) {
19694         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
19695         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
19696         return ret_conv;
19697 }
19698
19699 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint64_t orig) {
19700         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
19701         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
19702         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
19703         return tag_ptr(ret_conv, true);
19704 }
19705
19706 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint64_t o) {
19707         LDKClosingSigned o_conv;
19708         o_conv.inner = untag_ptr(o);
19709         o_conv.is_owned = ptr_is_owned(o);
19710         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19711         o_conv = ClosingSigned_clone(&o_conv);
19712         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
19713         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
19714         return tag_ptr(ret_conv, true);
19715 }
19716
19717 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_err"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint64_t e) {
19718         void* e_ptr = untag_ptr(e);
19719         CHECK_ACCESS(e_ptr);
19720         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19721         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19722         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
19723         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
19724         return tag_ptr(ret_conv, true);
19725 }
19726
19727 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint64_t o) {
19728         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
19729         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
19730         return ret_conv;
19731 }
19732
19733 void  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_free"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint64_t _res) {
19734         if (!ptr_is_owned(_res)) return;
19735         void* _res_ptr = untag_ptr(_res);
19736         CHECK_ACCESS(_res_ptr);
19737         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
19738         FREE(untag_ptr(_res));
19739         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
19740 }
19741
19742 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
19743         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
19744         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
19745         return tag_ptr(ret_conv, true);
19746 }
19747 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
19748         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
19749         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
19750         return ret_conv;
19751 }
19752
19753 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint64_t orig) {
19754         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
19755         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
19756         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
19757         return tag_ptr(ret_conv, true);
19758 }
19759
19760 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint64_t o) {
19761         LDKClosingSignedFeeRange o_conv;
19762         o_conv.inner = untag_ptr(o);
19763         o_conv.is_owned = ptr_is_owned(o);
19764         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19765         o_conv = ClosingSignedFeeRange_clone(&o_conv);
19766         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
19767         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
19768         return tag_ptr(ret_conv, true);
19769 }
19770
19771 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint64_t e) {
19772         void* e_ptr = untag_ptr(e);
19773         CHECK_ACCESS(e_ptr);
19774         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19775         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19776         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
19777         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
19778         return tag_ptr(ret_conv, true);
19779 }
19780
19781 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint64_t o) {
19782         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
19783         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
19784         return ret_conv;
19785 }
19786
19787 void  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint64_t _res) {
19788         if (!ptr_is_owned(_res)) return;
19789         void* _res_ptr = untag_ptr(_res);
19790         CHECK_ACCESS(_res_ptr);
19791         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
19792         FREE(untag_ptr(_res));
19793         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
19794 }
19795
19796 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
19797         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
19798         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
19799         return tag_ptr(ret_conv, true);
19800 }
19801 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
19802         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
19803         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
19804         return ret_conv;
19805 }
19806
19807 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint64_t orig) {
19808         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
19809         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
19810         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
19811         return tag_ptr(ret_conv, true);
19812 }
19813
19814 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint64_t o) {
19815         LDKCommitmentSigned o_conv;
19816         o_conv.inner = untag_ptr(o);
19817         o_conv.is_owned = ptr_is_owned(o);
19818         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19819         o_conv = CommitmentSigned_clone(&o_conv);
19820         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
19821         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
19822         return tag_ptr(ret_conv, true);
19823 }
19824
19825 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint64_t e) {
19826         void* e_ptr = untag_ptr(e);
19827         CHECK_ACCESS(e_ptr);
19828         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19829         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19830         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
19831         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
19832         return tag_ptr(ret_conv, true);
19833 }
19834
19835 jboolean  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_is_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint64_t o) {
19836         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
19837         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
19838         return ret_conv;
19839 }
19840
19841 void  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_free"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint64_t _res) {
19842         if (!ptr_is_owned(_res)) return;
19843         void* _res_ptr = untag_ptr(_res);
19844         CHECK_ACCESS(_res_ptr);
19845         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
19846         FREE(untag_ptr(_res));
19847         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
19848 }
19849
19850 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
19851         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
19852         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
19853         return tag_ptr(ret_conv, true);
19854 }
19855 int64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
19856         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
19857         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
19858         return ret_conv;
19859 }
19860
19861 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint64_t orig) {
19862         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
19863         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
19864         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
19865         return tag_ptr(ret_conv, true);
19866 }
19867
19868 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint64_t o) {
19869         LDKFundingCreated o_conv;
19870         o_conv.inner = untag_ptr(o);
19871         o_conv.is_owned = ptr_is_owned(o);
19872         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19873         o_conv = FundingCreated_clone(&o_conv);
19874         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
19875         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
19876         return tag_ptr(ret_conv, true);
19877 }
19878
19879 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_err"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint64_t e) {
19880         void* e_ptr = untag_ptr(e);
19881         CHECK_ACCESS(e_ptr);
19882         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19883         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19884         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
19885         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
19886         return tag_ptr(ret_conv, true);
19887 }
19888
19889 jboolean  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_is_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint64_t o) {
19890         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
19891         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
19892         return ret_conv;
19893 }
19894
19895 void  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_free"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint64_t _res) {
19896         if (!ptr_is_owned(_res)) return;
19897         void* _res_ptr = untag_ptr(_res);
19898         CHECK_ACCESS(_res_ptr);
19899         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
19900         FREE(untag_ptr(_res));
19901         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
19902 }
19903
19904 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
19905         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
19906         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
19907         return tag_ptr(ret_conv, true);
19908 }
19909 int64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint64_t arg) {
19910         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
19911         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
19912         return ret_conv;
19913 }
19914
19915 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint64_t orig) {
19916         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
19917         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
19918         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
19919         return tag_ptr(ret_conv, true);
19920 }
19921
19922 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_ok"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint64_t o) {
19923         LDKFundingSigned o_conv;
19924         o_conv.inner = untag_ptr(o);
19925         o_conv.is_owned = ptr_is_owned(o);
19926         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19927         o_conv = FundingSigned_clone(&o_conv);
19928         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
19929         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
19930         return tag_ptr(ret_conv, true);
19931 }
19932
19933 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_err"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint64_t e) {
19934         void* e_ptr = untag_ptr(e);
19935         CHECK_ACCESS(e_ptr);
19936         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19937         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19938         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
19939         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
19940         return tag_ptr(ret_conv, true);
19941 }
19942
19943 jboolean  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_is_ok"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint64_t o) {
19944         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
19945         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
19946         return ret_conv;
19947 }
19948
19949 void  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_free"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint64_t _res) {
19950         if (!ptr_is_owned(_res)) return;
19951         void* _res_ptr = untag_ptr(_res);
19952         CHECK_ACCESS(_res_ptr);
19953         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
19954         FREE(untag_ptr(_res));
19955         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
19956 }
19957
19958 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
19959         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
19960         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
19961         return tag_ptr(ret_conv, true);
19962 }
19963 int64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
19964         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
19965         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
19966         return ret_conv;
19967 }
19968
19969 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint64_t orig) {
19970         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
19971         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
19972         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
19973         return tag_ptr(ret_conv, true);
19974 }
19975
19976 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_ok(uint64_t o) {
19977         LDKChannelReady o_conv;
19978         o_conv.inner = untag_ptr(o);
19979         o_conv.is_owned = ptr_is_owned(o);
19980         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19981         o_conv = ChannelReady_clone(&o_conv);
19982         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
19983         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
19984         return tag_ptr(ret_conv, true);
19985 }
19986
19987 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_err"))) TS_CResult_ChannelReadyDecodeErrorZ_err(uint64_t e) {
19988         void* e_ptr = untag_ptr(e);
19989         CHECK_ACCESS(e_ptr);
19990         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19991         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19992         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
19993         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
19994         return tag_ptr(ret_conv, true);
19995 }
19996
19997 jboolean  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_is_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_is_ok(uint64_t o) {
19998         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
19999         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
20000         return ret_conv;
20001 }
20002
20003 void  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_free"))) TS_CResult_ChannelReadyDecodeErrorZ_free(uint64_t _res) {
20004         if (!ptr_is_owned(_res)) return;
20005         void* _res_ptr = untag_ptr(_res);
20006         CHECK_ACCESS(_res_ptr);
20007         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
20008         FREE(untag_ptr(_res));
20009         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
20010 }
20011
20012 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
20013         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
20014         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
20015         return tag_ptr(ret_conv, true);
20016 }
20017 int64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr(uint64_t arg) {
20018         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
20019         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
20020         return ret_conv;
20021 }
20022
20023 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone"))) TS_CResult_ChannelReadyDecodeErrorZ_clone(uint64_t orig) {
20024         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
20025         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
20026         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
20027         return tag_ptr(ret_conv, true);
20028 }
20029
20030 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_ok"))) TS_CResult_InitDecodeErrorZ_ok(uint64_t o) {
20031         LDKInit o_conv;
20032         o_conv.inner = untag_ptr(o);
20033         o_conv.is_owned = ptr_is_owned(o);
20034         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20035         o_conv = Init_clone(&o_conv);
20036         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20037         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
20038         return tag_ptr(ret_conv, true);
20039 }
20040
20041 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_err"))) TS_CResult_InitDecodeErrorZ_err(uint64_t e) {
20042         void* e_ptr = untag_ptr(e);
20043         CHECK_ACCESS(e_ptr);
20044         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20045         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20046         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20047         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
20048         return tag_ptr(ret_conv, true);
20049 }
20050
20051 jboolean  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_is_ok"))) TS_CResult_InitDecodeErrorZ_is_ok(uint64_t o) {
20052         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
20053         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
20054         return ret_conv;
20055 }
20056
20057 void  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_free"))) TS_CResult_InitDecodeErrorZ_free(uint64_t _res) {
20058         if (!ptr_is_owned(_res)) return;
20059         void* _res_ptr = untag_ptr(_res);
20060         CHECK_ACCESS(_res_ptr);
20061         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
20062         FREE(untag_ptr(_res));
20063         CResult_InitDecodeErrorZ_free(_res_conv);
20064 }
20065
20066 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
20067         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20068         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
20069         return tag_ptr(ret_conv, true);
20070 }
20071 int64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone_ptr"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint64_t arg) {
20072         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
20073         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
20074         return ret_conv;
20075 }
20076
20077 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone"))) TS_CResult_InitDecodeErrorZ_clone(uint64_t orig) {
20078         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
20079         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20080         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
20081         return tag_ptr(ret_conv, true);
20082 }
20083
20084 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_ok"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint64_t o) {
20085         LDKOpenChannel o_conv;
20086         o_conv.inner = untag_ptr(o);
20087         o_conv.is_owned = ptr_is_owned(o);
20088         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20089         o_conv = OpenChannel_clone(&o_conv);
20090         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20091         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
20092         return tag_ptr(ret_conv, true);
20093 }
20094
20095 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_err"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint64_t e) {
20096         void* e_ptr = untag_ptr(e);
20097         CHECK_ACCESS(e_ptr);
20098         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20099         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20100         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20101         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
20102         return tag_ptr(ret_conv, true);
20103 }
20104
20105 jboolean  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_is_ok"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint64_t o) {
20106         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
20107         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
20108         return ret_conv;
20109 }
20110
20111 void  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_free"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint64_t _res) {
20112         if (!ptr_is_owned(_res)) return;
20113         void* _res_ptr = untag_ptr(_res);
20114         CHECK_ACCESS(_res_ptr);
20115         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
20116         FREE(untag_ptr(_res));
20117         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
20118 }
20119
20120 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
20121         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20122         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
20123         return tag_ptr(ret_conv, true);
20124 }
20125 int64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
20126         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
20127         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
20128         return ret_conv;
20129 }
20130
20131 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint64_t orig) {
20132         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
20133         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20134         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
20135         return tag_ptr(ret_conv, true);
20136 }
20137
20138 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint64_t o) {
20139         LDKRevokeAndACK o_conv;
20140         o_conv.inner = untag_ptr(o);
20141         o_conv.is_owned = ptr_is_owned(o);
20142         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20143         o_conv = RevokeAndACK_clone(&o_conv);
20144         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20145         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
20146         return tag_ptr(ret_conv, true);
20147 }
20148
20149 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint64_t e) {
20150         void* e_ptr = untag_ptr(e);
20151         CHECK_ACCESS(e_ptr);
20152         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20153         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20154         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20155         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
20156         return tag_ptr(ret_conv, true);
20157 }
20158
20159 jboolean  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_is_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint64_t o) {
20160         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
20161         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
20162         return ret_conv;
20163 }
20164
20165 void  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_free"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint64_t _res) {
20166         if (!ptr_is_owned(_res)) return;
20167         void* _res_ptr = untag_ptr(_res);
20168         CHECK_ACCESS(_res_ptr);
20169         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
20170         FREE(untag_ptr(_res));
20171         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
20172 }
20173
20174 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
20175         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20176         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
20177         return tag_ptr(ret_conv, true);
20178 }
20179 int64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint64_t arg) {
20180         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
20181         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
20182         return ret_conv;
20183 }
20184
20185 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint64_t orig) {
20186         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
20187         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20188         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
20189         return tag_ptr(ret_conv, true);
20190 }
20191
20192 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_ok"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint64_t o) {
20193         LDKShutdown o_conv;
20194         o_conv.inner = untag_ptr(o);
20195         o_conv.is_owned = ptr_is_owned(o);
20196         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20197         o_conv = Shutdown_clone(&o_conv);
20198         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20199         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
20200         return tag_ptr(ret_conv, true);
20201 }
20202
20203 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_err"))) TS_CResult_ShutdownDecodeErrorZ_err(uint64_t e) {
20204         void* e_ptr = untag_ptr(e);
20205         CHECK_ACCESS(e_ptr);
20206         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20207         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20208         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20209         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
20210         return tag_ptr(ret_conv, true);
20211 }
20212
20213 jboolean  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_is_ok"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint64_t o) {
20214         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
20215         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
20216         return ret_conv;
20217 }
20218
20219 void  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_free"))) TS_CResult_ShutdownDecodeErrorZ_free(uint64_t _res) {
20220         if (!ptr_is_owned(_res)) return;
20221         void* _res_ptr = untag_ptr(_res);
20222         CHECK_ACCESS(_res_ptr);
20223         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
20224         FREE(untag_ptr(_res));
20225         CResult_ShutdownDecodeErrorZ_free(_res_conv);
20226 }
20227
20228 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
20229         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20230         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
20231         return tag_ptr(ret_conv, true);
20232 }
20233 int64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint64_t arg) {
20234         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
20235         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
20236         return ret_conv;
20237 }
20238
20239 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint64_t orig) {
20240         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
20241         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20242         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
20243         return tag_ptr(ret_conv, true);
20244 }
20245
20246 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint64_t o) {
20247         LDKUpdateFailHTLC o_conv;
20248         o_conv.inner = untag_ptr(o);
20249         o_conv.is_owned = ptr_is_owned(o);
20250         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20251         o_conv = UpdateFailHTLC_clone(&o_conv);
20252         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20253         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
20254         return tag_ptr(ret_conv, true);
20255 }
20256
20257 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint64_t e) {
20258         void* e_ptr = untag_ptr(e);
20259         CHECK_ACCESS(e_ptr);
20260         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20261         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20262         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20263         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
20264         return tag_ptr(ret_conv, true);
20265 }
20266
20267 jboolean  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint64_t o) {
20268         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
20269         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
20270         return ret_conv;
20271 }
20272
20273 void  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint64_t _res) {
20274         if (!ptr_is_owned(_res)) return;
20275         void* _res_ptr = untag_ptr(_res);
20276         CHECK_ACCESS(_res_ptr);
20277         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
20278         FREE(untag_ptr(_res));
20279         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
20280 }
20281
20282 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
20283         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20284         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
20285         return tag_ptr(ret_conv, true);
20286 }
20287 int64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
20288         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
20289         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
20290         return ret_conv;
20291 }
20292
20293 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint64_t orig) {
20294         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
20295         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20296         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
20297         return tag_ptr(ret_conv, true);
20298 }
20299
20300 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint64_t o) {
20301         LDKUpdateFailMalformedHTLC o_conv;
20302         o_conv.inner = untag_ptr(o);
20303         o_conv.is_owned = ptr_is_owned(o);
20304         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20305         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
20306         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20307         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
20308         return tag_ptr(ret_conv, true);
20309 }
20310
20311 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint64_t e) {
20312         void* e_ptr = untag_ptr(e);
20313         CHECK_ACCESS(e_ptr);
20314         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20315         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20316         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20317         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
20318         return tag_ptr(ret_conv, true);
20319 }
20320
20321 jboolean  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint64_t o) {
20322         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
20323         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
20324         return ret_conv;
20325 }
20326
20327 void  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint64_t _res) {
20328         if (!ptr_is_owned(_res)) return;
20329         void* _res_ptr = untag_ptr(_res);
20330         CHECK_ACCESS(_res_ptr);
20331         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
20332         FREE(untag_ptr(_res));
20333         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
20334 }
20335
20336 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
20337         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20338         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
20339         return tag_ptr(ret_conv, true);
20340 }
20341 int64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
20342         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
20343         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
20344         return ret_conv;
20345 }
20346
20347 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint64_t orig) {
20348         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
20349         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
20350         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
20351         return tag_ptr(ret_conv, true);
20352 }
20353
20354 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint64_t o) {
20355         LDKUpdateFee o_conv;
20356         o_conv.inner = untag_ptr(o);
20357         o_conv.is_owned = ptr_is_owned(o);
20358         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20359         o_conv = UpdateFee_clone(&o_conv);
20360         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20361         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
20362         return tag_ptr(ret_conv, true);
20363 }
20364
20365 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_err"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint64_t e) {
20366         void* e_ptr = untag_ptr(e);
20367         CHECK_ACCESS(e_ptr);
20368         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20369         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20370         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20371         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
20372         return tag_ptr(ret_conv, true);
20373 }
20374
20375 jboolean  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_is_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint64_t o) {
20376         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
20377         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
20378         return ret_conv;
20379 }
20380
20381 void  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_free"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint64_t _res) {
20382         if (!ptr_is_owned(_res)) return;
20383         void* _res_ptr = untag_ptr(_res);
20384         CHECK_ACCESS(_res_ptr);
20385         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
20386         FREE(untag_ptr(_res));
20387         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
20388 }
20389
20390 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
20391         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20392         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
20393         return tag_ptr(ret_conv, true);
20394 }
20395 int64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint64_t arg) {
20396         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
20397         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
20398         return ret_conv;
20399 }
20400
20401 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint64_t orig) {
20402         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
20403         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
20404         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
20405         return tag_ptr(ret_conv, true);
20406 }
20407
20408 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint64_t o) {
20409         LDKUpdateFulfillHTLC o_conv;
20410         o_conv.inner = untag_ptr(o);
20411         o_conv.is_owned = ptr_is_owned(o);
20412         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20413         o_conv = UpdateFulfillHTLC_clone(&o_conv);
20414         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20415         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
20416         return tag_ptr(ret_conv, true);
20417 }
20418
20419 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint64_t e) {
20420         void* e_ptr = untag_ptr(e);
20421         CHECK_ACCESS(e_ptr);
20422         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20423         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20424         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20425         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
20426         return tag_ptr(ret_conv, true);
20427 }
20428
20429 jboolean  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint64_t o) {
20430         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
20431         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
20432         return ret_conv;
20433 }
20434
20435 void  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint64_t _res) {
20436         if (!ptr_is_owned(_res)) return;
20437         void* _res_ptr = untag_ptr(_res);
20438         CHECK_ACCESS(_res_ptr);
20439         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
20440         FREE(untag_ptr(_res));
20441         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
20442 }
20443
20444 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
20445         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20446         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
20447         return tag_ptr(ret_conv, true);
20448 }
20449 int64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
20450         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
20451         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
20452         return ret_conv;
20453 }
20454
20455 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint64_t orig) {
20456         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
20457         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
20458         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
20459         return tag_ptr(ret_conv, true);
20460 }
20461
20462 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint64_t o) {
20463         LDKUpdateAddHTLC o_conv;
20464         o_conv.inner = untag_ptr(o);
20465         o_conv.is_owned = ptr_is_owned(o);
20466         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20467         o_conv = UpdateAddHTLC_clone(&o_conv);
20468         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
20469         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
20470         return tag_ptr(ret_conv, true);
20471 }
20472
20473 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint64_t e) {
20474         void* e_ptr = untag_ptr(e);
20475         CHECK_ACCESS(e_ptr);
20476         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20477         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20478         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
20479         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
20480         return tag_ptr(ret_conv, true);
20481 }
20482
20483 jboolean  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint64_t o) {
20484         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
20485         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
20486         return ret_conv;
20487 }
20488
20489 void  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_free"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint64_t _res) {
20490         if (!ptr_is_owned(_res)) return;
20491         void* _res_ptr = untag_ptr(_res);
20492         CHECK_ACCESS(_res_ptr);
20493         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
20494         FREE(untag_ptr(_res));
20495         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
20496 }
20497
20498 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
20499         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
20500         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
20501         return tag_ptr(ret_conv, true);
20502 }
20503 int64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
20504         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
20505         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
20506         return ret_conv;
20507 }
20508
20509 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint64_t orig) {
20510         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
20511         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
20512         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
20513         return tag_ptr(ret_conv, true);
20514 }
20515
20516 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_ok"))) TS_CResult_OnionMessageDecodeErrorZ_ok(uint64_t o) {
20517         LDKOnionMessage o_conv;
20518         o_conv.inner = untag_ptr(o);
20519         o_conv.is_owned = ptr_is_owned(o);
20520         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20521         o_conv = OnionMessage_clone(&o_conv);
20522         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
20523         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
20524         return tag_ptr(ret_conv, true);
20525 }
20526
20527 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_err"))) TS_CResult_OnionMessageDecodeErrorZ_err(uint64_t e) {
20528         void* e_ptr = untag_ptr(e);
20529         CHECK_ACCESS(e_ptr);
20530         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20531         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20532         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
20533         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
20534         return tag_ptr(ret_conv, true);
20535 }
20536
20537 jboolean  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_is_ok"))) TS_CResult_OnionMessageDecodeErrorZ_is_ok(uint64_t o) {
20538         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
20539         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
20540         return ret_conv;
20541 }
20542
20543 void  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_free"))) TS_CResult_OnionMessageDecodeErrorZ_free(uint64_t _res) {
20544         if (!ptr_is_owned(_res)) return;
20545         void* _res_ptr = untag_ptr(_res);
20546         CHECK_ACCESS(_res_ptr);
20547         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
20548         FREE(untag_ptr(_res));
20549         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
20550 }
20551
20552 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
20553         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
20554         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
20555         return tag_ptr(ret_conv, true);
20556 }
20557 int64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OnionMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
20558         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
20559         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
20560         return ret_conv;
20561 }
20562
20563 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone"))) TS_CResult_OnionMessageDecodeErrorZ_clone(uint64_t orig) {
20564         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
20565         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
20566         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
20567         return tag_ptr(ret_conv, true);
20568 }
20569
20570 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_ok"))) TS_CResult_PingDecodeErrorZ_ok(uint64_t o) {
20571         LDKPing o_conv;
20572         o_conv.inner = untag_ptr(o);
20573         o_conv.is_owned = ptr_is_owned(o);
20574         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20575         o_conv = Ping_clone(&o_conv);
20576         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
20577         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
20578         return tag_ptr(ret_conv, true);
20579 }
20580
20581 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_err"))) TS_CResult_PingDecodeErrorZ_err(uint64_t e) {
20582         void* e_ptr = untag_ptr(e);
20583         CHECK_ACCESS(e_ptr);
20584         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20585         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20586         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
20587         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
20588         return tag_ptr(ret_conv, true);
20589 }
20590
20591 jboolean  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_is_ok"))) TS_CResult_PingDecodeErrorZ_is_ok(uint64_t o) {
20592         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
20593         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
20594         return ret_conv;
20595 }
20596
20597 void  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_free"))) TS_CResult_PingDecodeErrorZ_free(uint64_t _res) {
20598         if (!ptr_is_owned(_res)) return;
20599         void* _res_ptr = untag_ptr(_res);
20600         CHECK_ACCESS(_res_ptr);
20601         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
20602         FREE(untag_ptr(_res));
20603         CResult_PingDecodeErrorZ_free(_res_conv);
20604 }
20605
20606 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
20607         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
20608         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
20609         return tag_ptr(ret_conv, true);
20610 }
20611 int64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone_ptr"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint64_t arg) {
20612         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
20613         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
20614         return ret_conv;
20615 }
20616
20617 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone"))) TS_CResult_PingDecodeErrorZ_clone(uint64_t orig) {
20618         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
20619         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
20620         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
20621         return tag_ptr(ret_conv, true);
20622 }
20623
20624 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_ok"))) TS_CResult_PongDecodeErrorZ_ok(uint64_t o) {
20625         LDKPong o_conv;
20626         o_conv.inner = untag_ptr(o);
20627         o_conv.is_owned = ptr_is_owned(o);
20628         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20629         o_conv = Pong_clone(&o_conv);
20630         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
20631         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
20632         return tag_ptr(ret_conv, true);
20633 }
20634
20635 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_err"))) TS_CResult_PongDecodeErrorZ_err(uint64_t e) {
20636         void* e_ptr = untag_ptr(e);
20637         CHECK_ACCESS(e_ptr);
20638         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20639         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20640         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
20641         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
20642         return tag_ptr(ret_conv, true);
20643 }
20644
20645 jboolean  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_is_ok"))) TS_CResult_PongDecodeErrorZ_is_ok(uint64_t o) {
20646         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
20647         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
20648         return ret_conv;
20649 }
20650
20651 void  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_free"))) TS_CResult_PongDecodeErrorZ_free(uint64_t _res) {
20652         if (!ptr_is_owned(_res)) return;
20653         void* _res_ptr = untag_ptr(_res);
20654         CHECK_ACCESS(_res_ptr);
20655         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
20656         FREE(untag_ptr(_res));
20657         CResult_PongDecodeErrorZ_free(_res_conv);
20658 }
20659
20660 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
20661         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
20662         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
20663         return tag_ptr(ret_conv, true);
20664 }
20665 int64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone_ptr"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint64_t arg) {
20666         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
20667         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
20668         return ret_conv;
20669 }
20670
20671 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone"))) TS_CResult_PongDecodeErrorZ_clone(uint64_t orig) {
20672         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
20673         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
20674         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
20675         return tag_ptr(ret_conv, true);
20676 }
20677
20678 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
20679         LDKUnsignedChannelAnnouncement o_conv;
20680         o_conv.inner = untag_ptr(o);
20681         o_conv.is_owned = ptr_is_owned(o);
20682         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20683         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
20684         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
20685         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
20686         return tag_ptr(ret_conv, true);
20687 }
20688
20689 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
20690         void* e_ptr = untag_ptr(e);
20691         CHECK_ACCESS(e_ptr);
20692         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20693         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20694         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
20695         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
20696         return tag_ptr(ret_conv, true);
20697 }
20698
20699 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
20700         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
20701         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
20702         return ret_conv;
20703 }
20704
20705 void  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
20706         if (!ptr_is_owned(_res)) return;
20707         void* _res_ptr = untag_ptr(_res);
20708         CHECK_ACCESS(_res_ptr);
20709         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
20710         FREE(untag_ptr(_res));
20711         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
20712 }
20713
20714 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
20715         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
20716         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
20717         return tag_ptr(ret_conv, true);
20718 }
20719 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
20720         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
20721         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
20722         return ret_conv;
20723 }
20724
20725 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
20726         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
20727         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
20728         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
20729         return tag_ptr(ret_conv, true);
20730 }
20731
20732 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
20733         LDKChannelAnnouncement o_conv;
20734         o_conv.inner = untag_ptr(o);
20735         o_conv.is_owned = ptr_is_owned(o);
20736         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20737         o_conv = ChannelAnnouncement_clone(&o_conv);
20738         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
20739         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
20740         return tag_ptr(ret_conv, true);
20741 }
20742
20743 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
20744         void* e_ptr = untag_ptr(e);
20745         CHECK_ACCESS(e_ptr);
20746         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20747         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20748         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
20749         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
20750         return tag_ptr(ret_conv, true);
20751 }
20752
20753 jboolean  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
20754         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
20755         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
20756         return ret_conv;
20757 }
20758
20759 void  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
20760         if (!ptr_is_owned(_res)) return;
20761         void* _res_ptr = untag_ptr(_res);
20762         CHECK_ACCESS(_res_ptr);
20763         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
20764         FREE(untag_ptr(_res));
20765         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
20766 }
20767
20768 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
20769         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
20770         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
20771         return tag_ptr(ret_conv, true);
20772 }
20773 int64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
20774         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
20775         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
20776         return ret_conv;
20777 }
20778
20779 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
20780         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
20781         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
20782         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
20783         return tag_ptr(ret_conv, true);
20784 }
20785
20786 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint64_t o) {
20787         LDKUnsignedChannelUpdate o_conv;
20788         o_conv.inner = untag_ptr(o);
20789         o_conv.is_owned = ptr_is_owned(o);
20790         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20791         o_conv = UnsignedChannelUpdate_clone(&o_conv);
20792         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20793         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
20794         return tag_ptr(ret_conv, true);
20795 }
20796
20797 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint64_t e) {
20798         void* e_ptr = untag_ptr(e);
20799         CHECK_ACCESS(e_ptr);
20800         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20801         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20802         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20803         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
20804         return tag_ptr(ret_conv, true);
20805 }
20806
20807 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
20808         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
20809         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
20810         return ret_conv;
20811 }
20812
20813 void  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint64_t _res) {
20814         if (!ptr_is_owned(_res)) return;
20815         void* _res_ptr = untag_ptr(_res);
20816         CHECK_ACCESS(_res_ptr);
20817         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
20818         FREE(untag_ptr(_res));
20819         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
20820 }
20821
20822 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
20823         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20824         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
20825         return tag_ptr(ret_conv, true);
20826 }
20827 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
20828         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
20829         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
20830         return ret_conv;
20831 }
20832
20833 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
20834         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
20835         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20836         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
20837         return tag_ptr(ret_conv, true);
20838 }
20839
20840 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint64_t o) {
20841         LDKChannelUpdate o_conv;
20842         o_conv.inner = untag_ptr(o);
20843         o_conv.is_owned = ptr_is_owned(o);
20844         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20845         o_conv = ChannelUpdate_clone(&o_conv);
20846         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20847         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
20848         return tag_ptr(ret_conv, true);
20849 }
20850
20851 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint64_t e) {
20852         void* e_ptr = untag_ptr(e);
20853         CHECK_ACCESS(e_ptr);
20854         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20855         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20856         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20857         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
20858         return tag_ptr(ret_conv, true);
20859 }
20860
20861 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
20862         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
20863         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
20864         return ret_conv;
20865 }
20866
20867 void  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_free"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint64_t _res) {
20868         if (!ptr_is_owned(_res)) return;
20869         void* _res_ptr = untag_ptr(_res);
20870         CHECK_ACCESS(_res_ptr);
20871         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
20872         FREE(untag_ptr(_res));
20873         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
20874 }
20875
20876 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
20877         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20878         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
20879         return tag_ptr(ret_conv, true);
20880 }
20881 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
20882         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
20883         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
20884         return ret_conv;
20885 }
20886
20887 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
20888         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
20889         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20890         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
20891         return tag_ptr(ret_conv, true);
20892 }
20893
20894 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint64_t o) {
20895         LDKErrorMessage o_conv;
20896         o_conv.inner = untag_ptr(o);
20897         o_conv.is_owned = ptr_is_owned(o);
20898         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20899         o_conv = ErrorMessage_clone(&o_conv);
20900         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20901         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
20902         return tag_ptr(ret_conv, true);
20903 }
20904
20905 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_err"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint64_t e) {
20906         void* e_ptr = untag_ptr(e);
20907         CHECK_ACCESS(e_ptr);
20908         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20909         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20910         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20911         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
20912         return tag_ptr(ret_conv, true);
20913 }
20914
20915 jboolean  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_is_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint64_t o) {
20916         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
20917         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
20918         return ret_conv;
20919 }
20920
20921 void  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_free"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint64_t _res) {
20922         if (!ptr_is_owned(_res)) return;
20923         void* _res_ptr = untag_ptr(_res);
20924         CHECK_ACCESS(_res_ptr);
20925         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
20926         FREE(untag_ptr(_res));
20927         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
20928 }
20929
20930 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
20931         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20932         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
20933         return tag_ptr(ret_conv, true);
20934 }
20935 int64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
20936         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
20937         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
20938         return ret_conv;
20939 }
20940
20941 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint64_t orig) {
20942         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
20943         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20944         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
20945         return tag_ptr(ret_conv, true);
20946 }
20947
20948 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_ok"))) TS_CResult_WarningMessageDecodeErrorZ_ok(uint64_t o) {
20949         LDKWarningMessage o_conv;
20950         o_conv.inner = untag_ptr(o);
20951         o_conv.is_owned = ptr_is_owned(o);
20952         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20953         o_conv = WarningMessage_clone(&o_conv);
20954         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
20955         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
20956         return tag_ptr(ret_conv, true);
20957 }
20958
20959 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_err"))) TS_CResult_WarningMessageDecodeErrorZ_err(uint64_t e) {
20960         void* e_ptr = untag_ptr(e);
20961         CHECK_ACCESS(e_ptr);
20962         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20963         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20964         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
20965         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
20966         return tag_ptr(ret_conv, true);
20967 }
20968
20969 jboolean  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_is_ok"))) TS_CResult_WarningMessageDecodeErrorZ_is_ok(uint64_t o) {
20970         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
20971         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
20972         return ret_conv;
20973 }
20974
20975 void  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_free"))) TS_CResult_WarningMessageDecodeErrorZ_free(uint64_t _res) {
20976         if (!ptr_is_owned(_res)) return;
20977         void* _res_ptr = untag_ptr(_res);
20978         CHECK_ACCESS(_res_ptr);
20979         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
20980         FREE(untag_ptr(_res));
20981         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
20982 }
20983
20984 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
20985         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
20986         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
20987         return tag_ptr(ret_conv, true);
20988 }
20989 int64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone_ptr"))) TS_CResult_WarningMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
20990         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
20991         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
20992         return ret_conv;
20993 }
20994
20995 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone"))) TS_CResult_WarningMessageDecodeErrorZ_clone(uint64_t orig) {
20996         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
20997         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
20998         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
20999         return tag_ptr(ret_conv, true);
21000 }
21001
21002 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
21003         LDKUnsignedNodeAnnouncement o_conv;
21004         o_conv.inner = untag_ptr(o);
21005         o_conv.is_owned = ptr_is_owned(o);
21006         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21007         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
21008         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21009         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
21010         return tag_ptr(ret_conv, true);
21011 }
21012
21013 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint64_t e) {
21014         void* e_ptr = untag_ptr(e);
21015         CHECK_ACCESS(e_ptr);
21016         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21017         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21018         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21019         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
21020         return tag_ptr(ret_conv, true);
21021 }
21022
21023 jboolean  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
21024         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
21025         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
21026         return ret_conv;
21027 }
21028
21029 void  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
21030         if (!ptr_is_owned(_res)) return;
21031         void* _res_ptr = untag_ptr(_res);
21032         CHECK_ACCESS(_res_ptr);
21033         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
21034         FREE(untag_ptr(_res));
21035         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
21036 }
21037
21038 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
21039         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21040         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
21041         return tag_ptr(ret_conv, true);
21042 }
21043 int64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
21044         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
21045         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
21046         return ret_conv;
21047 }
21048
21049 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
21050         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
21051         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21052         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
21053         return tag_ptr(ret_conv, true);
21054 }
21055
21056 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
21057         LDKNodeAnnouncement o_conv;
21058         o_conv.inner = untag_ptr(o);
21059         o_conv.is_owned = ptr_is_owned(o);
21060         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21061         o_conv = NodeAnnouncement_clone(&o_conv);
21062         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21063         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
21064         return tag_ptr(ret_conv, true);
21065 }
21066
21067 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint64_t e) {
21068         void* e_ptr = untag_ptr(e);
21069         CHECK_ACCESS(e_ptr);
21070         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21071         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21072         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21073         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
21074         return tag_ptr(ret_conv, true);
21075 }
21076
21077 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
21078         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
21079         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
21080         return ret_conv;
21081 }
21082
21083 void  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
21084         if (!ptr_is_owned(_res)) return;
21085         void* _res_ptr = untag_ptr(_res);
21086         CHECK_ACCESS(_res_ptr);
21087         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
21088         FREE(untag_ptr(_res));
21089         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
21090 }
21091
21092 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
21093         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21094         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
21095         return tag_ptr(ret_conv, true);
21096 }
21097 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
21098         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
21099         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
21100         return ret_conv;
21101 }
21102
21103 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
21104         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
21105         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21106         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
21107         return tag_ptr(ret_conv, true);
21108 }
21109
21110 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint64_t o) {
21111         LDKQueryShortChannelIds o_conv;
21112         o_conv.inner = untag_ptr(o);
21113         o_conv.is_owned = ptr_is_owned(o);
21114         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21115         o_conv = QueryShortChannelIds_clone(&o_conv);
21116         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21117         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
21118         return tag_ptr(ret_conv, true);
21119 }
21120
21121 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint64_t e) {
21122         void* e_ptr = untag_ptr(e);
21123         CHECK_ACCESS(e_ptr);
21124         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21125         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21126         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21127         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
21128         return tag_ptr(ret_conv, true);
21129 }
21130
21131 jboolean  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint64_t o) {
21132         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
21133         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
21134         return ret_conv;
21135 }
21136
21137 void  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_free"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint64_t _res) {
21138         if (!ptr_is_owned(_res)) return;
21139         void* _res_ptr = untag_ptr(_res);
21140         CHECK_ACCESS(_res_ptr);
21141         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
21142         FREE(untag_ptr(_res));
21143         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
21144 }
21145
21146 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
21147         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21148         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
21149         return tag_ptr(ret_conv, true);
21150 }
21151 int64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint64_t arg) {
21152         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
21153         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
21154         return ret_conv;
21155 }
21156
21157 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint64_t orig) {
21158         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
21159         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21160         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
21161         return tag_ptr(ret_conv, true);
21162 }
21163
21164 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint64_t o) {
21165         LDKReplyShortChannelIdsEnd o_conv;
21166         o_conv.inner = untag_ptr(o);
21167         o_conv.is_owned = ptr_is_owned(o);
21168         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21169         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
21170         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21171         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
21172         return tag_ptr(ret_conv, true);
21173 }
21174
21175 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint64_t e) {
21176         void* e_ptr = untag_ptr(e);
21177         CHECK_ACCESS(e_ptr);
21178         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21179         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21180         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21181         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
21182         return tag_ptr(ret_conv, true);
21183 }
21184
21185 jboolean  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint64_t o) {
21186         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
21187         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
21188         return ret_conv;
21189 }
21190
21191 void  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint64_t _res) {
21192         if (!ptr_is_owned(_res)) return;
21193         void* _res_ptr = untag_ptr(_res);
21194         CHECK_ACCESS(_res_ptr);
21195         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
21196         FREE(untag_ptr(_res));
21197         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
21198 }
21199
21200 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
21201         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21202         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
21203         return tag_ptr(ret_conv, true);
21204 }
21205 int64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint64_t arg) {
21206         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
21207         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
21208         return ret_conv;
21209 }
21210
21211 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint64_t orig) {
21212         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
21213         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21214         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
21215         return tag_ptr(ret_conv, true);
21216 }
21217
21218 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint64_t o) {
21219         LDKQueryChannelRange o_conv;
21220         o_conv.inner = untag_ptr(o);
21221         o_conv.is_owned = ptr_is_owned(o);
21222         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21223         o_conv = QueryChannelRange_clone(&o_conv);
21224         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21225         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
21226         return tag_ptr(ret_conv, true);
21227 }
21228
21229 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint64_t e) {
21230         void* e_ptr = untag_ptr(e);
21231         CHECK_ACCESS(e_ptr);
21232         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21233         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21234         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21235         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
21236         return tag_ptr(ret_conv, true);
21237 }
21238
21239 jboolean  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
21240         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
21241         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
21242         return ret_conv;
21243 }
21244
21245 void  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_free"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint64_t _res) {
21246         if (!ptr_is_owned(_res)) return;
21247         void* _res_ptr = untag_ptr(_res);
21248         CHECK_ACCESS(_res_ptr);
21249         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
21250         FREE(untag_ptr(_res));
21251         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
21252 }
21253
21254 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
21255         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21256         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
21257         return tag_ptr(ret_conv, true);
21258 }
21259 int64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
21260         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
21261         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
21262         return ret_conv;
21263 }
21264
21265 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint64_t orig) {
21266         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
21267         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21268         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
21269         return tag_ptr(ret_conv, true);
21270 }
21271
21272 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint64_t o) {
21273         LDKReplyChannelRange o_conv;
21274         o_conv.inner = untag_ptr(o);
21275         o_conv.is_owned = ptr_is_owned(o);
21276         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21277         o_conv = ReplyChannelRange_clone(&o_conv);
21278         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21279         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
21280         return tag_ptr(ret_conv, true);
21281 }
21282
21283 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint64_t e) {
21284         void* e_ptr = untag_ptr(e);
21285         CHECK_ACCESS(e_ptr);
21286         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21287         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21288         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21289         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
21290         return tag_ptr(ret_conv, true);
21291 }
21292
21293 jboolean  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
21294         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
21295         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
21296         return ret_conv;
21297 }
21298
21299 void  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_free"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint64_t _res) {
21300         if (!ptr_is_owned(_res)) return;
21301         void* _res_ptr = untag_ptr(_res);
21302         CHECK_ACCESS(_res_ptr);
21303         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
21304         FREE(untag_ptr(_res));
21305         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
21306 }
21307
21308 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
21309         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21310         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
21311         return tag_ptr(ret_conv, true);
21312 }
21313 int64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
21314         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
21315         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
21316         return ret_conv;
21317 }
21318
21319 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint64_t orig) {
21320         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
21321         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21322         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
21323         return tag_ptr(ret_conv, true);
21324 }
21325
21326 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint64_t o) {
21327         LDKGossipTimestampFilter o_conv;
21328         o_conv.inner = untag_ptr(o);
21329         o_conv.is_owned = ptr_is_owned(o);
21330         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21331         o_conv = GossipTimestampFilter_clone(&o_conv);
21332         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21333         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
21334         return tag_ptr(ret_conv, true);
21335 }
21336
21337 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint64_t e) {
21338         void* e_ptr = untag_ptr(e);
21339         CHECK_ACCESS(e_ptr);
21340         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21341         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21342         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21343         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
21344         return tag_ptr(ret_conv, true);
21345 }
21346
21347 jboolean  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint64_t o) {
21348         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
21349         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
21350         return ret_conv;
21351 }
21352
21353 void  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_free"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint64_t _res) {
21354         if (!ptr_is_owned(_res)) return;
21355         void* _res_ptr = untag_ptr(_res);
21356         CHECK_ACCESS(_res_ptr);
21357         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
21358         FREE(untag_ptr(_res));
21359         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
21360 }
21361
21362 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
21363         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21364         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
21365         return tag_ptr(ret_conv, true);
21366 }
21367 int64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint64_t arg) {
21368         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
21369         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
21370         return ret_conv;
21371 }
21372
21373 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint64_t orig) {
21374         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
21375         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21376         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
21377         return tag_ptr(ret_conv, true);
21378 }
21379
21380 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint64_t o) {
21381         LDKInvoice o_conv;
21382         o_conv.inner = untag_ptr(o);
21383         o_conv.is_owned = ptr_is_owned(o);
21384         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21385         o_conv = Invoice_clone(&o_conv);
21386         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
21387         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
21388         return tag_ptr(ret_conv, true);
21389 }
21390
21391 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint64_t e) {
21392         void* e_ptr = untag_ptr(e);
21393         CHECK_ACCESS(e_ptr);
21394         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
21395         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
21396         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
21397         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
21398         return tag_ptr(ret_conv, true);
21399 }
21400
21401 jboolean  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_is_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_is_ok(uint64_t o) {
21402         LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(o);
21403         jboolean ret_conv = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
21404         return ret_conv;
21405 }
21406
21407 void  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_free"))) TS_CResult_InvoiceSignOrCreationErrorZ_free(uint64_t _res) {
21408         if (!ptr_is_owned(_res)) return;
21409         void* _res_ptr = untag_ptr(_res);
21410         CHECK_ACCESS(_res_ptr);
21411         LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
21412         FREE(untag_ptr(_res));
21413         CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
21414 }
21415
21416 static inline uint64_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
21417         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
21418         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
21419         return tag_ptr(ret_conv, true);
21420 }
21421 int64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr(uint64_t arg) {
21422         LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
21423         int64_t ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
21424         return ret_conv;
21425 }
21426
21427 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone(uint64_t orig) {
21428         LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
21429         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
21430         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
21431         return tag_ptr(ret_conv, true);
21432 }
21433
21434 uint64_t  __attribute__((export_name("TS_COption_FilterZ_some"))) TS_COption_FilterZ_some(uint64_t o) {
21435         void* o_ptr = untag_ptr(o);
21436         CHECK_ACCESS(o_ptr);
21437         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
21438         if (o_conv.free == LDKFilter_JCalls_free) {
21439                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21440                 LDKFilter_JCalls_cloned(&o_conv);
21441         }
21442         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
21443         *ret_copy = COption_FilterZ_some(o_conv);
21444         uint64_t ret_ref = tag_ptr(ret_copy, true);
21445         return ret_ref;
21446 }
21447
21448 uint64_t  __attribute__((export_name("TS_COption_FilterZ_none"))) TS_COption_FilterZ_none() {
21449         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
21450         *ret_copy = COption_FilterZ_none();
21451         uint64_t ret_ref = tag_ptr(ret_copy, true);
21452         return ret_ref;
21453 }
21454
21455 void  __attribute__((export_name("TS_COption_FilterZ_free"))) TS_COption_FilterZ_free(uint64_t _res) {
21456         if (!ptr_is_owned(_res)) return;
21457         void* _res_ptr = untag_ptr(_res);
21458         CHECK_ACCESS(_res_ptr);
21459         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
21460         FREE(untag_ptr(_res));
21461         COption_FilterZ_free(_res_conv);
21462 }
21463
21464 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_ok"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint64_t o) {
21465         LDKLockedChannelMonitor o_conv;
21466         o_conv.inner = untag_ptr(o);
21467         o_conv.is_owned = ptr_is_owned(o);
21468         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21469         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
21470         
21471         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
21472         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
21473         return tag_ptr(ret_conv, true);
21474 }
21475
21476 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_err"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
21477         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
21478         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
21479         return tag_ptr(ret_conv, true);
21480 }
21481
21482 jboolean  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_is_ok"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint64_t o) {
21483         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
21484         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
21485         return ret_conv;
21486 }
21487
21488 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_free"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint64_t _res) {
21489         if (!ptr_is_owned(_res)) return;
21490         void* _res_ptr = untag_ptr(_res);
21491         CHECK_ACCESS(_res_ptr);
21492         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
21493         FREE(untag_ptr(_res));
21494         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
21495 }
21496
21497 void  __attribute__((export_name("TS_CVec_OutPointZ_free"))) TS_CVec_OutPointZ_free(uint64_tArray _res) {
21498         LDKCVec_OutPointZ _res_constr;
21499         _res_constr.datalen = _res->arr_len;
21500         if (_res_constr.datalen > 0)
21501                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
21502         else
21503                 _res_constr.data = NULL;
21504         uint64_t* _res_vals = _res->elems;
21505         for (size_t k = 0; k < _res_constr.datalen; k++) {
21506                 uint64_t _res_conv_10 = _res_vals[k];
21507                 LDKOutPoint _res_conv_10_conv;
21508                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
21509                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
21510                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
21511                 _res_constr.data[k] = _res_conv_10_conv;
21512         }
21513         FREE(_res);
21514         CVec_OutPointZ_free(_res_constr);
21515 }
21516
21517 void  __attribute__((export_name("TS_CVec_MonitorUpdateIdZ_free"))) TS_CVec_MonitorUpdateIdZ_free(uint64_tArray _res) {
21518         LDKCVec_MonitorUpdateIdZ _res_constr;
21519         _res_constr.datalen = _res->arr_len;
21520         if (_res_constr.datalen > 0)
21521                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
21522         else
21523                 _res_constr.data = NULL;
21524         uint64_t* _res_vals = _res->elems;
21525         for (size_t r = 0; r < _res_constr.datalen; r++) {
21526                 uint64_t _res_conv_17 = _res_vals[r];
21527                 LDKMonitorUpdateId _res_conv_17_conv;
21528                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
21529                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
21530                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
21531                 _res_constr.data[r] = _res_conv_17_conv;
21532         }
21533         FREE(_res);
21534         CVec_MonitorUpdateIdZ_free(_res_constr);
21535 }
21536
21537 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
21538         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
21539         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
21540         return tag_ptr(ret_conv, true);
21541 }
21542 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(uint64_t arg) {
21543         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
21544         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
21545         return ret_conv;
21546 }
21547
21548 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(uint64_t orig) {
21549         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
21550         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
21551         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
21552         return tag_ptr(ret_conv, true);
21553 }
21554
21555 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(uint64_t a, uint64_tArray b) {
21556         LDKOutPoint a_conv;
21557         a_conv.inner = untag_ptr(a);
21558         a_conv.is_owned = ptr_is_owned(a);
21559         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
21560         a_conv = OutPoint_clone(&a_conv);
21561         LDKCVec_MonitorUpdateIdZ b_constr;
21562         b_constr.datalen = b->arr_len;
21563         if (b_constr.datalen > 0)
21564                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
21565         else
21566                 b_constr.data = NULL;
21567         uint64_t* b_vals = b->elems;
21568         for (size_t r = 0; r < b_constr.datalen; r++) {
21569                 uint64_t b_conv_17 = b_vals[r];
21570                 LDKMonitorUpdateId b_conv_17_conv;
21571                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
21572                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
21573                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
21574                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
21575                 b_constr.data[r] = b_conv_17_conv;
21576         }
21577         FREE(b);
21578         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
21579         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
21580         return tag_ptr(ret_conv, true);
21581 }
21582
21583 void  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(uint64_t _res) {
21584         if (!ptr_is_owned(_res)) return;
21585         void* _res_ptr = untag_ptr(_res);
21586         CHECK_ACCESS(_res_ptr);
21587         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
21588         FREE(untag_ptr(_res));
21589         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
21590 }
21591
21592 void  __attribute__((export_name("TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free"))) TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(uint64_tArray _res) {
21593         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
21594         _res_constr.datalen = _res->arr_len;
21595         if (_res_constr.datalen > 0)
21596                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
21597         else
21598                 _res_constr.data = NULL;
21599         uint64_t* _res_vals = _res->elems;
21600         for (size_t p = 0; p < _res_constr.datalen; p++) {
21601                 uint64_t _res_conv_41 = _res_vals[p];
21602                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
21603                 CHECK_ACCESS(_res_conv_41_ptr);
21604                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
21605                 FREE(untag_ptr(_res_conv_41));
21606                 _res_constr.data[p] = _res_conv_41_conv;
21607         }
21608         FREE(_res);
21609         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
21610 }
21611
21612 void  __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint64_t this_ptr) {
21613         if (!ptr_is_owned(this_ptr)) return;
21614         void* this_ptr_ptr = untag_ptr(this_ptr);
21615         CHECK_ACCESS(this_ptr_ptr);
21616         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
21617         FREE(untag_ptr(this_ptr));
21618         PaymentPurpose_free(this_ptr_conv);
21619 }
21620
21621 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
21622         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
21623         *ret_copy = PaymentPurpose_clone(arg);
21624         uint64_t ret_ref = tag_ptr(ret_copy, true);
21625         return ret_ref;
21626 }
21627 int64_t  __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint64_t arg) {
21628         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
21629         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
21630         return ret_conv;
21631 }
21632
21633 uint64_t  __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint64_t orig) {
21634         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
21635         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
21636         *ret_copy = PaymentPurpose_clone(orig_conv);
21637         uint64_t ret_ref = tag_ptr(ret_copy, true);
21638         return ret_ref;
21639 }
21640
21641 uint64_t  __attribute__((export_name("TS_PaymentPurpose_invoice_payment"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret) {
21642         LDKThirtyTwoBytes payment_preimage_ref;
21643         CHECK(payment_preimage->arr_len == 32);
21644         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
21645         LDKThirtyTwoBytes payment_secret_ref;
21646         CHECK(payment_secret->arr_len == 32);
21647         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
21648         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
21649         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
21650         uint64_t ret_ref = tag_ptr(ret_copy, true);
21651         return ret_ref;
21652 }
21653
21654 uint64_t  __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
21655         LDKThirtyTwoBytes a_ref;
21656         CHECK(a->arr_len == 32);
21657         memcpy(a_ref.data, a->elems, 32); FREE(a);
21658         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
21659         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
21660         uint64_t ret_ref = tag_ptr(ret_copy, true);
21661         return ret_ref;
21662 }
21663
21664 int8_tArray  __attribute__((export_name("TS_PaymentPurpose_write"))) TS_PaymentPurpose_write(uint64_t obj) {
21665         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
21666         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
21667         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21668         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21669         CVec_u8Z_free(ret_var);
21670         return ret_arr;
21671 }
21672
21673 uint64_t  __attribute__((export_name("TS_PaymentPurpose_read"))) TS_PaymentPurpose_read(int8_tArray ser) {
21674         LDKu8slice ser_ref;
21675         ser_ref.datalen = ser->arr_len;
21676         ser_ref.data = ser->elems;
21677         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
21678         *ret_conv = PaymentPurpose_read(ser_ref);
21679         FREE(ser);
21680         return tag_ptr(ret_conv, true);
21681 }
21682
21683 void  __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint64_t this_ptr) {
21684         if (!ptr_is_owned(this_ptr)) return;
21685         void* this_ptr_ptr = untag_ptr(this_ptr);
21686         CHECK_ACCESS(this_ptr_ptr);
21687         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
21688         FREE(untag_ptr(this_ptr));
21689         ClosureReason_free(this_ptr_conv);
21690 }
21691
21692 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
21693         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
21694         *ret_copy = ClosureReason_clone(arg);
21695         uint64_t ret_ref = tag_ptr(ret_copy, true);
21696         return ret_ref;
21697 }
21698 int64_t  __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint64_t arg) {
21699         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
21700         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
21701         return ret_conv;
21702 }
21703
21704 uint64_t  __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint64_t orig) {
21705         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
21706         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
21707         *ret_copy = ClosureReason_clone(orig_conv);
21708         uint64_t ret_ref = tag_ptr(ret_copy, true);
21709         return ret_ref;
21710 }
21711
21712 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(jstring peer_msg) {
21713         LDKStr peer_msg_conv = str_ref_to_owned_c(peer_msg);
21714         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
21715         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
21716         uint64_t ret_ref = tag_ptr(ret_copy, true);
21717         return ret_ref;
21718 }
21719
21720 uint64_t  __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
21721         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
21722         *ret_copy = ClosureReason_holder_force_closed();
21723         uint64_t ret_ref = tag_ptr(ret_copy, true);
21724         return ret_ref;
21725 }
21726
21727 uint64_t  __attribute__((export_name("TS_ClosureReason_cooperative_closure"))) TS_ClosureReason_cooperative_closure() {
21728         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
21729         *ret_copy = ClosureReason_cooperative_closure();
21730         uint64_t ret_ref = tag_ptr(ret_copy, true);
21731         return ret_ref;
21732 }
21733
21734 uint64_t  __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
21735         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
21736         *ret_copy = ClosureReason_commitment_tx_confirmed();
21737         uint64_t ret_ref = tag_ptr(ret_copy, true);
21738         return ret_ref;
21739 }
21740
21741 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
21742         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
21743         *ret_copy = ClosureReason_funding_timed_out();
21744         uint64_t ret_ref = tag_ptr(ret_copy, true);
21745         return ret_ref;
21746 }
21747
21748 uint64_t  __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
21749         LDKStr err_conv = str_ref_to_owned_c(err);
21750         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
21751         *ret_copy = ClosureReason_processing_error(err_conv);
21752         uint64_t ret_ref = tag_ptr(ret_copy, true);
21753         return ret_ref;
21754 }
21755
21756 uint64_t  __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
21757         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
21758         *ret_copy = ClosureReason_disconnected_peer();
21759         uint64_t ret_ref = tag_ptr(ret_copy, true);
21760         return ret_ref;
21761 }
21762
21763 uint64_t  __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
21764         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
21765         *ret_copy = ClosureReason_outdated_channel_manager();
21766         uint64_t ret_ref = tag_ptr(ret_copy, true);
21767         return ret_ref;
21768 }
21769
21770 jboolean  __attribute__((export_name("TS_ClosureReason_eq"))) TS_ClosureReason_eq(uint64_t a, uint64_t b) {
21771         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
21772         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
21773         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
21774         return ret_conv;
21775 }
21776
21777 int8_tArray  __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint64_t obj) {
21778         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
21779         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
21780         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21781         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21782         CVec_u8Z_free(ret_var);
21783         return ret_arr;
21784 }
21785
21786 uint64_t  __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
21787         LDKu8slice ser_ref;
21788         ser_ref.datalen = ser->arr_len;
21789         ser_ref.data = ser->elems;
21790         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
21791         *ret_conv = ClosureReason_read(ser_ref);
21792         FREE(ser);
21793         return tag_ptr(ret_conv, true);
21794 }
21795
21796 void  __attribute__((export_name("TS_HTLCDestination_free"))) TS_HTLCDestination_free(uint64_t this_ptr) {
21797         if (!ptr_is_owned(this_ptr)) return;
21798         void* this_ptr_ptr = untag_ptr(this_ptr);
21799         CHECK_ACCESS(this_ptr_ptr);
21800         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
21801         FREE(untag_ptr(this_ptr));
21802         HTLCDestination_free(this_ptr_conv);
21803 }
21804
21805 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
21806         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
21807         *ret_copy = HTLCDestination_clone(arg);
21808         uint64_t ret_ref = tag_ptr(ret_copy, true);
21809         return ret_ref;
21810 }
21811 int64_t  __attribute__((export_name("TS_HTLCDestination_clone_ptr"))) TS_HTLCDestination_clone_ptr(uint64_t arg) {
21812         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
21813         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
21814         return ret_conv;
21815 }
21816
21817 uint64_t  __attribute__((export_name("TS_HTLCDestination_clone"))) TS_HTLCDestination_clone(uint64_t orig) {
21818         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
21819         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
21820         *ret_copy = HTLCDestination_clone(orig_conv);
21821         uint64_t ret_ref = tag_ptr(ret_copy, true);
21822         return ret_ref;
21823 }
21824
21825 uint64_t  __attribute__((export_name("TS_HTLCDestination_next_hop_channel"))) TS_HTLCDestination_next_hop_channel(int8_tArray node_id, int8_tArray channel_id) {
21826         LDKPublicKey node_id_ref;
21827         CHECK(node_id->arr_len == 33);
21828         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21829         LDKThirtyTwoBytes channel_id_ref;
21830         CHECK(channel_id->arr_len == 32);
21831         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
21832         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
21833         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
21834         uint64_t ret_ref = tag_ptr(ret_copy, true);
21835         return ret_ref;
21836 }
21837
21838 uint64_t  __attribute__((export_name("TS_HTLCDestination_unknown_next_hop"))) TS_HTLCDestination_unknown_next_hop(int64_t requested_forward_scid) {
21839         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
21840         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
21841         uint64_t ret_ref = tag_ptr(ret_copy, true);
21842         return ret_ref;
21843 }
21844
21845 uint64_t  __attribute__((export_name("TS_HTLCDestination_invalid_forward"))) TS_HTLCDestination_invalid_forward(int64_t requested_forward_scid) {
21846         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
21847         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
21848         uint64_t ret_ref = tag_ptr(ret_copy, true);
21849         return ret_ref;
21850 }
21851
21852 uint64_t  __attribute__((export_name("TS_HTLCDestination_failed_payment"))) TS_HTLCDestination_failed_payment(int8_tArray payment_hash) {
21853         LDKThirtyTwoBytes payment_hash_ref;
21854         CHECK(payment_hash->arr_len == 32);
21855         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21856         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
21857         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
21858         uint64_t ret_ref = tag_ptr(ret_copy, true);
21859         return ret_ref;
21860 }
21861
21862 jboolean  __attribute__((export_name("TS_HTLCDestination_eq"))) TS_HTLCDestination_eq(uint64_t a, uint64_t b) {
21863         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
21864         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
21865         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
21866         return ret_conv;
21867 }
21868
21869 int8_tArray  __attribute__((export_name("TS_HTLCDestination_write"))) TS_HTLCDestination_write(uint64_t obj) {
21870         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
21871         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
21872         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21873         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21874         CVec_u8Z_free(ret_var);
21875         return ret_arr;
21876 }
21877
21878 uint64_t  __attribute__((export_name("TS_HTLCDestination_read"))) TS_HTLCDestination_read(int8_tArray ser) {
21879         LDKu8slice ser_ref;
21880         ser_ref.datalen = ser->arr_len;
21881         ser_ref.data = ser->elems;
21882         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
21883         *ret_conv = HTLCDestination_read(ser_ref);
21884         FREE(ser);
21885         return tag_ptr(ret_conv, true);
21886 }
21887
21888 void  __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint64_t this_ptr) {
21889         if (!ptr_is_owned(this_ptr)) return;
21890         void* this_ptr_ptr = untag_ptr(this_ptr);
21891         CHECK_ACCESS(this_ptr_ptr);
21892         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
21893         FREE(untag_ptr(this_ptr));
21894         Event_free(this_ptr_conv);
21895 }
21896
21897 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
21898         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21899         *ret_copy = Event_clone(arg);
21900         uint64_t ret_ref = tag_ptr(ret_copy, true);
21901         return ret_ref;
21902 }
21903 int64_t  __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint64_t arg) {
21904         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
21905         int64_t ret_conv = Event_clone_ptr(arg_conv);
21906         return ret_conv;
21907 }
21908
21909 uint64_t  __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint64_t orig) {
21910         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
21911         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21912         *ret_copy = Event_clone(orig_conv);
21913         uint64_t ret_ref = tag_ptr(ret_copy, true);
21914         return ret_ref;
21915 }
21916
21917 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) {
21918         LDKThirtyTwoBytes temporary_channel_id_ref;
21919         CHECK(temporary_channel_id->arr_len == 32);
21920         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
21921         LDKPublicKey counterparty_node_id_ref;
21922         CHECK(counterparty_node_id->arr_len == 33);
21923         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
21924         LDKCVec_u8Z output_script_ref;
21925         output_script_ref.datalen = output_script->arr_len;
21926         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
21927         memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
21928         LDKU128 user_channel_id_ref;
21929         CHECK(user_channel_id->arr_len == 16);
21930         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
21931         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21932         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
21933         uint64_t ret_ref = tag_ptr(ret_copy, true);
21934         return ret_ref;
21935 }
21936
21937 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) {
21938         LDKPublicKey receiver_node_id_ref;
21939         CHECK(receiver_node_id->arr_len == 33);
21940         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
21941         LDKThirtyTwoBytes payment_hash_ref;
21942         CHECK(payment_hash->arr_len == 32);
21943         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21944         void* purpose_ptr = untag_ptr(purpose);
21945         CHECK_ACCESS(purpose_ptr);
21946         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
21947         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
21948         LDKThirtyTwoBytes via_channel_id_ref;
21949         CHECK(via_channel_id->arr_len == 32);
21950         memcpy(via_channel_id_ref.data, via_channel_id->elems, 32); FREE(via_channel_id);
21951         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
21952         CHECK_ACCESS(via_user_channel_id_ptr);
21953         LDKCOption_u128Z via_user_channel_id_conv = *(LDKCOption_u128Z*)(via_user_channel_id_ptr);
21954         via_user_channel_id_conv = COption_u128Z_clone((LDKCOption_u128Z*)untag_ptr(via_user_channel_id));
21955         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21956         *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);
21957         uint64_t ret_ref = tag_ptr(ret_copy, true);
21958         return ret_ref;
21959 }
21960
21961 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) {
21962         LDKPublicKey receiver_node_id_ref;
21963         CHECK(receiver_node_id->arr_len == 33);
21964         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
21965         LDKThirtyTwoBytes payment_hash_ref;
21966         CHECK(payment_hash->arr_len == 32);
21967         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21968         void* purpose_ptr = untag_ptr(purpose);
21969         CHECK_ACCESS(purpose_ptr);
21970         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
21971         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
21972         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21973         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv);
21974         uint64_t ret_ref = tag_ptr(ret_copy, true);
21975         return ret_ref;
21976 }
21977
21978 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) {
21979         LDKThirtyTwoBytes payment_id_ref;
21980         CHECK(payment_id->arr_len == 32);
21981         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
21982         LDKThirtyTwoBytes payment_preimage_ref;
21983         CHECK(payment_preimage->arr_len == 32);
21984         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
21985         LDKThirtyTwoBytes payment_hash_ref;
21986         CHECK(payment_hash->arr_len == 32);
21987         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21988         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
21989         CHECK_ACCESS(fee_paid_msat_ptr);
21990         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
21991         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
21992         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21993         *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
21994         uint64_t ret_ref = tag_ptr(ret_copy, true);
21995         return ret_ref;
21996 }
21997
21998 uint64_t  __attribute__((export_name("TS_Event_payment_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash) {
21999         LDKThirtyTwoBytes payment_id_ref;
22000         CHECK(payment_id->arr_len == 32);
22001         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
22002         LDKThirtyTwoBytes payment_hash_ref;
22003         CHECK(payment_hash->arr_len == 32);
22004         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
22005         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22006         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
22007         uint64_t ret_ref = tag_ptr(ret_copy, true);
22008         return ret_ref;
22009 }
22010
22011 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) {
22012         LDKThirtyTwoBytes payment_id_ref;
22013         CHECK(payment_id->arr_len == 32);
22014         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
22015         LDKThirtyTwoBytes payment_hash_ref;
22016         CHECK(payment_hash->arr_len == 32);
22017         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
22018         LDKCVec_RouteHopZ path_constr;
22019         path_constr.datalen = path->arr_len;
22020         if (path_constr.datalen > 0)
22021                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
22022         else
22023                 path_constr.data = NULL;
22024         uint64_t* path_vals = path->elems;
22025         for (size_t k = 0; k < path_constr.datalen; k++) {
22026                 uint64_t path_conv_10 = path_vals[k];
22027                 LDKRouteHop path_conv_10_conv;
22028                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
22029                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
22030                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
22031                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
22032                 path_constr.data[k] = path_conv_10_conv;
22033         }
22034         FREE(path);
22035         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22036         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
22037         uint64_t ret_ref = tag_ptr(ret_copy, true);
22038         return ret_ref;
22039 }
22040
22041 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) {
22042         LDKThirtyTwoBytes payment_id_ref;
22043         CHECK(payment_id->arr_len == 32);
22044         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
22045         LDKThirtyTwoBytes payment_hash_ref;
22046         CHECK(payment_hash->arr_len == 32);
22047         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
22048         void* network_update_ptr = untag_ptr(network_update);
22049         CHECK_ACCESS(network_update_ptr);
22050         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
22051         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
22052         LDKCVec_RouteHopZ path_constr;
22053         path_constr.datalen = path->arr_len;
22054         if (path_constr.datalen > 0)
22055                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
22056         else
22057                 path_constr.data = NULL;
22058         uint64_t* path_vals = path->elems;
22059         for (size_t k = 0; k < path_constr.datalen; k++) {
22060                 uint64_t path_conv_10 = path_vals[k];
22061                 LDKRouteHop path_conv_10_conv;
22062                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
22063                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
22064                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
22065                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
22066                 path_constr.data[k] = path_conv_10_conv;
22067         }
22068         FREE(path);
22069         void* short_channel_id_ptr = untag_ptr(short_channel_id);
22070         CHECK_ACCESS(short_channel_id_ptr);
22071         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
22072         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
22073         LDKRouteParameters retry_conv;
22074         retry_conv.inner = untag_ptr(retry);
22075         retry_conv.is_owned = ptr_is_owned(retry);
22076         CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
22077         retry_conv = RouteParameters_clone(&retry_conv);
22078         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22079         *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);
22080         uint64_t ret_ref = tag_ptr(ret_copy, true);
22081         return ret_ref;
22082 }
22083
22084 uint64_t  __attribute__((export_name("TS_Event_probe_successful"))) TS_Event_probe_successful(int8_tArray payment_id, int8_tArray payment_hash, uint64_tArray path) {
22085         LDKThirtyTwoBytes payment_id_ref;
22086         CHECK(payment_id->arr_len == 32);
22087         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
22088         LDKThirtyTwoBytes payment_hash_ref;
22089         CHECK(payment_hash->arr_len == 32);
22090         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
22091         LDKCVec_RouteHopZ path_constr;
22092         path_constr.datalen = path->arr_len;
22093         if (path_constr.datalen > 0)
22094                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
22095         else
22096                 path_constr.data = NULL;
22097         uint64_t* path_vals = path->elems;
22098         for (size_t k = 0; k < path_constr.datalen; k++) {
22099                 uint64_t path_conv_10 = path_vals[k];
22100                 LDKRouteHop path_conv_10_conv;
22101                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
22102                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
22103                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
22104                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
22105                 path_constr.data[k] = path_conv_10_conv;
22106         }
22107         FREE(path);
22108         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22109         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_constr);
22110         uint64_t ret_ref = tag_ptr(ret_copy, true);
22111         return ret_ref;
22112 }
22113
22114 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) {
22115         LDKThirtyTwoBytes payment_id_ref;
22116         CHECK(payment_id->arr_len == 32);
22117         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
22118         LDKThirtyTwoBytes payment_hash_ref;
22119         CHECK(payment_hash->arr_len == 32);
22120         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
22121         LDKCVec_RouteHopZ path_constr;
22122         path_constr.datalen = path->arr_len;
22123         if (path_constr.datalen > 0)
22124                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
22125         else
22126                 path_constr.data = NULL;
22127         uint64_t* path_vals = path->elems;
22128         for (size_t k = 0; k < path_constr.datalen; k++) {
22129                 uint64_t path_conv_10 = path_vals[k];
22130                 LDKRouteHop path_conv_10_conv;
22131                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
22132                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
22133                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
22134                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
22135                 path_constr.data[k] = path_conv_10_conv;
22136         }
22137         FREE(path);
22138         void* short_channel_id_ptr = untag_ptr(short_channel_id);
22139         CHECK_ACCESS(short_channel_id_ptr);
22140         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
22141         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
22142         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22143         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_constr, short_channel_id_conv);
22144         uint64_t ret_ref = tag_ptr(ret_copy, true);
22145         return ret_ref;
22146 }
22147
22148 uint64_t  __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
22149         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22150         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
22151         uint64_t ret_ref = tag_ptr(ret_copy, true);
22152         return ret_ref;
22153 }
22154
22155 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) {
22156         LDKThirtyTwoBytes intercept_id_ref;
22157         CHECK(intercept_id->arr_len == 32);
22158         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
22159         LDKThirtyTwoBytes payment_hash_ref;
22160         CHECK(payment_hash->arr_len == 32);
22161         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
22162         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22163         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
22164         uint64_t ret_ref = tag_ptr(ret_copy, true);
22165         return ret_ref;
22166 }
22167
22168 uint64_t  __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint64_tArray outputs) {
22169         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
22170         outputs_constr.datalen = outputs->arr_len;
22171         if (outputs_constr.datalen > 0)
22172                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
22173         else
22174                 outputs_constr.data = NULL;
22175         uint64_t* outputs_vals = outputs->elems;
22176         for (size_t b = 0; b < outputs_constr.datalen; b++) {
22177                 uint64_t outputs_conv_27 = outputs_vals[b];
22178                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
22179                 CHECK_ACCESS(outputs_conv_27_ptr);
22180                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
22181                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
22182                 outputs_constr.data[b] = outputs_conv_27_conv;
22183         }
22184         FREE(outputs);
22185         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22186         *ret_copy = Event_spendable_outputs(outputs_constr);
22187         uint64_t ret_ref = tag_ptr(ret_copy, true);
22188         return ret_ref;
22189 }
22190
22191 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) {
22192         LDKThirtyTwoBytes prev_channel_id_ref;
22193         CHECK(prev_channel_id->arr_len == 32);
22194         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
22195         LDKThirtyTwoBytes next_channel_id_ref;
22196         CHECK(next_channel_id->arr_len == 32);
22197         memcpy(next_channel_id_ref.data, next_channel_id->elems, 32); FREE(next_channel_id);
22198         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
22199         CHECK_ACCESS(fee_earned_msat_ptr);
22200         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
22201         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
22202         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22203         *ret_copy = Event_payment_forwarded(prev_channel_id_ref, next_channel_id_ref, fee_earned_msat_conv, claim_from_onchain_tx);
22204         uint64_t ret_ref = tag_ptr(ret_copy, true);
22205         return ret_ref;
22206 }
22207
22208 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) {
22209         LDKThirtyTwoBytes channel_id_ref;
22210         CHECK(channel_id->arr_len == 32);
22211         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
22212         LDKU128 user_channel_id_ref;
22213         CHECK(user_channel_id->arr_len == 16);
22214         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
22215         LDKPublicKey counterparty_node_id_ref;
22216         CHECK(counterparty_node_id->arr_len == 33);
22217         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
22218         LDKChannelTypeFeatures channel_type_conv;
22219         channel_type_conv.inner = untag_ptr(channel_type);
22220         channel_type_conv.is_owned = ptr_is_owned(channel_type);
22221         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
22222         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
22223         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22224         *ret_copy = Event_channel_ready(channel_id_ref, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
22225         uint64_t ret_ref = tag_ptr(ret_copy, true);
22226         return ret_ref;
22227 }
22228
22229 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) {
22230         LDKThirtyTwoBytes channel_id_ref;
22231         CHECK(channel_id->arr_len == 32);
22232         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
22233         LDKU128 user_channel_id_ref;
22234         CHECK(user_channel_id->arr_len == 16);
22235         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
22236         void* reason_ptr = untag_ptr(reason);
22237         CHECK_ACCESS(reason_ptr);
22238         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
22239         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
22240         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22241         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id_ref, reason_conv);
22242         uint64_t ret_ref = tag_ptr(ret_copy, true);
22243         return ret_ref;
22244 }
22245
22246 uint64_t  __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
22247         LDKThirtyTwoBytes channel_id_ref;
22248         CHECK(channel_id->arr_len == 32);
22249         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
22250         LDKTransaction transaction_ref;
22251         transaction_ref.datalen = transaction->arr_len;
22252         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
22253         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
22254         transaction_ref.data_is_owned = true;
22255         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22256         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
22257         uint64_t ret_ref = tag_ptr(ret_copy, true);
22258         return ret_ref;
22259 }
22260
22261 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) {
22262         LDKThirtyTwoBytes temporary_channel_id_ref;
22263         CHECK(temporary_channel_id->arr_len == 32);
22264         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
22265         LDKPublicKey counterparty_node_id_ref;
22266         CHECK(counterparty_node_id->arr_len == 33);
22267         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
22268         LDKChannelTypeFeatures channel_type_conv;
22269         channel_type_conv.inner = untag_ptr(channel_type);
22270         channel_type_conv.is_owned = ptr_is_owned(channel_type);
22271         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
22272         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
22273         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22274         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
22275         uint64_t ret_ref = tag_ptr(ret_copy, true);
22276         return ret_ref;
22277 }
22278
22279 uint64_t  __attribute__((export_name("TS_Event_htlchandling_failed"))) TS_Event_htlchandling_failed(int8_tArray prev_channel_id, uint64_t failed_next_destination) {
22280         LDKThirtyTwoBytes prev_channel_id_ref;
22281         CHECK(prev_channel_id->arr_len == 32);
22282         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
22283         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
22284         CHECK_ACCESS(failed_next_destination_ptr);
22285         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
22286         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
22287         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
22288         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
22289         uint64_t ret_ref = tag_ptr(ret_copy, true);
22290         return ret_ref;
22291 }
22292
22293 int8_tArray  __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint64_t obj) {
22294         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
22295         LDKCVec_u8Z ret_var = Event_write(obj_conv);
22296         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22297         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22298         CVec_u8Z_free(ret_var);
22299         return ret_arr;
22300 }
22301
22302 uint64_t  __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
22303         LDKu8slice ser_ref;
22304         ser_ref.datalen = ser->arr_len;
22305         ser_ref.data = ser->elems;
22306         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
22307         *ret_conv = Event_read(ser_ref);
22308         FREE(ser);
22309         return tag_ptr(ret_conv, true);
22310 }
22311
22312 void  __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint64_t this_ptr) {
22313         if (!ptr_is_owned(this_ptr)) return;
22314         void* this_ptr_ptr = untag_ptr(this_ptr);
22315         CHECK_ACCESS(this_ptr_ptr);
22316         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
22317         FREE(untag_ptr(this_ptr));
22318         MessageSendEvent_free(this_ptr_conv);
22319 }
22320
22321 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
22322         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22323         *ret_copy = MessageSendEvent_clone(arg);
22324         uint64_t ret_ref = tag_ptr(ret_copy, true);
22325         return ret_ref;
22326 }
22327 int64_t  __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint64_t arg) {
22328         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
22329         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
22330         return ret_conv;
22331 }
22332
22333 uint64_t  __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint64_t orig) {
22334         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
22335         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22336         *ret_copy = MessageSendEvent_clone(orig_conv);
22337         uint64_t ret_ref = tag_ptr(ret_copy, true);
22338         return ret_ref;
22339 }
22340
22341 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint64_t msg) {
22342         LDKPublicKey node_id_ref;
22343         CHECK(node_id->arr_len == 33);
22344         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22345         LDKAcceptChannel msg_conv;
22346         msg_conv.inner = untag_ptr(msg);
22347         msg_conv.is_owned = ptr_is_owned(msg);
22348         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22349         msg_conv = AcceptChannel_clone(&msg_conv);
22350         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22351         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
22352         uint64_t ret_ref = tag_ptr(ret_copy, true);
22353         return ret_ref;
22354 }
22355
22356 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint64_t msg) {
22357         LDKPublicKey node_id_ref;
22358         CHECK(node_id->arr_len == 33);
22359         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22360         LDKOpenChannel msg_conv;
22361         msg_conv.inner = untag_ptr(msg);
22362         msg_conv.is_owned = ptr_is_owned(msg);
22363         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22364         msg_conv = OpenChannel_clone(&msg_conv);
22365         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22366         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
22367         uint64_t ret_ref = tag_ptr(ret_copy, true);
22368         return ret_ref;
22369 }
22370
22371 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_created"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint64_t msg) {
22372         LDKPublicKey node_id_ref;
22373         CHECK(node_id->arr_len == 33);
22374         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22375         LDKFundingCreated msg_conv;
22376         msg_conv.inner = untag_ptr(msg);
22377         msg_conv.is_owned = ptr_is_owned(msg);
22378         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22379         msg_conv = FundingCreated_clone(&msg_conv);
22380         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22381         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
22382         uint64_t ret_ref = tag_ptr(ret_copy, true);
22383         return ret_ref;
22384 }
22385
22386 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_signed"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint64_t msg) {
22387         LDKPublicKey node_id_ref;
22388         CHECK(node_id->arr_len == 33);
22389         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22390         LDKFundingSigned msg_conv;
22391         msg_conv.inner = untag_ptr(msg);
22392         msg_conv.is_owned = ptr_is_owned(msg);
22393         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22394         msg_conv = FundingSigned_clone(&msg_conv);
22395         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22396         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
22397         uint64_t ret_ref = tag_ptr(ret_copy, true);
22398         return ret_ref;
22399 }
22400
22401 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_ready"))) TS_MessageSendEvent_send_channel_ready(int8_tArray node_id, uint64_t msg) {
22402         LDKPublicKey node_id_ref;
22403         CHECK(node_id->arr_len == 33);
22404         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22405         LDKChannelReady msg_conv;
22406         msg_conv.inner = untag_ptr(msg);
22407         msg_conv.is_owned = ptr_is_owned(msg);
22408         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22409         msg_conv = ChannelReady_clone(&msg_conv);
22410         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22411         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
22412         uint64_t ret_ref = tag_ptr(ret_copy, true);
22413         return ret_ref;
22414 }
22415
22416 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_announcement_signatures"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint64_t msg) {
22417         LDKPublicKey node_id_ref;
22418         CHECK(node_id->arr_len == 33);
22419         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22420         LDKAnnouncementSignatures msg_conv;
22421         msg_conv.inner = untag_ptr(msg);
22422         msg_conv.is_owned = ptr_is_owned(msg);
22423         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22424         msg_conv = AnnouncementSignatures_clone(&msg_conv);
22425         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22426         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
22427         uint64_t ret_ref = tag_ptr(ret_copy, true);
22428         return ret_ref;
22429 }
22430
22431 uint64_t  __attribute__((export_name("TS_MessageSendEvent_update_htlcs"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint64_t updates) {
22432         LDKPublicKey node_id_ref;
22433         CHECK(node_id->arr_len == 33);
22434         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22435         LDKCommitmentUpdate updates_conv;
22436         updates_conv.inner = untag_ptr(updates);
22437         updates_conv.is_owned = ptr_is_owned(updates);
22438         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
22439         updates_conv = CommitmentUpdate_clone(&updates_conv);
22440         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22441         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
22442         uint64_t ret_ref = tag_ptr(ret_copy, true);
22443         return ret_ref;
22444 }
22445
22446 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_revoke_and_ack"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint64_t msg) {
22447         LDKPublicKey node_id_ref;
22448         CHECK(node_id->arr_len == 33);
22449         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22450         LDKRevokeAndACK msg_conv;
22451         msg_conv.inner = untag_ptr(msg);
22452         msg_conv.is_owned = ptr_is_owned(msg);
22453         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22454         msg_conv = RevokeAndACK_clone(&msg_conv);
22455         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22456         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
22457         uint64_t ret_ref = tag_ptr(ret_copy, true);
22458         return ret_ref;
22459 }
22460
22461 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_closing_signed"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint64_t msg) {
22462         LDKPublicKey node_id_ref;
22463         CHECK(node_id->arr_len == 33);
22464         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22465         LDKClosingSigned msg_conv;
22466         msg_conv.inner = untag_ptr(msg);
22467         msg_conv.is_owned = ptr_is_owned(msg);
22468         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22469         msg_conv = ClosingSigned_clone(&msg_conv);
22470         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22471         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
22472         uint64_t ret_ref = tag_ptr(ret_copy, true);
22473         return ret_ref;
22474 }
22475
22476 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_shutdown"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint64_t msg) {
22477         LDKPublicKey node_id_ref;
22478         CHECK(node_id->arr_len == 33);
22479         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22480         LDKShutdown msg_conv;
22481         msg_conv.inner = untag_ptr(msg);
22482         msg_conv.is_owned = ptr_is_owned(msg);
22483         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22484         msg_conv = Shutdown_clone(&msg_conv);
22485         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22486         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
22487         uint64_t ret_ref = tag_ptr(ret_copy, true);
22488         return ret_ref;
22489 }
22490
22491 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_reestablish"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint64_t msg) {
22492         LDKPublicKey node_id_ref;
22493         CHECK(node_id->arr_len == 33);
22494         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22495         LDKChannelReestablish msg_conv;
22496         msg_conv.inner = untag_ptr(msg);
22497         msg_conv.is_owned = ptr_is_owned(msg);
22498         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22499         msg_conv = ChannelReestablish_clone(&msg_conv);
22500         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22501         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
22502         uint64_t ret_ref = tag_ptr(ret_copy, true);
22503         return ret_ref;
22504 }
22505
22506 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) {
22507         LDKPublicKey node_id_ref;
22508         CHECK(node_id->arr_len == 33);
22509         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22510         LDKChannelAnnouncement msg_conv;
22511         msg_conv.inner = untag_ptr(msg);
22512         msg_conv.is_owned = ptr_is_owned(msg);
22513         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22514         msg_conv = ChannelAnnouncement_clone(&msg_conv);
22515         LDKChannelUpdate update_msg_conv;
22516         update_msg_conv.inner = untag_ptr(update_msg);
22517         update_msg_conv.is_owned = ptr_is_owned(update_msg);
22518         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
22519         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
22520         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22521         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
22522         uint64_t ret_ref = tag_ptr(ret_copy, true);
22523         return ret_ref;
22524 }
22525
22526 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_announcement"))) TS_MessageSendEvent_broadcast_channel_announcement(uint64_t msg, uint64_t update_msg) {
22527         LDKChannelAnnouncement msg_conv;
22528         msg_conv.inner = untag_ptr(msg);
22529         msg_conv.is_owned = ptr_is_owned(msg);
22530         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22531         msg_conv = ChannelAnnouncement_clone(&msg_conv);
22532         LDKChannelUpdate update_msg_conv;
22533         update_msg_conv.inner = untag_ptr(update_msg);
22534         update_msg_conv.is_owned = ptr_is_owned(update_msg);
22535         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
22536         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
22537         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22538         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
22539         uint64_t ret_ref = tag_ptr(ret_copy, true);
22540         return ret_ref;
22541 }
22542
22543 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_update"))) TS_MessageSendEvent_broadcast_channel_update(uint64_t msg) {
22544         LDKChannelUpdate msg_conv;
22545         msg_conv.inner = untag_ptr(msg);
22546         msg_conv.is_owned = ptr_is_owned(msg);
22547         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22548         msg_conv = ChannelUpdate_clone(&msg_conv);
22549         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22550         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
22551         uint64_t ret_ref = tag_ptr(ret_copy, true);
22552         return ret_ref;
22553 }
22554
22555 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint64_t msg) {
22556         LDKPublicKey node_id_ref;
22557         CHECK(node_id->arr_len == 33);
22558         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22559         LDKChannelUpdate msg_conv;
22560         msg_conv.inner = untag_ptr(msg);
22561         msg_conv.is_owned = ptr_is_owned(msg);
22562         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22563         msg_conv = ChannelUpdate_clone(&msg_conv);
22564         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22565         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
22566         uint64_t ret_ref = tag_ptr(ret_copy, true);
22567         return ret_ref;
22568 }
22569
22570 uint64_t  __attribute__((export_name("TS_MessageSendEvent_handle_error"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint64_t action) {
22571         LDKPublicKey node_id_ref;
22572         CHECK(node_id->arr_len == 33);
22573         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22574         void* action_ptr = untag_ptr(action);
22575         CHECK_ACCESS(action_ptr);
22576         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
22577         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
22578         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22579         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
22580         uint64_t ret_ref = tag_ptr(ret_copy, true);
22581         return ret_ref;
22582 }
22583
22584 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_range_query"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint64_t msg) {
22585         LDKPublicKey node_id_ref;
22586         CHECK(node_id->arr_len == 33);
22587         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22588         LDKQueryChannelRange msg_conv;
22589         msg_conv.inner = untag_ptr(msg);
22590         msg_conv.is_owned = ptr_is_owned(msg);
22591         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22592         msg_conv = QueryChannelRange_clone(&msg_conv);
22593         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22594         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
22595         uint64_t ret_ref = tag_ptr(ret_copy, true);
22596         return ret_ref;
22597 }
22598
22599 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_short_ids_query"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint64_t msg) {
22600         LDKPublicKey node_id_ref;
22601         CHECK(node_id->arr_len == 33);
22602         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22603         LDKQueryShortChannelIds msg_conv;
22604         msg_conv.inner = untag_ptr(msg);
22605         msg_conv.is_owned = ptr_is_owned(msg);
22606         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22607         msg_conv = QueryShortChannelIds_clone(&msg_conv);
22608         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22609         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
22610         uint64_t ret_ref = tag_ptr(ret_copy, true);
22611         return ret_ref;
22612 }
22613
22614 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_reply_channel_range"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint64_t msg) {
22615         LDKPublicKey node_id_ref;
22616         CHECK(node_id->arr_len == 33);
22617         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22618         LDKReplyChannelRange msg_conv;
22619         msg_conv.inner = untag_ptr(msg);
22620         msg_conv.is_owned = ptr_is_owned(msg);
22621         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22622         msg_conv = ReplyChannelRange_clone(&msg_conv);
22623         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22624         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
22625         uint64_t ret_ref = tag_ptr(ret_copy, true);
22626         return ret_ref;
22627 }
22628
22629 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_gossip_timestamp_filter"))) TS_MessageSendEvent_send_gossip_timestamp_filter(int8_tArray node_id, uint64_t msg) {
22630         LDKPublicKey node_id_ref;
22631         CHECK(node_id->arr_len == 33);
22632         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
22633         LDKGossipTimestampFilter msg_conv;
22634         msg_conv.inner = untag_ptr(msg);
22635         msg_conv.is_owned = ptr_is_owned(msg);
22636         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
22637         msg_conv = GossipTimestampFilter_clone(&msg_conv);
22638         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
22639         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
22640         uint64_t ret_ref = tag_ptr(ret_copy, true);
22641         return ret_ref;
22642 }
22643
22644 void  __attribute__((export_name("TS_MessageSendEventsProvider_free"))) TS_MessageSendEventsProvider_free(uint64_t this_ptr) {
22645         if (!ptr_is_owned(this_ptr)) return;
22646         void* this_ptr_ptr = untag_ptr(this_ptr);
22647         CHECK_ACCESS(this_ptr_ptr);
22648         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
22649         FREE(untag_ptr(this_ptr));
22650         MessageSendEventsProvider_free(this_ptr_conv);
22651 }
22652
22653 void  __attribute__((export_name("TS_OnionMessageProvider_free"))) TS_OnionMessageProvider_free(uint64_t this_ptr) {
22654         if (!ptr_is_owned(this_ptr)) return;
22655         void* this_ptr_ptr = untag_ptr(this_ptr);
22656         CHECK_ACCESS(this_ptr_ptr);
22657         LDKOnionMessageProvider this_ptr_conv = *(LDKOnionMessageProvider*)(this_ptr_ptr);
22658         FREE(untag_ptr(this_ptr));
22659         OnionMessageProvider_free(this_ptr_conv);
22660 }
22661
22662 void  __attribute__((export_name("TS_EventsProvider_free"))) TS_EventsProvider_free(uint64_t this_ptr) {
22663         if (!ptr_is_owned(this_ptr)) return;
22664         void* this_ptr_ptr = untag_ptr(this_ptr);
22665         CHECK_ACCESS(this_ptr_ptr);
22666         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
22667         FREE(untag_ptr(this_ptr));
22668         EventsProvider_free(this_ptr_conv);
22669 }
22670
22671 void  __attribute__((export_name("TS_EventHandler_free"))) TS_EventHandler_free(uint64_t this_ptr) {
22672         if (!ptr_is_owned(this_ptr)) return;
22673         void* this_ptr_ptr = untag_ptr(this_ptr);
22674         CHECK_ACCESS(this_ptr_ptr);
22675         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
22676         FREE(untag_ptr(this_ptr));
22677         EventHandler_free(this_ptr_conv);
22678 }
22679
22680 void  __attribute__((export_name("TS_APIError_free"))) TS_APIError_free(uint64_t this_ptr) {
22681         if (!ptr_is_owned(this_ptr)) return;
22682         void* this_ptr_ptr = untag_ptr(this_ptr);
22683         CHECK_ACCESS(this_ptr_ptr);
22684         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
22685         FREE(untag_ptr(this_ptr));
22686         APIError_free(this_ptr_conv);
22687 }
22688
22689 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
22690         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22691         *ret_copy = APIError_clone(arg);
22692         uint64_t ret_ref = tag_ptr(ret_copy, true);
22693         return ret_ref;
22694 }
22695 int64_t  __attribute__((export_name("TS_APIError_clone_ptr"))) TS_APIError_clone_ptr(uint64_t arg) {
22696         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
22697         int64_t ret_conv = APIError_clone_ptr(arg_conv);
22698         return ret_conv;
22699 }
22700
22701 uint64_t  __attribute__((export_name("TS_APIError_clone"))) TS_APIError_clone(uint64_t orig) {
22702         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
22703         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22704         *ret_copy = APIError_clone(orig_conv);
22705         uint64_t ret_ref = tag_ptr(ret_copy, true);
22706         return ret_ref;
22707 }
22708
22709 uint64_t  __attribute__((export_name("TS_APIError_apimisuse_error"))) TS_APIError_apimisuse_error(jstring err) {
22710         LDKStr err_conv = str_ref_to_owned_c(err);
22711         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22712         *ret_copy = APIError_apimisuse_error(err_conv);
22713         uint64_t ret_ref = tag_ptr(ret_copy, true);
22714         return ret_ref;
22715 }
22716
22717 uint64_t  __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
22718         LDKStr err_conv = str_ref_to_owned_c(err);
22719         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22720         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
22721         uint64_t ret_ref = tag_ptr(ret_copy, true);
22722         return ret_ref;
22723 }
22724
22725 uint64_t  __attribute__((export_name("TS_APIError_invalid_route"))) TS_APIError_invalid_route(jstring err) {
22726         LDKStr err_conv = str_ref_to_owned_c(err);
22727         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22728         *ret_copy = APIError_invalid_route(err_conv);
22729         uint64_t ret_ref = tag_ptr(ret_copy, true);
22730         return ret_ref;
22731 }
22732
22733 uint64_t  __attribute__((export_name("TS_APIError_channel_unavailable"))) TS_APIError_channel_unavailable(jstring err) {
22734         LDKStr err_conv = str_ref_to_owned_c(err);
22735         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22736         *ret_copy = APIError_channel_unavailable(err_conv);
22737         uint64_t ret_ref = tag_ptr(ret_copy, true);
22738         return ret_ref;
22739 }
22740
22741 uint64_t  __attribute__((export_name("TS_APIError_monitor_update_in_progress"))) TS_APIError_monitor_update_in_progress() {
22742         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22743         *ret_copy = APIError_monitor_update_in_progress();
22744         uint64_t ret_ref = tag_ptr(ret_copy, true);
22745         return ret_ref;
22746 }
22747
22748 uint64_t  __attribute__((export_name("TS_APIError_incompatible_shutdown_script"))) TS_APIError_incompatible_shutdown_script(uint64_t script) {
22749         LDKShutdownScript script_conv;
22750         script_conv.inner = untag_ptr(script);
22751         script_conv.is_owned = ptr_is_owned(script);
22752         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
22753         script_conv = ShutdownScript_clone(&script_conv);
22754         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
22755         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
22756         uint64_t ret_ref = tag_ptr(ret_copy, true);
22757         return ret_ref;
22758 }
22759
22760 jboolean  __attribute__((export_name("TS_APIError_eq"))) TS_APIError_eq(uint64_t a, uint64_t b) {
22761         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
22762         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
22763         jboolean ret_conv = APIError_eq(a_conv, b_conv);
22764         return ret_conv;
22765 }
22766
22767 void  __attribute__((export_name("TS_BigSize_free"))) TS_BigSize_free(uint64_t this_obj) {
22768         LDKBigSize this_obj_conv;
22769         this_obj_conv.inner = untag_ptr(this_obj);
22770         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22772         BigSize_free(this_obj_conv);
22773 }
22774
22775 int64_t  __attribute__((export_name("TS_BigSize_get_a"))) TS_BigSize_get_a(uint64_t this_ptr) {
22776         LDKBigSize this_ptr_conv;
22777         this_ptr_conv.inner = untag_ptr(this_ptr);
22778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22780         this_ptr_conv.is_owned = false;
22781         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
22782         return ret_conv;
22783 }
22784
22785 void  __attribute__((export_name("TS_BigSize_set_a"))) TS_BigSize_set_a(uint64_t this_ptr, int64_t val) {
22786         LDKBigSize this_ptr_conv;
22787         this_ptr_conv.inner = untag_ptr(this_ptr);
22788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22790         this_ptr_conv.is_owned = false;
22791         BigSize_set_a(&this_ptr_conv, val);
22792 }
22793
22794 uint64_t  __attribute__((export_name("TS_BigSize_new"))) TS_BigSize_new(int64_t a_arg) {
22795         LDKBigSize ret_var = BigSize_new(a_arg);
22796         uint64_t ret_ref = 0;
22797         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22798         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22799         return ret_ref;
22800 }
22801
22802 void  __attribute__((export_name("TS_Hostname_free"))) TS_Hostname_free(uint64_t this_obj) {
22803         LDKHostname this_obj_conv;
22804         this_obj_conv.inner = untag_ptr(this_obj);
22805         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22807         Hostname_free(this_obj_conv);
22808 }
22809
22810 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
22811         LDKHostname ret_var = Hostname_clone(arg);
22812         uint64_t ret_ref = 0;
22813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22815         return ret_ref;
22816 }
22817 int64_t  __attribute__((export_name("TS_Hostname_clone_ptr"))) TS_Hostname_clone_ptr(uint64_t arg) {
22818         LDKHostname arg_conv;
22819         arg_conv.inner = untag_ptr(arg);
22820         arg_conv.is_owned = ptr_is_owned(arg);
22821         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22822         arg_conv.is_owned = false;
22823         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
22824         return ret_conv;
22825 }
22826
22827 uint64_t  __attribute__((export_name("TS_Hostname_clone"))) TS_Hostname_clone(uint64_t orig) {
22828         LDKHostname orig_conv;
22829         orig_conv.inner = untag_ptr(orig);
22830         orig_conv.is_owned = ptr_is_owned(orig);
22831         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22832         orig_conv.is_owned = false;
22833         LDKHostname ret_var = Hostname_clone(&orig_conv);
22834         uint64_t ret_ref = 0;
22835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22836         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22837         return ret_ref;
22838 }
22839
22840 jboolean  __attribute__((export_name("TS_Hostname_eq"))) TS_Hostname_eq(uint64_t a, uint64_t b) {
22841         LDKHostname a_conv;
22842         a_conv.inner = untag_ptr(a);
22843         a_conv.is_owned = ptr_is_owned(a);
22844         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22845         a_conv.is_owned = false;
22846         LDKHostname b_conv;
22847         b_conv.inner = untag_ptr(b);
22848         b_conv.is_owned = ptr_is_owned(b);
22849         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
22850         b_conv.is_owned = false;
22851         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
22852         return ret_conv;
22853 }
22854
22855 int8_t  __attribute__((export_name("TS_Hostname_len"))) TS_Hostname_len(uint64_t this_arg) {
22856         LDKHostname this_arg_conv;
22857         this_arg_conv.inner = untag_ptr(this_arg);
22858         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22860         this_arg_conv.is_owned = false;
22861         int8_t ret_conv = Hostname_len(&this_arg_conv);
22862         return ret_conv;
22863 }
22864
22865 uint64_t  __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_tArray sk) {
22866         LDKu8slice msg_ref;
22867         msg_ref.datalen = msg->arr_len;
22868         msg_ref.data = msg->elems;
22869         unsigned char sk_arr[32];
22870         CHECK(sk->arr_len == 32);
22871         memcpy(sk_arr, sk->elems, 32); FREE(sk);
22872         unsigned char (*sk_ref)[32] = &sk_arr;
22873         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
22874         *ret_conv = sign(msg_ref, sk_ref);
22875         FREE(msg);
22876         return tag_ptr(ret_conv, true);
22877 }
22878
22879 uint64_t  __attribute__((export_name("TS_recover_pk"))) TS_recover_pk(int8_tArray msg, jstring sig) {
22880         LDKu8slice msg_ref;
22881         msg_ref.datalen = msg->arr_len;
22882         msg_ref.data = msg->elems;
22883         LDKStr sig_conv = str_ref_to_owned_c(sig);
22884         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
22885         *ret_conv = recover_pk(msg_ref, sig_conv);
22886         FREE(msg);
22887         return tag_ptr(ret_conv, true);
22888 }
22889
22890 jboolean  __attribute__((export_name("TS_verify"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
22891         LDKu8slice msg_ref;
22892         msg_ref.datalen = msg->arr_len;
22893         msg_ref.data = msg->elems;
22894         LDKStr sig_conv = str_ref_to_owned_c(sig);
22895         LDKPublicKey pk_ref;
22896         CHECK(pk->arr_len == 33);
22897         memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
22898         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
22899         FREE(msg);
22900         return ret_conv;
22901 }
22902
22903 int8_tArray  __attribute__((export_name("TS_construct_invoice_preimage"))) TS_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
22904         LDKu8slice hrp_bytes_ref;
22905         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
22906         hrp_bytes_ref.data = hrp_bytes->elems;
22907         LDKCVec_U5Z data_without_signature_constr;
22908         data_without_signature_constr.datalen = data_without_signature->arr_len;
22909         if (data_without_signature_constr.datalen > 0)
22910                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
22911         else
22912                 data_without_signature_constr.data = NULL;
22913         int8_t* data_without_signature_vals = (void*) data_without_signature->elems;
22914         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
22915                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
22916                 
22917                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
22918         }
22919         FREE(data_without_signature);
22920         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
22921         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22922         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22923         CVec_u8Z_free(ret_var);
22924         FREE(hrp_bytes);
22925         return ret_arr;
22926 }
22927
22928 void  __attribute__((export_name("TS_Persister_free"))) TS_Persister_free(uint64_t this_ptr) {
22929         if (!ptr_is_owned(this_ptr)) return;
22930         void* this_ptr_ptr = untag_ptr(this_ptr);
22931         CHECK_ACCESS(this_ptr_ptr);
22932         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
22933         FREE(untag_ptr(this_ptr));
22934         Persister_free(this_ptr_conv);
22935 }
22936
22937 void  __attribute__((export_name("TS_PrintableString_free"))) TS_PrintableString_free(uint64_t this_obj) {
22938         LDKPrintableString this_obj_conv;
22939         this_obj_conv.inner = untag_ptr(this_obj);
22940         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22942         PrintableString_free(this_obj_conv);
22943 }
22944
22945 jstring  __attribute__((export_name("TS_PrintableString_get_a"))) TS_PrintableString_get_a(uint64_t this_ptr) {
22946         LDKPrintableString this_ptr_conv;
22947         this_ptr_conv.inner = untag_ptr(this_ptr);
22948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22950         this_ptr_conv.is_owned = false;
22951         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
22952         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
22953         Str_free(ret_str);
22954         return ret_conv;
22955 }
22956
22957 void  __attribute__((export_name("TS_PrintableString_set_a"))) TS_PrintableString_set_a(uint64_t this_ptr, jstring val) {
22958         LDKPrintableString this_ptr_conv;
22959         this_ptr_conv.inner = untag_ptr(this_ptr);
22960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22962         this_ptr_conv.is_owned = false;
22963         LDKStr val_conv = str_ref_to_owned_c(val);
22964         PrintableString_set_a(&this_ptr_conv, val_conv);
22965 }
22966
22967 uint64_t  __attribute__((export_name("TS_PrintableString_new"))) TS_PrintableString_new(jstring a_arg) {
22968         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
22969         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
22970         uint64_t ret_ref = 0;
22971         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22972         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22973         return ret_ref;
22974 }
22975
22976 void  __attribute__((export_name("TS_FutureCallback_free"))) TS_FutureCallback_free(uint64_t this_ptr) {
22977         if (!ptr_is_owned(this_ptr)) return;
22978         void* this_ptr_ptr = untag_ptr(this_ptr);
22979         CHECK_ACCESS(this_ptr_ptr);
22980         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
22981         FREE(untag_ptr(this_ptr));
22982         FutureCallback_free(this_ptr_conv);
22983 }
22984
22985 void  __attribute__((export_name("TS_Future_free"))) TS_Future_free(uint64_t this_obj) {
22986         LDKFuture this_obj_conv;
22987         this_obj_conv.inner = untag_ptr(this_obj);
22988         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22990         Future_free(this_obj_conv);
22991 }
22992
22993 void  __attribute__((export_name("TS_Future_register_callback_fn"))) TS_Future_register_callback_fn(uint64_t this_arg, uint64_t callback) {
22994         LDKFuture this_arg_conv;
22995         this_arg_conv.inner = untag_ptr(this_arg);
22996         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22998         this_arg_conv.is_owned = false;
22999         void* callback_ptr = untag_ptr(callback);
23000         CHECK_ACCESS(callback_ptr);
23001         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
23002         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
23003                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23004                 LDKFutureCallback_JCalls_cloned(&callback_conv);
23005         }
23006         Future_register_callback_fn(&this_arg_conv, callback_conv);
23007 }
23008
23009 uint32_t  __attribute__((export_name("TS_Level_clone"))) TS_Level_clone(uint64_t orig) {
23010         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
23011         uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
23012         return ret_conv;
23013 }
23014
23015 uint32_t  __attribute__((export_name("TS_Level_gossip"))) TS_Level_gossip() {
23016         uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
23017         return ret_conv;
23018 }
23019
23020 uint32_t  __attribute__((export_name("TS_Level_trace"))) TS_Level_trace() {
23021         uint32_t ret_conv = LDKLevel_to_js(Level_trace());
23022         return ret_conv;
23023 }
23024
23025 uint32_t  __attribute__((export_name("TS_Level_debug"))) TS_Level_debug() {
23026         uint32_t ret_conv = LDKLevel_to_js(Level_debug());
23027         return ret_conv;
23028 }
23029
23030 uint32_t  __attribute__((export_name("TS_Level_info"))) TS_Level_info() {
23031         uint32_t ret_conv = LDKLevel_to_js(Level_info());
23032         return ret_conv;
23033 }
23034
23035 uint32_t  __attribute__((export_name("TS_Level_warn"))) TS_Level_warn() {
23036         uint32_t ret_conv = LDKLevel_to_js(Level_warn());
23037         return ret_conv;
23038 }
23039
23040 uint32_t  __attribute__((export_name("TS_Level_error"))) TS_Level_error() {
23041         uint32_t ret_conv = LDKLevel_to_js(Level_error());
23042         return ret_conv;
23043 }
23044
23045 jboolean  __attribute__((export_name("TS_Level_eq"))) TS_Level_eq(uint64_t a, uint64_t b) {
23046         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
23047         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
23048         jboolean ret_conv = Level_eq(a_conv, b_conv);
23049         return ret_conv;
23050 }
23051
23052 int64_t  __attribute__((export_name("TS_Level_hash"))) TS_Level_hash(uint64_t o) {
23053         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
23054         int64_t ret_conv = Level_hash(o_conv);
23055         return ret_conv;
23056 }
23057
23058 uint32_t  __attribute__((export_name("TS_Level_max"))) TS_Level_max() {
23059         uint32_t ret_conv = LDKLevel_to_js(Level_max());
23060         return ret_conv;
23061 }
23062
23063 void  __attribute__((export_name("TS_Record_free"))) TS_Record_free(uint64_t this_obj) {
23064         LDKRecord this_obj_conv;
23065         this_obj_conv.inner = untag_ptr(this_obj);
23066         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23068         Record_free(this_obj_conv);
23069 }
23070
23071 uint32_t  __attribute__((export_name("TS_Record_get_level"))) TS_Record_get_level(uint64_t this_ptr) {
23072         LDKRecord this_ptr_conv;
23073         this_ptr_conv.inner = untag_ptr(this_ptr);
23074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23076         this_ptr_conv.is_owned = false;
23077         uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
23078         return ret_conv;
23079 }
23080
23081 void  __attribute__((export_name("TS_Record_set_level"))) TS_Record_set_level(uint64_t this_ptr, uint32_t val) {
23082         LDKRecord this_ptr_conv;
23083         this_ptr_conv.inner = untag_ptr(this_ptr);
23084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23086         this_ptr_conv.is_owned = false;
23087         LDKLevel val_conv = LDKLevel_from_js(val);
23088         Record_set_level(&this_ptr_conv, val_conv);
23089 }
23090
23091 jstring  __attribute__((export_name("TS_Record_get_args"))) TS_Record_get_args(uint64_t this_ptr) {
23092         LDKRecord this_ptr_conv;
23093         this_ptr_conv.inner = untag_ptr(this_ptr);
23094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23096         this_ptr_conv.is_owned = false;
23097         LDKStr ret_str = Record_get_args(&this_ptr_conv);
23098         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23099         Str_free(ret_str);
23100         return ret_conv;
23101 }
23102
23103 void  __attribute__((export_name("TS_Record_set_args"))) TS_Record_set_args(uint64_t this_ptr, jstring val) {
23104         LDKRecord this_ptr_conv;
23105         this_ptr_conv.inner = untag_ptr(this_ptr);
23106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23108         this_ptr_conv.is_owned = false;
23109         LDKStr val_conv = str_ref_to_owned_c(val);
23110         Record_set_args(&this_ptr_conv, val_conv);
23111 }
23112
23113 jstring  __attribute__((export_name("TS_Record_get_module_path"))) TS_Record_get_module_path(uint64_t this_ptr) {
23114         LDKRecord this_ptr_conv;
23115         this_ptr_conv.inner = untag_ptr(this_ptr);
23116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23118         this_ptr_conv.is_owned = false;
23119         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
23120         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23121         Str_free(ret_str);
23122         return ret_conv;
23123 }
23124
23125 void  __attribute__((export_name("TS_Record_set_module_path"))) TS_Record_set_module_path(uint64_t this_ptr, jstring val) {
23126         LDKRecord this_ptr_conv;
23127         this_ptr_conv.inner = untag_ptr(this_ptr);
23128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23130         this_ptr_conv.is_owned = false;
23131         LDKStr val_conv = str_ref_to_owned_c(val);
23132         Record_set_module_path(&this_ptr_conv, val_conv);
23133 }
23134
23135 jstring  __attribute__((export_name("TS_Record_get_file"))) TS_Record_get_file(uint64_t this_ptr) {
23136         LDKRecord this_ptr_conv;
23137         this_ptr_conv.inner = untag_ptr(this_ptr);
23138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23140         this_ptr_conv.is_owned = false;
23141         LDKStr ret_str = Record_get_file(&this_ptr_conv);
23142         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
23143         Str_free(ret_str);
23144         return ret_conv;
23145 }
23146
23147 void  __attribute__((export_name("TS_Record_set_file"))) TS_Record_set_file(uint64_t this_ptr, jstring val) {
23148         LDKRecord this_ptr_conv;
23149         this_ptr_conv.inner = untag_ptr(this_ptr);
23150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23152         this_ptr_conv.is_owned = false;
23153         LDKStr val_conv = str_ref_to_owned_c(val);
23154         Record_set_file(&this_ptr_conv, val_conv);
23155 }
23156
23157 int32_t  __attribute__((export_name("TS_Record_get_line"))) TS_Record_get_line(uint64_t this_ptr) {
23158         LDKRecord this_ptr_conv;
23159         this_ptr_conv.inner = untag_ptr(this_ptr);
23160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23162         this_ptr_conv.is_owned = false;
23163         int32_t ret_conv = Record_get_line(&this_ptr_conv);
23164         return ret_conv;
23165 }
23166
23167 void  __attribute__((export_name("TS_Record_set_line"))) TS_Record_set_line(uint64_t this_ptr, int32_t val) {
23168         LDKRecord this_ptr_conv;
23169         this_ptr_conv.inner = untag_ptr(this_ptr);
23170         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23172         this_ptr_conv.is_owned = false;
23173         Record_set_line(&this_ptr_conv, val);
23174 }
23175
23176 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
23177         LDKRecord ret_var = Record_clone(arg);
23178         uint64_t ret_ref = 0;
23179         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23180         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23181         return ret_ref;
23182 }
23183 int64_t  __attribute__((export_name("TS_Record_clone_ptr"))) TS_Record_clone_ptr(uint64_t arg) {
23184         LDKRecord arg_conv;
23185         arg_conv.inner = untag_ptr(arg);
23186         arg_conv.is_owned = ptr_is_owned(arg);
23187         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23188         arg_conv.is_owned = false;
23189         int64_t ret_conv = Record_clone_ptr(&arg_conv);
23190         return ret_conv;
23191 }
23192
23193 uint64_t  __attribute__((export_name("TS_Record_clone"))) TS_Record_clone(uint64_t orig) {
23194         LDKRecord orig_conv;
23195         orig_conv.inner = untag_ptr(orig);
23196         orig_conv.is_owned = ptr_is_owned(orig);
23197         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23198         orig_conv.is_owned = false;
23199         LDKRecord ret_var = Record_clone(&orig_conv);
23200         uint64_t ret_ref = 0;
23201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23203         return ret_ref;
23204 }
23205
23206 void  __attribute__((export_name("TS_Logger_free"))) TS_Logger_free(uint64_t this_ptr) {
23207         if (!ptr_is_owned(this_ptr)) return;
23208         void* this_ptr_ptr = untag_ptr(this_ptr);
23209         CHECK_ACCESS(this_ptr_ptr);
23210         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
23211         FREE(untag_ptr(this_ptr));
23212         Logger_free(this_ptr_conv);
23213 }
23214
23215 void  __attribute__((export_name("TS_ChannelHandshakeConfig_free"))) TS_ChannelHandshakeConfig_free(uint64_t this_obj) {
23216         LDKChannelHandshakeConfig this_obj_conv;
23217         this_obj_conv.inner = untag_ptr(this_obj);
23218         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23220         ChannelHandshakeConfig_free(this_obj_conv);
23221 }
23222
23223 int32_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_minimum_depth"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint64_t this_ptr) {
23224         LDKChannelHandshakeConfig this_ptr_conv;
23225         this_ptr_conv.inner = untag_ptr(this_ptr);
23226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23228         this_ptr_conv.is_owned = false;
23229         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
23230         return ret_conv;
23231 }
23232
23233 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_minimum_depth"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint64_t this_ptr, int32_t val) {
23234         LDKChannelHandshakeConfig this_ptr_conv;
23235         this_ptr_conv.inner = untag_ptr(this_ptr);
23236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23238         this_ptr_conv.is_owned = false;
23239         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
23240 }
23241
23242 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_to_self_delay"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint64_t this_ptr) {
23243         LDKChannelHandshakeConfig this_ptr_conv;
23244         this_ptr_conv.inner = untag_ptr(this_ptr);
23245         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23247         this_ptr_conv.is_owned = false;
23248         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
23249         return ret_conv;
23250 }
23251
23252 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) {
23253         LDKChannelHandshakeConfig this_ptr_conv;
23254         this_ptr_conv.inner = untag_ptr(this_ptr);
23255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23257         this_ptr_conv.is_owned = false;
23258         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
23259 }
23260
23261 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint64_t this_ptr) {
23262         LDKChannelHandshakeConfig this_ptr_conv;
23263         this_ptr_conv.inner = untag_ptr(this_ptr);
23264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23266         this_ptr_conv.is_owned = false;
23267         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
23268         return ret_conv;
23269 }
23270
23271 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) {
23272         LDKChannelHandshakeConfig this_ptr_conv;
23273         this_ptr_conv.inner = untag_ptr(this_ptr);
23274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23276         this_ptr_conv.is_owned = false;
23277         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
23278 }
23279
23280 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) {
23281         LDKChannelHandshakeConfig this_ptr_conv;
23282         this_ptr_conv.inner = untag_ptr(this_ptr);
23283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23285         this_ptr_conv.is_owned = false;
23286         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
23287         return ret_conv;
23288 }
23289
23290 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) {
23291         LDKChannelHandshakeConfig this_ptr_conv;
23292         this_ptr_conv.inner = untag_ptr(this_ptr);
23293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23295         this_ptr_conv.is_owned = false;
23296         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
23297 }
23298
23299 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_get_negotiate_scid_privacy(uint64_t this_ptr) {
23300         LDKChannelHandshakeConfig this_ptr_conv;
23301         this_ptr_conv.inner = untag_ptr(this_ptr);
23302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23304         this_ptr_conv.is_owned = false;
23305         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
23306         return ret_conv;
23307 }
23308
23309 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_set_negotiate_scid_privacy(uint64_t this_ptr, jboolean val) {
23310         LDKChannelHandshakeConfig this_ptr_conv;
23311         this_ptr_conv.inner = untag_ptr(this_ptr);
23312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23314         this_ptr_conv.is_owned = false;
23315         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
23316 }
23317
23318 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_announced_channel"))) TS_ChannelHandshakeConfig_get_announced_channel(uint64_t this_ptr) {
23319         LDKChannelHandshakeConfig this_ptr_conv;
23320         this_ptr_conv.inner = untag_ptr(this_ptr);
23321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23323         this_ptr_conv.is_owned = false;
23324         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
23325         return ret_conv;
23326 }
23327
23328 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_announced_channel"))) TS_ChannelHandshakeConfig_set_announced_channel(uint64_t this_ptr, jboolean val) {
23329         LDKChannelHandshakeConfig this_ptr_conv;
23330         this_ptr_conv.inner = untag_ptr(this_ptr);
23331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23333         this_ptr_conv.is_owned = false;
23334         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
23335 }
23336
23337 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(uint64_t this_ptr) {
23338         LDKChannelHandshakeConfig this_ptr_conv;
23339         this_ptr_conv.inner = untag_ptr(this_ptr);
23340         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23342         this_ptr_conv.is_owned = false;
23343         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
23344         return ret_conv;
23345 }
23346
23347 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(uint64_t this_ptr, jboolean val) {
23348         LDKChannelHandshakeConfig this_ptr_conv;
23349         this_ptr_conv.inner = untag_ptr(this_ptr);
23350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23352         this_ptr_conv.is_owned = false;
23353         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
23354 }
23355
23356 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) {
23357         LDKChannelHandshakeConfig this_ptr_conv;
23358         this_ptr_conv.inner = untag_ptr(this_ptr);
23359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23361         this_ptr_conv.is_owned = false;
23362         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
23363         return ret_conv;
23364 }
23365
23366 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) {
23367         LDKChannelHandshakeConfig this_ptr_conv;
23368         this_ptr_conv.inner = untag_ptr(this_ptr);
23369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23371         this_ptr_conv.is_owned = false;
23372         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
23373 }
23374
23375 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) {
23376         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);
23377         uint64_t ret_ref = 0;
23378         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23379         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23380         return ret_ref;
23381 }
23382
23383 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
23384         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
23385         uint64_t ret_ref = 0;
23386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23387         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23388         return ret_ref;
23389 }
23390 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone_ptr"))) TS_ChannelHandshakeConfig_clone_ptr(uint64_t arg) {
23391         LDKChannelHandshakeConfig arg_conv;
23392         arg_conv.inner = untag_ptr(arg);
23393         arg_conv.is_owned = ptr_is_owned(arg);
23394         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23395         arg_conv.is_owned = false;
23396         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
23397         return ret_conv;
23398 }
23399
23400 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone"))) TS_ChannelHandshakeConfig_clone(uint64_t orig) {
23401         LDKChannelHandshakeConfig orig_conv;
23402         orig_conv.inner = untag_ptr(orig);
23403         orig_conv.is_owned = ptr_is_owned(orig);
23404         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23405         orig_conv.is_owned = false;
23406         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
23407         uint64_t ret_ref = 0;
23408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23410         return ret_ref;
23411 }
23412
23413 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_default"))) TS_ChannelHandshakeConfig_default() {
23414         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
23415         uint64_t ret_ref = 0;
23416         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23417         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23418         return ret_ref;
23419 }
23420
23421 void  __attribute__((export_name("TS_ChannelHandshakeLimits_free"))) TS_ChannelHandshakeLimits_free(uint64_t this_obj) {
23422         LDKChannelHandshakeLimits this_obj_conv;
23423         this_obj_conv.inner = untag_ptr(this_obj);
23424         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23426         ChannelHandshakeLimits_free(this_obj_conv);
23427 }
23428
23429 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_funding_satoshis"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint64_t this_ptr) {
23430         LDKChannelHandshakeLimits this_ptr_conv;
23431         this_ptr_conv.inner = untag_ptr(this_ptr);
23432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23434         this_ptr_conv.is_owned = false;
23435         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
23436         return ret_conv;
23437 }
23438
23439 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_funding_satoshis"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint64_t this_ptr, int64_t val) {
23440         LDKChannelHandshakeLimits this_ptr_conv;
23441         this_ptr_conv.inner = untag_ptr(this_ptr);
23442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23444         this_ptr_conv.is_owned = false;
23445         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
23446 }
23447
23448 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_funding_satoshis"))) TS_ChannelHandshakeLimits_get_max_funding_satoshis(uint64_t this_ptr) {
23449         LDKChannelHandshakeLimits this_ptr_conv;
23450         this_ptr_conv.inner = untag_ptr(this_ptr);
23451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23453         this_ptr_conv.is_owned = false;
23454         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
23455         return ret_conv;
23456 }
23457
23458 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_funding_satoshis"))) TS_ChannelHandshakeLimits_set_max_funding_satoshis(uint64_t this_ptr, int64_t val) {
23459         LDKChannelHandshakeLimits this_ptr_conv;
23460         this_ptr_conv.inner = untag_ptr(this_ptr);
23461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23463         this_ptr_conv.is_owned = false;
23464         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
23465 }
23466
23467 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint64_t this_ptr) {
23468         LDKChannelHandshakeLimits this_ptr_conv;
23469         this_ptr_conv.inner = untag_ptr(this_ptr);
23470         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23472         this_ptr_conv.is_owned = false;
23473         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
23474         return ret_conv;
23475 }
23476
23477 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) {
23478         LDKChannelHandshakeLimits this_ptr_conv;
23479         this_ptr_conv.inner = untag_ptr(this_ptr);
23480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23482         this_ptr_conv.is_owned = false;
23483         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
23484 }
23485
23486 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) {
23487         LDKChannelHandshakeLimits this_ptr_conv;
23488         this_ptr_conv.inner = untag_ptr(this_ptr);
23489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23491         this_ptr_conv.is_owned = false;
23492         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
23493         return ret_conv;
23494 }
23495
23496 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) {
23497         LDKChannelHandshakeLimits this_ptr_conv;
23498         this_ptr_conv.inner = untag_ptr(this_ptr);
23499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23501         this_ptr_conv.is_owned = false;
23502         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
23503 }
23504
23505 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint64_t this_ptr) {
23506         LDKChannelHandshakeLimits this_ptr_conv;
23507         this_ptr_conv.inner = untag_ptr(this_ptr);
23508         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23510         this_ptr_conv.is_owned = false;
23511         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
23512         return ret_conv;
23513 }
23514
23515 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) {
23516         LDKChannelHandshakeLimits this_ptr_conv;
23517         this_ptr_conv.inner = untag_ptr(this_ptr);
23518         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23520         this_ptr_conv.is_owned = false;
23521         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
23522 }
23523
23524 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint64_t this_ptr) {
23525         LDKChannelHandshakeLimits this_ptr_conv;
23526         this_ptr_conv.inner = untag_ptr(this_ptr);
23527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23529         this_ptr_conv.is_owned = false;
23530         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
23531         return ret_conv;
23532 }
23533
23534 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) {
23535         LDKChannelHandshakeLimits this_ptr_conv;
23536         this_ptr_conv.inner = untag_ptr(this_ptr);
23537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23539         this_ptr_conv.is_owned = false;
23540         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
23541 }
23542
23543 int32_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_minimum_depth"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint64_t this_ptr) {
23544         LDKChannelHandshakeLimits this_ptr_conv;
23545         this_ptr_conv.inner = untag_ptr(this_ptr);
23546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23548         this_ptr_conv.is_owned = false;
23549         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
23550         return ret_conv;
23551 }
23552
23553 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_minimum_depth"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint64_t this_ptr, int32_t val) {
23554         LDKChannelHandshakeLimits this_ptr_conv;
23555         this_ptr_conv.inner = untag_ptr(this_ptr);
23556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23558         this_ptr_conv.is_owned = false;
23559         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
23560 }
23561
23562 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_get_trust_own_funding_0conf(uint64_t this_ptr) {
23563         LDKChannelHandshakeLimits this_ptr_conv;
23564         this_ptr_conv.inner = untag_ptr(this_ptr);
23565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23567         this_ptr_conv.is_owned = false;
23568         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
23569         return ret_conv;
23570 }
23571
23572 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_set_trust_own_funding_0conf(uint64_t this_ptr, jboolean val) {
23573         LDKChannelHandshakeLimits this_ptr_conv;
23574         this_ptr_conv.inner = untag_ptr(this_ptr);
23575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23577         this_ptr_conv.is_owned = false;
23578         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
23579 }
23580
23581 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint64_t this_ptr) {
23582         LDKChannelHandshakeLimits this_ptr_conv;
23583         this_ptr_conv.inner = untag_ptr(this_ptr);
23584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23586         this_ptr_conv.is_owned = false;
23587         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
23588         return ret_conv;
23589 }
23590
23591 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint64_t this_ptr, jboolean val) {
23592         LDKChannelHandshakeLimits this_ptr_conv;
23593         this_ptr_conv.inner = untag_ptr(this_ptr);
23594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23596         this_ptr_conv.is_owned = false;
23597         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
23598 }
23599
23600 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_their_to_self_delay"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint64_t this_ptr) {
23601         LDKChannelHandshakeLimits this_ptr_conv;
23602         this_ptr_conv.inner = untag_ptr(this_ptr);
23603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23605         this_ptr_conv.is_owned = false;
23606         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
23607         return ret_conv;
23608 }
23609
23610 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) {
23611         LDKChannelHandshakeLimits this_ptr_conv;
23612         this_ptr_conv.inner = untag_ptr(this_ptr);
23613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23615         this_ptr_conv.is_owned = false;
23616         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
23617 }
23618
23619 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) {
23620         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);
23621         uint64_t ret_ref = 0;
23622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23624         return ret_ref;
23625 }
23626
23627 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
23628         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
23629         uint64_t ret_ref = 0;
23630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23632         return ret_ref;
23633 }
23634 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone_ptr"))) TS_ChannelHandshakeLimits_clone_ptr(uint64_t arg) {
23635         LDKChannelHandshakeLimits arg_conv;
23636         arg_conv.inner = untag_ptr(arg);
23637         arg_conv.is_owned = ptr_is_owned(arg);
23638         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23639         arg_conv.is_owned = false;
23640         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
23641         return ret_conv;
23642 }
23643
23644 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone"))) TS_ChannelHandshakeLimits_clone(uint64_t orig) {
23645         LDKChannelHandshakeLimits orig_conv;
23646         orig_conv.inner = untag_ptr(orig);
23647         orig_conv.is_owned = ptr_is_owned(orig);
23648         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23649         orig_conv.is_owned = false;
23650         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
23651         uint64_t ret_ref = 0;
23652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23654         return ret_ref;
23655 }
23656
23657 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_default"))) TS_ChannelHandshakeLimits_default() {
23658         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
23659         uint64_t ret_ref = 0;
23660         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23661         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23662         return ret_ref;
23663 }
23664
23665 void  __attribute__((export_name("TS_ChannelConfig_free"))) TS_ChannelConfig_free(uint64_t this_obj) {
23666         LDKChannelConfig this_obj_conv;
23667         this_obj_conv.inner = untag_ptr(this_obj);
23668         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23670         ChannelConfig_free(this_obj_conv);
23671 }
23672
23673 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
23674         LDKChannelConfig this_ptr_conv;
23675         this_ptr_conv.inner = untag_ptr(this_ptr);
23676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23678         this_ptr_conv.is_owned = false;
23679         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
23680         return ret_conv;
23681 }
23682
23683 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) {
23684         LDKChannelConfig this_ptr_conv;
23685         this_ptr_conv.inner = untag_ptr(this_ptr);
23686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23688         this_ptr_conv.is_owned = false;
23689         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
23690 }
23691
23692 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_base_msat"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint64_t this_ptr) {
23693         LDKChannelConfig this_ptr_conv;
23694         this_ptr_conv.inner = untag_ptr(this_ptr);
23695         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23697         this_ptr_conv.is_owned = false;
23698         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
23699         return ret_conv;
23700 }
23701
23702 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) {
23703         LDKChannelConfig this_ptr_conv;
23704         this_ptr_conv.inner = untag_ptr(this_ptr);
23705         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23707         this_ptr_conv.is_owned = false;
23708         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
23709 }
23710
23711 int16_t  __attribute__((export_name("TS_ChannelConfig_get_cltv_expiry_delta"))) TS_ChannelConfig_get_cltv_expiry_delta(uint64_t this_ptr) {
23712         LDKChannelConfig this_ptr_conv;
23713         this_ptr_conv.inner = untag_ptr(this_ptr);
23714         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23716         this_ptr_conv.is_owned = false;
23717         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
23718         return ret_conv;
23719 }
23720
23721 void  __attribute__((export_name("TS_ChannelConfig_set_cltv_expiry_delta"))) TS_ChannelConfig_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
23722         LDKChannelConfig this_ptr_conv;
23723         this_ptr_conv.inner = untag_ptr(this_ptr);
23724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23726         this_ptr_conv.is_owned = false;
23727         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
23728 }
23729
23730 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) {
23731         LDKChannelConfig this_ptr_conv;
23732         this_ptr_conv.inner = untag_ptr(this_ptr);
23733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23735         this_ptr_conv.is_owned = false;
23736         int64_t ret_conv = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
23737         return ret_conv;
23738 }
23739
23740 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) {
23741         LDKChannelConfig this_ptr_conv;
23742         this_ptr_conv.inner = untag_ptr(this_ptr);
23743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23745         this_ptr_conv.is_owned = false;
23746         ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
23747 }
23748
23749 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) {
23750         LDKChannelConfig this_ptr_conv;
23751         this_ptr_conv.inner = untag_ptr(this_ptr);
23752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23754         this_ptr_conv.is_owned = false;
23755         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
23756         return ret_conv;
23757 }
23758
23759 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) {
23760         LDKChannelConfig this_ptr_conv;
23761         this_ptr_conv.inner = untag_ptr(this_ptr);
23762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23764         this_ptr_conv.is_owned = false;
23765         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
23766 }
23767
23768 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) {
23769         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);
23770         uint64_t ret_ref = 0;
23771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23773         return ret_ref;
23774 }
23775
23776 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
23777         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
23778         uint64_t ret_ref = 0;
23779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23781         return ret_ref;
23782 }
23783 int64_t  __attribute__((export_name("TS_ChannelConfig_clone_ptr"))) TS_ChannelConfig_clone_ptr(uint64_t arg) {
23784         LDKChannelConfig arg_conv;
23785         arg_conv.inner = untag_ptr(arg);
23786         arg_conv.is_owned = ptr_is_owned(arg);
23787         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23788         arg_conv.is_owned = false;
23789         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
23790         return ret_conv;
23791 }
23792
23793 uint64_t  __attribute__((export_name("TS_ChannelConfig_clone"))) TS_ChannelConfig_clone(uint64_t orig) {
23794         LDKChannelConfig orig_conv;
23795         orig_conv.inner = untag_ptr(orig);
23796         orig_conv.is_owned = ptr_is_owned(orig);
23797         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23798         orig_conv.is_owned = false;
23799         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
23800         uint64_t ret_ref = 0;
23801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23803         return ret_ref;
23804 }
23805
23806 jboolean  __attribute__((export_name("TS_ChannelConfig_eq"))) TS_ChannelConfig_eq(uint64_t a, uint64_t b) {
23807         LDKChannelConfig a_conv;
23808         a_conv.inner = untag_ptr(a);
23809         a_conv.is_owned = ptr_is_owned(a);
23810         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23811         a_conv.is_owned = false;
23812         LDKChannelConfig b_conv;
23813         b_conv.inner = untag_ptr(b);
23814         b_conv.is_owned = ptr_is_owned(b);
23815         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23816         b_conv.is_owned = false;
23817         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
23818         return ret_conv;
23819 }
23820
23821 uint64_t  __attribute__((export_name("TS_ChannelConfig_default"))) TS_ChannelConfig_default() {
23822         LDKChannelConfig ret_var = ChannelConfig_default();
23823         uint64_t ret_ref = 0;
23824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23826         return ret_ref;
23827 }
23828
23829 int8_tArray  __attribute__((export_name("TS_ChannelConfig_write"))) TS_ChannelConfig_write(uint64_t obj) {
23830         LDKChannelConfig obj_conv;
23831         obj_conv.inner = untag_ptr(obj);
23832         obj_conv.is_owned = ptr_is_owned(obj);
23833         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23834         obj_conv.is_owned = false;
23835         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
23836         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23837         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23838         CVec_u8Z_free(ret_var);
23839         return ret_arr;
23840 }
23841
23842 uint64_t  __attribute__((export_name("TS_ChannelConfig_read"))) TS_ChannelConfig_read(int8_tArray ser) {
23843         LDKu8slice ser_ref;
23844         ser_ref.datalen = ser->arr_len;
23845         ser_ref.data = ser->elems;
23846         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
23847         *ret_conv = ChannelConfig_read(ser_ref);
23848         FREE(ser);
23849         return tag_ptr(ret_conv, true);
23850 }
23851
23852 void  __attribute__((export_name("TS_UserConfig_free"))) TS_UserConfig_free(uint64_t this_obj) {
23853         LDKUserConfig this_obj_conv;
23854         this_obj_conv.inner = untag_ptr(this_obj);
23855         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23857         UserConfig_free(this_obj_conv);
23858 }
23859
23860 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_config"))) TS_UserConfig_get_channel_handshake_config(uint64_t this_ptr) {
23861         LDKUserConfig this_ptr_conv;
23862         this_ptr_conv.inner = untag_ptr(this_ptr);
23863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23865         this_ptr_conv.is_owned = false;
23866         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
23867         uint64_t ret_ref = 0;
23868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23870         return ret_ref;
23871 }
23872
23873 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_config"))) TS_UserConfig_set_channel_handshake_config(uint64_t this_ptr, uint64_t val) {
23874         LDKUserConfig this_ptr_conv;
23875         this_ptr_conv.inner = untag_ptr(this_ptr);
23876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23878         this_ptr_conv.is_owned = false;
23879         LDKChannelHandshakeConfig val_conv;
23880         val_conv.inner = untag_ptr(val);
23881         val_conv.is_owned = ptr_is_owned(val);
23882         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23883         val_conv = ChannelHandshakeConfig_clone(&val_conv);
23884         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
23885 }
23886
23887 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_limits"))) TS_UserConfig_get_channel_handshake_limits(uint64_t this_ptr) {
23888         LDKUserConfig this_ptr_conv;
23889         this_ptr_conv.inner = untag_ptr(this_ptr);
23890         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23892         this_ptr_conv.is_owned = false;
23893         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
23894         uint64_t ret_ref = 0;
23895         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23896         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23897         return ret_ref;
23898 }
23899
23900 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_limits"))) TS_UserConfig_set_channel_handshake_limits(uint64_t this_ptr, uint64_t val) {
23901         LDKUserConfig this_ptr_conv;
23902         this_ptr_conv.inner = untag_ptr(this_ptr);
23903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23905         this_ptr_conv.is_owned = false;
23906         LDKChannelHandshakeLimits val_conv;
23907         val_conv.inner = untag_ptr(val);
23908         val_conv.is_owned = ptr_is_owned(val);
23909         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23910         val_conv = ChannelHandshakeLimits_clone(&val_conv);
23911         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
23912 }
23913
23914 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_config"))) TS_UserConfig_get_channel_config(uint64_t this_ptr) {
23915         LDKUserConfig this_ptr_conv;
23916         this_ptr_conv.inner = untag_ptr(this_ptr);
23917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23919         this_ptr_conv.is_owned = false;
23920         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
23921         uint64_t ret_ref = 0;
23922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23924         return ret_ref;
23925 }
23926
23927 void  __attribute__((export_name("TS_UserConfig_set_channel_config"))) TS_UserConfig_set_channel_config(uint64_t this_ptr, uint64_t val) {
23928         LDKUserConfig this_ptr_conv;
23929         this_ptr_conv.inner = untag_ptr(this_ptr);
23930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23932         this_ptr_conv.is_owned = false;
23933         LDKChannelConfig val_conv;
23934         val_conv.inner = untag_ptr(val);
23935         val_conv.is_owned = ptr_is_owned(val);
23936         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23937         val_conv = ChannelConfig_clone(&val_conv);
23938         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
23939 }
23940
23941 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_forwards_to_priv_channels"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint64_t this_ptr) {
23942         LDKUserConfig this_ptr_conv;
23943         this_ptr_conv.inner = untag_ptr(this_ptr);
23944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23946         this_ptr_conv.is_owned = false;
23947         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
23948         return ret_conv;
23949 }
23950
23951 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) {
23952         LDKUserConfig this_ptr_conv;
23953         this_ptr_conv.inner = untag_ptr(this_ptr);
23954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23956         this_ptr_conv.is_owned = false;
23957         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
23958 }
23959
23960 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_inbound_channels"))) TS_UserConfig_get_accept_inbound_channels(uint64_t this_ptr) {
23961         LDKUserConfig this_ptr_conv;
23962         this_ptr_conv.inner = untag_ptr(this_ptr);
23963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23965         this_ptr_conv.is_owned = false;
23966         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
23967         return ret_conv;
23968 }
23969
23970 void  __attribute__((export_name("TS_UserConfig_set_accept_inbound_channels"))) TS_UserConfig_set_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
23971         LDKUserConfig this_ptr_conv;
23972         this_ptr_conv.inner = untag_ptr(this_ptr);
23973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23975         this_ptr_conv.is_owned = false;
23976         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
23977 }
23978
23979 jboolean  __attribute__((export_name("TS_UserConfig_get_manually_accept_inbound_channels"))) TS_UserConfig_get_manually_accept_inbound_channels(uint64_t this_ptr) {
23980         LDKUserConfig this_ptr_conv;
23981         this_ptr_conv.inner = untag_ptr(this_ptr);
23982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23984         this_ptr_conv.is_owned = false;
23985         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
23986         return ret_conv;
23987 }
23988
23989 void  __attribute__((export_name("TS_UserConfig_set_manually_accept_inbound_channels"))) TS_UserConfig_set_manually_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
23990         LDKUserConfig this_ptr_conv;
23991         this_ptr_conv.inner = untag_ptr(this_ptr);
23992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23994         this_ptr_conv.is_owned = false;
23995         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
23996 }
23997
23998 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_intercept_htlcs"))) TS_UserConfig_get_accept_intercept_htlcs(uint64_t this_ptr) {
23999         LDKUserConfig this_ptr_conv;
24000         this_ptr_conv.inner = untag_ptr(this_ptr);
24001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24003         this_ptr_conv.is_owned = false;
24004         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
24005         return ret_conv;
24006 }
24007
24008 void  __attribute__((export_name("TS_UserConfig_set_accept_intercept_htlcs"))) TS_UserConfig_set_accept_intercept_htlcs(uint64_t this_ptr, jboolean val) {
24009         LDKUserConfig this_ptr_conv;
24010         this_ptr_conv.inner = untag_ptr(this_ptr);
24011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24013         this_ptr_conv.is_owned = false;
24014         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
24015 }
24016
24017 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) {
24018         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
24019         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
24020         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
24021         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
24022         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
24023         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
24024         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
24025         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
24026         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
24027         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
24028         LDKChannelConfig channel_config_arg_conv;
24029         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
24030         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
24031         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
24032         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
24033         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);
24034         uint64_t ret_ref = 0;
24035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24037         return ret_ref;
24038 }
24039
24040 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
24041         LDKUserConfig ret_var = UserConfig_clone(arg);
24042         uint64_t ret_ref = 0;
24043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24045         return ret_ref;
24046 }
24047 int64_t  __attribute__((export_name("TS_UserConfig_clone_ptr"))) TS_UserConfig_clone_ptr(uint64_t arg) {
24048         LDKUserConfig arg_conv;
24049         arg_conv.inner = untag_ptr(arg);
24050         arg_conv.is_owned = ptr_is_owned(arg);
24051         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24052         arg_conv.is_owned = false;
24053         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
24054         return ret_conv;
24055 }
24056
24057 uint64_t  __attribute__((export_name("TS_UserConfig_clone"))) TS_UserConfig_clone(uint64_t orig) {
24058         LDKUserConfig orig_conv;
24059         orig_conv.inner = untag_ptr(orig);
24060         orig_conv.is_owned = ptr_is_owned(orig);
24061         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24062         orig_conv.is_owned = false;
24063         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
24064         uint64_t ret_ref = 0;
24065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24067         return ret_ref;
24068 }
24069
24070 uint64_t  __attribute__((export_name("TS_UserConfig_default"))) TS_UserConfig_default() {
24071         LDKUserConfig ret_var = UserConfig_default();
24072         uint64_t ret_ref = 0;
24073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24075         return ret_ref;
24076 }
24077
24078 void  __attribute__((export_name("TS_BestBlock_free"))) TS_BestBlock_free(uint64_t this_obj) {
24079         LDKBestBlock this_obj_conv;
24080         this_obj_conv.inner = untag_ptr(this_obj);
24081         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24083         BestBlock_free(this_obj_conv);
24084 }
24085
24086 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
24087         LDKBestBlock ret_var = BestBlock_clone(arg);
24088         uint64_t ret_ref = 0;
24089         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24090         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24091         return ret_ref;
24092 }
24093 int64_t  __attribute__((export_name("TS_BestBlock_clone_ptr"))) TS_BestBlock_clone_ptr(uint64_t arg) {
24094         LDKBestBlock arg_conv;
24095         arg_conv.inner = untag_ptr(arg);
24096         arg_conv.is_owned = ptr_is_owned(arg);
24097         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24098         arg_conv.is_owned = false;
24099         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
24100         return ret_conv;
24101 }
24102
24103 uint64_t  __attribute__((export_name("TS_BestBlock_clone"))) TS_BestBlock_clone(uint64_t orig) {
24104         LDKBestBlock orig_conv;
24105         orig_conv.inner = untag_ptr(orig);
24106         orig_conv.is_owned = ptr_is_owned(orig);
24107         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24108         orig_conv.is_owned = false;
24109         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
24110         uint64_t ret_ref = 0;
24111         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24112         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24113         return ret_ref;
24114 }
24115
24116 jboolean  __attribute__((export_name("TS_BestBlock_eq"))) TS_BestBlock_eq(uint64_t a, uint64_t b) {
24117         LDKBestBlock a_conv;
24118         a_conv.inner = untag_ptr(a);
24119         a_conv.is_owned = ptr_is_owned(a);
24120         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24121         a_conv.is_owned = false;
24122         LDKBestBlock b_conv;
24123         b_conv.inner = untag_ptr(b);
24124         b_conv.is_owned = ptr_is_owned(b);
24125         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24126         b_conv.is_owned = false;
24127         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
24128         return ret_conv;
24129 }
24130
24131 uint64_t  __attribute__((export_name("TS_BestBlock_from_genesis"))) TS_BestBlock_from_genesis(uint32_t network) {
24132         LDKNetwork network_conv = LDKNetwork_from_js(network);
24133         LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
24134         uint64_t ret_ref = 0;
24135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24137         return ret_ref;
24138 }
24139
24140 uint64_t  __attribute__((export_name("TS_BestBlock_new"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
24141         LDKThirtyTwoBytes block_hash_ref;
24142         CHECK(block_hash->arr_len == 32);
24143         memcpy(block_hash_ref.data, block_hash->elems, 32); FREE(block_hash);
24144         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
24145         uint64_t ret_ref = 0;
24146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24148         return ret_ref;
24149 }
24150
24151 int8_tArray  __attribute__((export_name("TS_BestBlock_block_hash"))) TS_BestBlock_block_hash(uint64_t this_arg) {
24152         LDKBestBlock this_arg_conv;
24153         this_arg_conv.inner = untag_ptr(this_arg);
24154         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24156         this_arg_conv.is_owned = false;
24157         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24158         memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
24159         return ret_arr;
24160 }
24161
24162 int32_t  __attribute__((export_name("TS_BestBlock_height"))) TS_BestBlock_height(uint64_t this_arg) {
24163         LDKBestBlock this_arg_conv;
24164         this_arg_conv.inner = untag_ptr(this_arg);
24165         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24167         this_arg_conv.is_owned = false;
24168         int32_t ret_conv = BestBlock_height(&this_arg_conv);
24169         return ret_conv;
24170 }
24171
24172 uint32_t  __attribute__((export_name("TS_AccessError_clone"))) TS_AccessError_clone(uint64_t orig) {
24173         LDKAccessError* orig_conv = (LDKAccessError*)untag_ptr(orig);
24174         uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
24175         return ret_conv;
24176 }
24177
24178 uint32_t  __attribute__((export_name("TS_AccessError_unknown_chain"))) TS_AccessError_unknown_chain() {
24179         uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_chain());
24180         return ret_conv;
24181 }
24182
24183 uint32_t  __attribute__((export_name("TS_AccessError_unknown_tx"))) TS_AccessError_unknown_tx() {
24184         uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_tx());
24185         return ret_conv;
24186 }
24187
24188 void  __attribute__((export_name("TS_Access_free"))) TS_Access_free(uint64_t this_ptr) {
24189         if (!ptr_is_owned(this_ptr)) return;
24190         void* this_ptr_ptr = untag_ptr(this_ptr);
24191         CHECK_ACCESS(this_ptr_ptr);
24192         LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
24193         FREE(untag_ptr(this_ptr));
24194         Access_free(this_ptr_conv);
24195 }
24196
24197 void  __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint64_t this_ptr) {
24198         if (!ptr_is_owned(this_ptr)) return;
24199         void* this_ptr_ptr = untag_ptr(this_ptr);
24200         CHECK_ACCESS(this_ptr_ptr);
24201         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
24202         FREE(untag_ptr(this_ptr));
24203         Listen_free(this_ptr_conv);
24204 }
24205
24206 void  __attribute__((export_name("TS_Confirm_free"))) TS_Confirm_free(uint64_t this_ptr) {
24207         if (!ptr_is_owned(this_ptr)) return;
24208         void* this_ptr_ptr = untag_ptr(this_ptr);
24209         CHECK_ACCESS(this_ptr_ptr);
24210         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
24211         FREE(untag_ptr(this_ptr));
24212         Confirm_free(this_ptr_conv);
24213 }
24214
24215 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_clone"))) TS_ChannelMonitorUpdateStatus_clone(uint64_t orig) {
24216         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
24217         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_clone(orig_conv));
24218         return ret_conv;
24219 }
24220
24221 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_completed"))) TS_ChannelMonitorUpdateStatus_completed() {
24222         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_completed());
24223         return ret_conv;
24224 }
24225
24226 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_in_progress"))) TS_ChannelMonitorUpdateStatus_in_progress() {
24227         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_in_progress());
24228         return ret_conv;
24229 }
24230
24231 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_permanent_failure"))) TS_ChannelMonitorUpdateStatus_permanent_failure() {
24232         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_permanent_failure());
24233         return ret_conv;
24234 }
24235
24236 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_eq"))) TS_ChannelMonitorUpdateStatus_eq(uint64_t a, uint64_t b) {
24237         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
24238         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
24239         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
24240         return ret_conv;
24241 }
24242
24243 void  __attribute__((export_name("TS_Watch_free"))) TS_Watch_free(uint64_t this_ptr) {
24244         if (!ptr_is_owned(this_ptr)) return;
24245         void* this_ptr_ptr = untag_ptr(this_ptr);
24246         CHECK_ACCESS(this_ptr_ptr);
24247         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
24248         FREE(untag_ptr(this_ptr));
24249         Watch_free(this_ptr_conv);
24250 }
24251
24252 void  __attribute__((export_name("TS_Filter_free"))) TS_Filter_free(uint64_t this_ptr) {
24253         if (!ptr_is_owned(this_ptr)) return;
24254         void* this_ptr_ptr = untag_ptr(this_ptr);
24255         CHECK_ACCESS(this_ptr_ptr);
24256         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
24257         FREE(untag_ptr(this_ptr));
24258         Filter_free(this_ptr_conv);
24259 }
24260
24261 void  __attribute__((export_name("TS_WatchedOutput_free"))) TS_WatchedOutput_free(uint64_t this_obj) {
24262         LDKWatchedOutput this_obj_conv;
24263         this_obj_conv.inner = untag_ptr(this_obj);
24264         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24266         WatchedOutput_free(this_obj_conv);
24267 }
24268
24269 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_block_hash"))) TS_WatchedOutput_get_block_hash(uint64_t this_ptr) {
24270         LDKWatchedOutput this_ptr_conv;
24271         this_ptr_conv.inner = untag_ptr(this_ptr);
24272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24274         this_ptr_conv.is_owned = false;
24275         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24276         memcpy(ret_arr->elems, WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
24277         return ret_arr;
24278 }
24279
24280 void  __attribute__((export_name("TS_WatchedOutput_set_block_hash"))) TS_WatchedOutput_set_block_hash(uint64_t this_ptr, int8_tArray val) {
24281         LDKWatchedOutput this_ptr_conv;
24282         this_ptr_conv.inner = untag_ptr(this_ptr);
24283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24285         this_ptr_conv.is_owned = false;
24286         LDKThirtyTwoBytes val_ref;
24287         CHECK(val->arr_len == 32);
24288         memcpy(val_ref.data, val->elems, 32); FREE(val);
24289         WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
24290 }
24291
24292 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_outpoint"))) TS_WatchedOutput_get_outpoint(uint64_t this_ptr) {
24293         LDKWatchedOutput this_ptr_conv;
24294         this_ptr_conv.inner = untag_ptr(this_ptr);
24295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24297         this_ptr_conv.is_owned = false;
24298         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
24299         uint64_t ret_ref = 0;
24300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24302         return ret_ref;
24303 }
24304
24305 void  __attribute__((export_name("TS_WatchedOutput_set_outpoint"))) TS_WatchedOutput_set_outpoint(uint64_t this_ptr, uint64_t val) {
24306         LDKWatchedOutput this_ptr_conv;
24307         this_ptr_conv.inner = untag_ptr(this_ptr);
24308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24310         this_ptr_conv.is_owned = false;
24311         LDKOutPoint val_conv;
24312         val_conv.inner = untag_ptr(val);
24313         val_conv.is_owned = ptr_is_owned(val);
24314         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24315         val_conv = OutPoint_clone(&val_conv);
24316         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
24317 }
24318
24319 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_script_pubkey"))) TS_WatchedOutput_get_script_pubkey(uint64_t this_ptr) {
24320         LDKWatchedOutput this_ptr_conv;
24321         this_ptr_conv.inner = untag_ptr(this_ptr);
24322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24324         this_ptr_conv.is_owned = false;
24325         LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
24326         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24327         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24328         return ret_arr;
24329 }
24330
24331 void  __attribute__((export_name("TS_WatchedOutput_set_script_pubkey"))) TS_WatchedOutput_set_script_pubkey(uint64_t this_ptr, int8_tArray val) {
24332         LDKWatchedOutput this_ptr_conv;
24333         this_ptr_conv.inner = untag_ptr(this_ptr);
24334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24336         this_ptr_conv.is_owned = false;
24337         LDKCVec_u8Z val_ref;
24338         val_ref.datalen = val->arr_len;
24339         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
24340         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
24341         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
24342 }
24343
24344 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) {
24345         LDKThirtyTwoBytes block_hash_arg_ref;
24346         CHECK(block_hash_arg->arr_len == 32);
24347         memcpy(block_hash_arg_ref.data, block_hash_arg->elems, 32); FREE(block_hash_arg);
24348         LDKOutPoint outpoint_arg_conv;
24349         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
24350         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
24351         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
24352         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
24353         LDKCVec_u8Z script_pubkey_arg_ref;
24354         script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
24355         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
24356         memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
24357         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
24358         uint64_t ret_ref = 0;
24359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24361         return ret_ref;
24362 }
24363
24364 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
24365         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
24366         uint64_t ret_ref = 0;
24367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24369         return ret_ref;
24370 }
24371 int64_t  __attribute__((export_name("TS_WatchedOutput_clone_ptr"))) TS_WatchedOutput_clone_ptr(uint64_t arg) {
24372         LDKWatchedOutput arg_conv;
24373         arg_conv.inner = untag_ptr(arg);
24374         arg_conv.is_owned = ptr_is_owned(arg);
24375         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24376         arg_conv.is_owned = false;
24377         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
24378         return ret_conv;
24379 }
24380
24381 uint64_t  __attribute__((export_name("TS_WatchedOutput_clone"))) TS_WatchedOutput_clone(uint64_t orig) {
24382         LDKWatchedOutput orig_conv;
24383         orig_conv.inner = untag_ptr(orig);
24384         orig_conv.is_owned = ptr_is_owned(orig);
24385         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24386         orig_conv.is_owned = false;
24387         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
24388         uint64_t ret_ref = 0;
24389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24391         return ret_ref;
24392 }
24393
24394 jboolean  __attribute__((export_name("TS_WatchedOutput_eq"))) TS_WatchedOutput_eq(uint64_t a, uint64_t b) {
24395         LDKWatchedOutput a_conv;
24396         a_conv.inner = untag_ptr(a);
24397         a_conv.is_owned = ptr_is_owned(a);
24398         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24399         a_conv.is_owned = false;
24400         LDKWatchedOutput b_conv;
24401         b_conv.inner = untag_ptr(b);
24402         b_conv.is_owned = ptr_is_owned(b);
24403         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24404         b_conv.is_owned = false;
24405         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
24406         return ret_conv;
24407 }
24408
24409 int64_t  __attribute__((export_name("TS_WatchedOutput_hash"))) TS_WatchedOutput_hash(uint64_t o) {
24410         LDKWatchedOutput o_conv;
24411         o_conv.inner = untag_ptr(o);
24412         o_conv.is_owned = ptr_is_owned(o);
24413         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24414         o_conv.is_owned = false;
24415         int64_t ret_conv = WatchedOutput_hash(&o_conv);
24416         return ret_conv;
24417 }
24418
24419 void  __attribute__((export_name("TS_BroadcasterInterface_free"))) TS_BroadcasterInterface_free(uint64_t this_ptr) {
24420         if (!ptr_is_owned(this_ptr)) return;
24421         void* this_ptr_ptr = untag_ptr(this_ptr);
24422         CHECK_ACCESS(this_ptr_ptr);
24423         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
24424         FREE(untag_ptr(this_ptr));
24425         BroadcasterInterface_free(this_ptr_conv);
24426 }
24427
24428 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_clone"))) TS_ConfirmationTarget_clone(uint64_t orig) {
24429         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
24430         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
24431         return ret_conv;
24432 }
24433
24434 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_background"))) TS_ConfirmationTarget_background() {
24435         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
24436         return ret_conv;
24437 }
24438
24439 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_normal"))) TS_ConfirmationTarget_normal() {
24440         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
24441         return ret_conv;
24442 }
24443
24444 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_high_priority"))) TS_ConfirmationTarget_high_priority() {
24445         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
24446         return ret_conv;
24447 }
24448
24449 int64_t  __attribute__((export_name("TS_ConfirmationTarget_hash"))) TS_ConfirmationTarget_hash(uint64_t o) {
24450         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
24451         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
24452         return ret_conv;
24453 }
24454
24455 jboolean  __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint64_t a, uint64_t b) {
24456         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
24457         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
24458         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
24459         return ret_conv;
24460 }
24461
24462 void  __attribute__((export_name("TS_FeeEstimator_free"))) TS_FeeEstimator_free(uint64_t this_ptr) {
24463         if (!ptr_is_owned(this_ptr)) return;
24464         void* this_ptr_ptr = untag_ptr(this_ptr);
24465         CHECK_ACCESS(this_ptr_ptr);
24466         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
24467         FREE(untag_ptr(this_ptr));
24468         FeeEstimator_free(this_ptr_conv);
24469 }
24470
24471 void  __attribute__((export_name("TS_MonitorUpdateId_free"))) TS_MonitorUpdateId_free(uint64_t this_obj) {
24472         LDKMonitorUpdateId this_obj_conv;
24473         this_obj_conv.inner = untag_ptr(this_obj);
24474         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24476         MonitorUpdateId_free(this_obj_conv);
24477 }
24478
24479 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
24480         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
24481         uint64_t ret_ref = 0;
24482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24484         return ret_ref;
24485 }
24486 int64_t  __attribute__((export_name("TS_MonitorUpdateId_clone_ptr"))) TS_MonitorUpdateId_clone_ptr(uint64_t arg) {
24487         LDKMonitorUpdateId arg_conv;
24488         arg_conv.inner = untag_ptr(arg);
24489         arg_conv.is_owned = ptr_is_owned(arg);
24490         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24491         arg_conv.is_owned = false;
24492         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
24493         return ret_conv;
24494 }
24495
24496 uint64_t  __attribute__((export_name("TS_MonitorUpdateId_clone"))) TS_MonitorUpdateId_clone(uint64_t orig) {
24497         LDKMonitorUpdateId orig_conv;
24498         orig_conv.inner = untag_ptr(orig);
24499         orig_conv.is_owned = ptr_is_owned(orig);
24500         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24501         orig_conv.is_owned = false;
24502         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
24503         uint64_t ret_ref = 0;
24504         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24505         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24506         return ret_ref;
24507 }
24508
24509 int64_t  __attribute__((export_name("TS_MonitorUpdateId_hash"))) TS_MonitorUpdateId_hash(uint64_t o) {
24510         LDKMonitorUpdateId o_conv;
24511         o_conv.inner = untag_ptr(o);
24512         o_conv.is_owned = ptr_is_owned(o);
24513         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24514         o_conv.is_owned = false;
24515         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
24516         return ret_conv;
24517 }
24518
24519 jboolean  __attribute__((export_name("TS_MonitorUpdateId_eq"))) TS_MonitorUpdateId_eq(uint64_t a, uint64_t b) {
24520         LDKMonitorUpdateId a_conv;
24521         a_conv.inner = untag_ptr(a);
24522         a_conv.is_owned = ptr_is_owned(a);
24523         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24524         a_conv.is_owned = false;
24525         LDKMonitorUpdateId b_conv;
24526         b_conv.inner = untag_ptr(b);
24527         b_conv.is_owned = ptr_is_owned(b);
24528         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24529         b_conv.is_owned = false;
24530         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
24531         return ret_conv;
24532 }
24533
24534 void  __attribute__((export_name("TS_Persist_free"))) TS_Persist_free(uint64_t this_ptr) {
24535         if (!ptr_is_owned(this_ptr)) return;
24536         void* this_ptr_ptr = untag_ptr(this_ptr);
24537         CHECK_ACCESS(this_ptr_ptr);
24538         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
24539         FREE(untag_ptr(this_ptr));
24540         Persist_free(this_ptr_conv);
24541 }
24542
24543 void  __attribute__((export_name("TS_LockedChannelMonitor_free"))) TS_LockedChannelMonitor_free(uint64_t this_obj) {
24544         LDKLockedChannelMonitor this_obj_conv;
24545         this_obj_conv.inner = untag_ptr(this_obj);
24546         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24548         LockedChannelMonitor_free(this_obj_conv);
24549 }
24550
24551 void  __attribute__((export_name("TS_ChainMonitor_free"))) TS_ChainMonitor_free(uint64_t this_obj) {
24552         LDKChainMonitor this_obj_conv;
24553         this_obj_conv.inner = untag_ptr(this_obj);
24554         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24556         ChainMonitor_free(this_obj_conv);
24557 }
24558
24559 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) {
24560         void* chain_source_ptr = untag_ptr(chain_source);
24561         CHECK_ACCESS(chain_source_ptr);
24562         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
24563         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
24564         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
24565                 // Manually implement clone for Java trait instances
24566                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
24567                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24568                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
24569                 }
24570         }
24571         void* broadcaster_ptr = untag_ptr(broadcaster);
24572         CHECK_ACCESS(broadcaster_ptr);
24573         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24574         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24575                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24576                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24577         }
24578         void* logger_ptr = untag_ptr(logger);
24579         CHECK_ACCESS(logger_ptr);
24580         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24581         if (logger_conv.free == LDKLogger_JCalls_free) {
24582                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24583                 LDKLogger_JCalls_cloned(&logger_conv);
24584         }
24585         void* feeest_ptr = untag_ptr(feeest);
24586         CHECK_ACCESS(feeest_ptr);
24587         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
24588         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
24589                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24590                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
24591         }
24592         void* persister_ptr = untag_ptr(persister);
24593         CHECK_ACCESS(persister_ptr);
24594         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
24595         if (persister_conv.free == LDKPersist_JCalls_free) {
24596                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24597                 LDKPersist_JCalls_cloned(&persister_conv);
24598         }
24599         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
24600         uint64_t ret_ref = 0;
24601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24603         return ret_ref;
24604 }
24605
24606 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_get_claimable_balances"))) TS_ChainMonitor_get_claimable_balances(uint64_t this_arg, uint64_tArray ignored_channels) {
24607         LDKChainMonitor this_arg_conv;
24608         this_arg_conv.inner = untag_ptr(this_arg);
24609         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24611         this_arg_conv.is_owned = false;
24612         LDKCVec_ChannelDetailsZ ignored_channels_constr;
24613         ignored_channels_constr.datalen = ignored_channels->arr_len;
24614         if (ignored_channels_constr.datalen > 0)
24615                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
24616         else
24617                 ignored_channels_constr.data = NULL;
24618         uint64_t* ignored_channels_vals = ignored_channels->elems;
24619         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
24620                 uint64_t ignored_channels_conv_16 = ignored_channels_vals[q];
24621                 LDKChannelDetails ignored_channels_conv_16_conv;
24622                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
24623                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
24624                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
24625                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
24626                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
24627         }
24628         FREE(ignored_channels);
24629         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
24630         uint64_tArray ret_arr = NULL;
24631         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24632         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24633         for (size_t j = 0; j < ret_var.datalen; j++) {
24634                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24635                 *ret_conv_9_copy = ret_var.data[j];
24636                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
24637                 ret_arr_ptr[j] = ret_conv_9_ref;
24638         }
24639         
24640         FREE(ret_var.data);
24641         return ret_arr;
24642 }
24643
24644 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_monitor"))) TS_ChainMonitor_get_monitor(uint64_t this_arg, uint64_t funding_txo) {
24645         LDKChainMonitor this_arg_conv;
24646         this_arg_conv.inner = untag_ptr(this_arg);
24647         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24649         this_arg_conv.is_owned = false;
24650         LDKOutPoint funding_txo_conv;
24651         funding_txo_conv.inner = untag_ptr(funding_txo);
24652         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
24653         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
24654         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
24655         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
24656         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
24657         return tag_ptr(ret_conv, true);
24658 }
24659
24660 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ChainMonitor_list_monitors(uint64_t this_arg) {
24661         LDKChainMonitor this_arg_conv;
24662         this_arg_conv.inner = untag_ptr(this_arg);
24663         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24665         this_arg_conv.is_owned = false;
24666         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
24667         uint64_tArray ret_arr = NULL;
24668         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24669         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24670         for (size_t k = 0; k < ret_var.datalen; k++) {
24671                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
24672                 uint64_t ret_conv_10_ref = 0;
24673                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
24674                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
24675                 ret_arr_ptr[k] = ret_conv_10_ref;
24676         }
24677         
24678         FREE(ret_var.data);
24679         return ret_arr;
24680 }
24681
24682 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_pending_monitor_updates"))) TS_ChainMonitor_list_pending_monitor_updates(uint64_t this_arg) {
24683         LDKChainMonitor this_arg_conv;
24684         this_arg_conv.inner = untag_ptr(this_arg);
24685         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24687         this_arg_conv.is_owned = false;
24688         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
24689         uint64_tArray ret_arr = NULL;
24690         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24691         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24692         for (size_t p = 0; p < ret_var.datalen; p++) {
24693                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
24694                 *ret_conv_41_conv = ret_var.data[p];
24695                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
24696         }
24697         
24698         FREE(ret_var.data);
24699         return ret_arr;
24700 }
24701
24702 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) {
24703         LDKChainMonitor this_arg_conv;
24704         this_arg_conv.inner = untag_ptr(this_arg);
24705         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24707         this_arg_conv.is_owned = false;
24708         LDKOutPoint funding_txo_conv;
24709         funding_txo_conv.inner = untag_ptr(funding_txo);
24710         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
24711         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
24712         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
24713         LDKMonitorUpdateId completed_update_id_conv;
24714         completed_update_id_conv.inner = untag_ptr(completed_update_id);
24715         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
24716         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
24717         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
24718         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
24719         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
24720         return tag_ptr(ret_conv, true);
24721 }
24722
24723 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Listen"))) TS_ChainMonitor_as_Listen(uint64_t this_arg) {
24724         LDKChainMonitor this_arg_conv;
24725         this_arg_conv.inner = untag_ptr(this_arg);
24726         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24728         this_arg_conv.is_owned = false;
24729         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
24730         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
24731         return tag_ptr(ret_ret, true);
24732 }
24733
24734 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Confirm"))) TS_ChainMonitor_as_Confirm(uint64_t this_arg) {
24735         LDKChainMonitor this_arg_conv;
24736         this_arg_conv.inner = untag_ptr(this_arg);
24737         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24739         this_arg_conv.is_owned = false;
24740         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
24741         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
24742         return tag_ptr(ret_ret, true);
24743 }
24744
24745 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Watch"))) TS_ChainMonitor_as_Watch(uint64_t this_arg) {
24746         LDKChainMonitor this_arg_conv;
24747         this_arg_conv.inner = untag_ptr(this_arg);
24748         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24750         this_arg_conv.is_owned = false;
24751         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
24752         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
24753         return tag_ptr(ret_ret, true);
24754 }
24755
24756 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_EventsProvider"))) TS_ChainMonitor_as_EventsProvider(uint64_t this_arg) {
24757         LDKChainMonitor this_arg_conv;
24758         this_arg_conv.inner = untag_ptr(this_arg);
24759         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24761         this_arg_conv.is_owned = false;
24762         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
24763         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
24764         return tag_ptr(ret_ret, true);
24765 }
24766
24767 void  __attribute__((export_name("TS_ChannelMonitorUpdate_free"))) TS_ChannelMonitorUpdate_free(uint64_t this_obj) {
24768         LDKChannelMonitorUpdate this_obj_conv;
24769         this_obj_conv.inner = untag_ptr(this_obj);
24770         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24772         ChannelMonitorUpdate_free(this_obj_conv);
24773 }
24774
24775 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_get_update_id"))) TS_ChannelMonitorUpdate_get_update_id(uint64_t this_ptr) {
24776         LDKChannelMonitorUpdate this_ptr_conv;
24777         this_ptr_conv.inner = untag_ptr(this_ptr);
24778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24780         this_ptr_conv.is_owned = false;
24781         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
24782         return ret_conv;
24783 }
24784
24785 void  __attribute__((export_name("TS_ChannelMonitorUpdate_set_update_id"))) TS_ChannelMonitorUpdate_set_update_id(uint64_t this_ptr, int64_t val) {
24786         LDKChannelMonitorUpdate this_ptr_conv;
24787         this_ptr_conv.inner = untag_ptr(this_ptr);
24788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24790         this_ptr_conv.is_owned = false;
24791         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
24792 }
24793
24794 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
24795         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
24796         uint64_t ret_ref = 0;
24797         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24798         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24799         return ret_ref;
24800 }
24801 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone_ptr"))) TS_ChannelMonitorUpdate_clone_ptr(uint64_t arg) {
24802         LDKChannelMonitorUpdate arg_conv;
24803         arg_conv.inner = untag_ptr(arg);
24804         arg_conv.is_owned = ptr_is_owned(arg);
24805         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24806         arg_conv.is_owned = false;
24807         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
24808         return ret_conv;
24809 }
24810
24811 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone"))) TS_ChannelMonitorUpdate_clone(uint64_t orig) {
24812         LDKChannelMonitorUpdate orig_conv;
24813         orig_conv.inner = untag_ptr(orig);
24814         orig_conv.is_owned = ptr_is_owned(orig);
24815         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24816         orig_conv.is_owned = false;
24817         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
24818         uint64_t ret_ref = 0;
24819         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24820         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24821         return ret_ref;
24822 }
24823
24824 int8_tArray  __attribute__((export_name("TS_ChannelMonitorUpdate_write"))) TS_ChannelMonitorUpdate_write(uint64_t obj) {
24825         LDKChannelMonitorUpdate obj_conv;
24826         obj_conv.inner = untag_ptr(obj);
24827         obj_conv.is_owned = ptr_is_owned(obj);
24828         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24829         obj_conv.is_owned = false;
24830         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
24831         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24832         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24833         CVec_u8Z_free(ret_var);
24834         return ret_arr;
24835 }
24836
24837 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_read"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
24838         LDKu8slice ser_ref;
24839         ser_ref.datalen = ser->arr_len;
24840         ser_ref.data = ser->elems;
24841         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
24842         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
24843         FREE(ser);
24844         return tag_ptr(ret_conv, true);
24845 }
24846
24847 void  __attribute__((export_name("TS_MonitorEvent_free"))) TS_MonitorEvent_free(uint64_t this_ptr) {
24848         if (!ptr_is_owned(this_ptr)) return;
24849         void* this_ptr_ptr = untag_ptr(this_ptr);
24850         CHECK_ACCESS(this_ptr_ptr);
24851         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
24852         FREE(untag_ptr(this_ptr));
24853         MonitorEvent_free(this_ptr_conv);
24854 }
24855
24856 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
24857         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
24858         *ret_copy = MonitorEvent_clone(arg);
24859         uint64_t ret_ref = tag_ptr(ret_copy, true);
24860         return ret_ref;
24861 }
24862 int64_t  __attribute__((export_name("TS_MonitorEvent_clone_ptr"))) TS_MonitorEvent_clone_ptr(uint64_t arg) {
24863         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
24864         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
24865         return ret_conv;
24866 }
24867
24868 uint64_t  __attribute__((export_name("TS_MonitorEvent_clone"))) TS_MonitorEvent_clone(uint64_t orig) {
24869         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
24870         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
24871         *ret_copy = MonitorEvent_clone(orig_conv);
24872         uint64_t ret_ref = tag_ptr(ret_copy, true);
24873         return ret_ref;
24874 }
24875
24876 uint64_t  __attribute__((export_name("TS_MonitorEvent_htlcevent"))) TS_MonitorEvent_htlcevent(uint64_t a) {
24877         LDKHTLCUpdate a_conv;
24878         a_conv.inner = untag_ptr(a);
24879         a_conv.is_owned = ptr_is_owned(a);
24880         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24881         a_conv = HTLCUpdate_clone(&a_conv);
24882         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
24883         *ret_copy = MonitorEvent_htlcevent(a_conv);
24884         uint64_t ret_ref = tag_ptr(ret_copy, true);
24885         return ret_ref;
24886 }
24887
24888 uint64_t  __attribute__((export_name("TS_MonitorEvent_commitment_tx_confirmed"))) TS_MonitorEvent_commitment_tx_confirmed(uint64_t a) {
24889         LDKOutPoint a_conv;
24890         a_conv.inner = untag_ptr(a);
24891         a_conv.is_owned = ptr_is_owned(a);
24892         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24893         a_conv = OutPoint_clone(&a_conv);
24894         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
24895         *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
24896         uint64_t ret_ref = tag_ptr(ret_copy, true);
24897         return ret_ref;
24898 }
24899
24900 uint64_t  __attribute__((export_name("TS_MonitorEvent_completed"))) TS_MonitorEvent_completed(uint64_t funding_txo, int64_t monitor_update_id) {
24901         LDKOutPoint funding_txo_conv;
24902         funding_txo_conv.inner = untag_ptr(funding_txo);
24903         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
24904         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
24905         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
24906         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
24907         *ret_copy = MonitorEvent_completed(funding_txo_conv, monitor_update_id);
24908         uint64_t ret_ref = tag_ptr(ret_copy, true);
24909         return ret_ref;
24910 }
24911
24912 uint64_t  __attribute__((export_name("TS_MonitorEvent_update_failed"))) TS_MonitorEvent_update_failed(uint64_t a) {
24913         LDKOutPoint a_conv;
24914         a_conv.inner = untag_ptr(a);
24915         a_conv.is_owned = ptr_is_owned(a);
24916         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24917         a_conv = OutPoint_clone(&a_conv);
24918         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
24919         *ret_copy = MonitorEvent_update_failed(a_conv);
24920         uint64_t ret_ref = tag_ptr(ret_copy, true);
24921         return ret_ref;
24922 }
24923
24924 jboolean  __attribute__((export_name("TS_MonitorEvent_eq"))) TS_MonitorEvent_eq(uint64_t a, uint64_t b) {
24925         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
24926         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
24927         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
24928         return ret_conv;
24929 }
24930
24931 int8_tArray  __attribute__((export_name("TS_MonitorEvent_write"))) TS_MonitorEvent_write(uint64_t obj) {
24932         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
24933         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
24934         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24935         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24936         CVec_u8Z_free(ret_var);
24937         return ret_arr;
24938 }
24939
24940 uint64_t  __attribute__((export_name("TS_MonitorEvent_read"))) TS_MonitorEvent_read(int8_tArray ser) {
24941         LDKu8slice ser_ref;
24942         ser_ref.datalen = ser->arr_len;
24943         ser_ref.data = ser->elems;
24944         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
24945         *ret_conv = MonitorEvent_read(ser_ref);
24946         FREE(ser);
24947         return tag_ptr(ret_conv, true);
24948 }
24949
24950 void  __attribute__((export_name("TS_HTLCUpdate_free"))) TS_HTLCUpdate_free(uint64_t this_obj) {
24951         LDKHTLCUpdate this_obj_conv;
24952         this_obj_conv.inner = untag_ptr(this_obj);
24953         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24955         HTLCUpdate_free(this_obj_conv);
24956 }
24957
24958 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
24959         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
24960         uint64_t ret_ref = 0;
24961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24963         return ret_ref;
24964 }
24965 int64_t  __attribute__((export_name("TS_HTLCUpdate_clone_ptr"))) TS_HTLCUpdate_clone_ptr(uint64_t arg) {
24966         LDKHTLCUpdate arg_conv;
24967         arg_conv.inner = untag_ptr(arg);
24968         arg_conv.is_owned = ptr_is_owned(arg);
24969         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24970         arg_conv.is_owned = false;
24971         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
24972         return ret_conv;
24973 }
24974
24975 uint64_t  __attribute__((export_name("TS_HTLCUpdate_clone"))) TS_HTLCUpdate_clone(uint64_t orig) {
24976         LDKHTLCUpdate orig_conv;
24977         orig_conv.inner = untag_ptr(orig);
24978         orig_conv.is_owned = ptr_is_owned(orig);
24979         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24980         orig_conv.is_owned = false;
24981         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
24982         uint64_t ret_ref = 0;
24983         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24984         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24985         return ret_ref;
24986 }
24987
24988 jboolean  __attribute__((export_name("TS_HTLCUpdate_eq"))) TS_HTLCUpdate_eq(uint64_t a, uint64_t b) {
24989         LDKHTLCUpdate a_conv;
24990         a_conv.inner = untag_ptr(a);
24991         a_conv.is_owned = ptr_is_owned(a);
24992         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24993         a_conv.is_owned = false;
24994         LDKHTLCUpdate b_conv;
24995         b_conv.inner = untag_ptr(b);
24996         b_conv.is_owned = ptr_is_owned(b);
24997         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24998         b_conv.is_owned = false;
24999         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
25000         return ret_conv;
25001 }
25002
25003 int8_tArray  __attribute__((export_name("TS_HTLCUpdate_write"))) TS_HTLCUpdate_write(uint64_t obj) {
25004         LDKHTLCUpdate obj_conv;
25005         obj_conv.inner = untag_ptr(obj);
25006         obj_conv.is_owned = ptr_is_owned(obj);
25007         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25008         obj_conv.is_owned = false;
25009         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
25010         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25011         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25012         CVec_u8Z_free(ret_var);
25013         return ret_arr;
25014 }
25015
25016 uint64_t  __attribute__((export_name("TS_HTLCUpdate_read"))) TS_HTLCUpdate_read(int8_tArray ser) {
25017         LDKu8slice ser_ref;
25018         ser_ref.datalen = ser->arr_len;
25019         ser_ref.data = ser->elems;
25020         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
25021         *ret_conv = HTLCUpdate_read(ser_ref);
25022         FREE(ser);
25023         return tag_ptr(ret_conv, true);
25024 }
25025
25026 void  __attribute__((export_name("TS_Balance_free"))) TS_Balance_free(uint64_t this_ptr) {
25027         if (!ptr_is_owned(this_ptr)) return;
25028         void* this_ptr_ptr = untag_ptr(this_ptr);
25029         CHECK_ACCESS(this_ptr_ptr);
25030         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
25031         FREE(untag_ptr(this_ptr));
25032         Balance_free(this_ptr_conv);
25033 }
25034
25035 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
25036         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25037         *ret_copy = Balance_clone(arg);
25038         uint64_t ret_ref = tag_ptr(ret_copy, true);
25039         return ret_ref;
25040 }
25041 int64_t  __attribute__((export_name("TS_Balance_clone_ptr"))) TS_Balance_clone_ptr(uint64_t arg) {
25042         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
25043         int64_t ret_conv = Balance_clone_ptr(arg_conv);
25044         return ret_conv;
25045 }
25046
25047 uint64_t  __attribute__((export_name("TS_Balance_clone"))) TS_Balance_clone(uint64_t orig) {
25048         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
25049         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25050         *ret_copy = Balance_clone(orig_conv);
25051         uint64_t ret_ref = tag_ptr(ret_copy, true);
25052         return ret_ref;
25053 }
25054
25055 uint64_t  __attribute__((export_name("TS_Balance_claimable_on_channel_close"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
25056         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25057         *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
25058         uint64_t ret_ref = tag_ptr(ret_copy, true);
25059         return ret_ref;
25060 }
25061
25062 uint64_t  __attribute__((export_name("TS_Balance_claimable_awaiting_confirmations"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
25063         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25064         *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
25065         uint64_t ret_ref = tag_ptr(ret_copy, true);
25066         return ret_ref;
25067 }
25068
25069 uint64_t  __attribute__((export_name("TS_Balance_contentious_claimable"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
25070         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25071         *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
25072         uint64_t ret_ref = tag_ptr(ret_copy, true);
25073         return ret_ref;
25074 }
25075
25076 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) {
25077         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25078         *ret_copy = Balance_maybe_timeout_claimable_htlc(claimable_amount_satoshis, claimable_height);
25079         uint64_t ret_ref = tag_ptr(ret_copy, true);
25080         return ret_ref;
25081 }
25082
25083 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) {
25084         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25085         *ret_copy = Balance_maybe_preimage_claimable_htlc(claimable_amount_satoshis, expiry_height);
25086         uint64_t ret_ref = tag_ptr(ret_copy, true);
25087         return ret_ref;
25088 }
25089
25090 uint64_t  __attribute__((export_name("TS_Balance_counterparty_revoked_output_claimable"))) TS_Balance_counterparty_revoked_output_claimable(int64_t claimable_amount_satoshis) {
25091         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25092         *ret_copy = Balance_counterparty_revoked_output_claimable(claimable_amount_satoshis);
25093         uint64_t ret_ref = tag_ptr(ret_copy, true);
25094         return ret_ref;
25095 }
25096
25097 jboolean  __attribute__((export_name("TS_Balance_eq"))) TS_Balance_eq(uint64_t a, uint64_t b) {
25098         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
25099         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
25100         jboolean ret_conv = Balance_eq(a_conv, b_conv);
25101         return ret_conv;
25102 }
25103
25104 void  __attribute__((export_name("TS_ChannelMonitor_free"))) TS_ChannelMonitor_free(uint64_t this_obj) {
25105         LDKChannelMonitor this_obj_conv;
25106         this_obj_conv.inner = untag_ptr(this_obj);
25107         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25109         ChannelMonitor_free(this_obj_conv);
25110 }
25111
25112 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
25113         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
25114         uint64_t ret_ref = 0;
25115         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25116         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25117         return ret_ref;
25118 }
25119 int64_t  __attribute__((export_name("TS_ChannelMonitor_clone_ptr"))) TS_ChannelMonitor_clone_ptr(uint64_t arg) {
25120         LDKChannelMonitor arg_conv;
25121         arg_conv.inner = untag_ptr(arg);
25122         arg_conv.is_owned = ptr_is_owned(arg);
25123         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25124         arg_conv.is_owned = false;
25125         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
25126         return ret_conv;
25127 }
25128
25129 uint64_t  __attribute__((export_name("TS_ChannelMonitor_clone"))) TS_ChannelMonitor_clone(uint64_t orig) {
25130         LDKChannelMonitor orig_conv;
25131         orig_conv.inner = untag_ptr(orig);
25132         orig_conv.is_owned = ptr_is_owned(orig);
25133         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25134         orig_conv.is_owned = false;
25135         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
25136         uint64_t ret_ref = 0;
25137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25139         return ret_ref;
25140 }
25141
25142 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_write"))) TS_ChannelMonitor_write(uint64_t obj) {
25143         LDKChannelMonitor obj_conv;
25144         obj_conv.inner = untag_ptr(obj);
25145         obj_conv.is_owned = ptr_is_owned(obj);
25146         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25147         obj_conv.is_owned = false;
25148         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
25149         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25150         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25151         CVec_u8Z_free(ret_var);
25152         return ret_arr;
25153 }
25154
25155 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) {
25156         LDKChannelMonitor this_arg_conv;
25157         this_arg_conv.inner = untag_ptr(this_arg);
25158         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25160         this_arg_conv.is_owned = false;
25161         LDKChannelMonitorUpdate updates_conv;
25162         updates_conv.inner = untag_ptr(updates);
25163         updates_conv.is_owned = ptr_is_owned(updates);
25164         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
25165         updates_conv.is_owned = false;
25166         void* broadcaster_ptr = untag_ptr(broadcaster);
25167         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
25168         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
25169         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25170         CHECK_ACCESS(fee_estimator_ptr);
25171         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25172         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25173                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25174                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25175         }
25176         void* logger_ptr = untag_ptr(logger);
25177         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
25178         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
25179         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
25180         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
25181         return tag_ptr(ret_conv, true);
25182 }
25183
25184 int64_t  __attribute__((export_name("TS_ChannelMonitor_get_latest_update_id"))) TS_ChannelMonitor_get_latest_update_id(uint64_t this_arg) {
25185         LDKChannelMonitor this_arg_conv;
25186         this_arg_conv.inner = untag_ptr(this_arg);
25187         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25189         this_arg_conv.is_owned = false;
25190         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
25191         return ret_conv;
25192 }
25193
25194 uint64_t  __attribute__((export_name("TS_ChannelMonitor_get_funding_txo"))) TS_ChannelMonitor_get_funding_txo(uint64_t this_arg) {
25195         LDKChannelMonitor this_arg_conv;
25196         this_arg_conv.inner = untag_ptr(this_arg);
25197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25199         this_arg_conv.is_owned = false;
25200         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
25201         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
25202         return tag_ptr(ret_conv, true);
25203 }
25204
25205 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_outputs_to_watch"))) TS_ChannelMonitor_get_outputs_to_watch(uint64_t this_arg) {
25206         LDKChannelMonitor this_arg_conv;
25207         this_arg_conv.inner = untag_ptr(this_arg);
25208         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25210         this_arg_conv.is_owned = false;
25211         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
25212         uint64_tArray ret_arr = NULL;
25213         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25214         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25215         for (size_t o = 0; o < ret_var.datalen; o++) {
25216                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
25217                 *ret_conv_40_conv = ret_var.data[o];
25218                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
25219         }
25220         
25221         FREE(ret_var.data);
25222         return ret_arr;
25223 }
25224
25225 void  __attribute__((export_name("TS_ChannelMonitor_load_outputs_to_watch"))) TS_ChannelMonitor_load_outputs_to_watch(uint64_t this_arg, uint64_t filter) {
25226         LDKChannelMonitor this_arg_conv;
25227         this_arg_conv.inner = untag_ptr(this_arg);
25228         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25230         this_arg_conv.is_owned = false;
25231         void* filter_ptr = untag_ptr(filter);
25232         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
25233         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
25234         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
25235 }
25236
25237 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) {
25238         LDKChannelMonitor this_arg_conv;
25239         this_arg_conv.inner = untag_ptr(this_arg);
25240         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25242         this_arg_conv.is_owned = false;
25243         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
25244         uint64_tArray ret_arr = NULL;
25245         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25246         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25247         for (size_t o = 0; o < ret_var.datalen; o++) {
25248                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
25249                 *ret_conv_14_copy = ret_var.data[o];
25250                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
25251                 ret_arr_ptr[o] = ret_conv_14_ref;
25252         }
25253         
25254         FREE(ret_var.data);
25255         return ret_arr;
25256 }
25257
25258 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_and_clear_pending_events"))) TS_ChannelMonitor_get_and_clear_pending_events(uint64_t this_arg) {
25259         LDKChannelMonitor this_arg_conv;
25260         this_arg_conv.inner = untag_ptr(this_arg);
25261         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25263         this_arg_conv.is_owned = false;
25264         LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
25265         uint64_tArray ret_arr = NULL;
25266         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25267         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25268         for (size_t h = 0; h < ret_var.datalen; h++) {
25269                 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
25270                 *ret_conv_7_copy = ret_var.data[h];
25271                 uint64_t ret_conv_7_ref = tag_ptr(ret_conv_7_copy, true);
25272                 ret_arr_ptr[h] = ret_conv_7_ref;
25273         }
25274         
25275         FREE(ret_var.data);
25276         return ret_arr;
25277 }
25278
25279 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_get_counterparty_node_id"))) TS_ChannelMonitor_get_counterparty_node_id(uint64_t this_arg) {
25280         LDKChannelMonitor this_arg_conv;
25281         this_arg_conv.inner = untag_ptr(this_arg);
25282         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25284         this_arg_conv.is_owned = false;
25285         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
25286         memcpy(ret_arr->elems, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form, 33);
25287         return ret_arr;
25288 }
25289
25290 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) {
25291         LDKChannelMonitor this_arg_conv;
25292         this_arg_conv.inner = untag_ptr(this_arg);
25293         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25295         this_arg_conv.is_owned = false;
25296         void* logger_ptr = untag_ptr(logger);
25297         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
25298         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
25299         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
25300         ptrArray ret_arr = NULL;
25301         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
25302         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
25303         for (size_t m = 0; m < ret_var.datalen; m++) {
25304                 LDKTransaction ret_conv_12_var = ret_var.data[m];
25305                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
25306                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
25307                 Transaction_free(ret_conv_12_var);
25308                 ret_arr_ptr[m] = ret_conv_12_arr;
25309         }
25310         
25311         FREE(ret_var.data);
25312         return ret_arr;
25313 }
25314
25315 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) {
25316         LDKChannelMonitor this_arg_conv;
25317         this_arg_conv.inner = untag_ptr(this_arg);
25318         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25320         this_arg_conv.is_owned = false;
25321         unsigned char header_arr[80];
25322         CHECK(header->arr_len == 80);
25323         memcpy(header_arr, header->elems, 80); FREE(header);
25324         unsigned char (*header_ref)[80] = &header_arr;
25325         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
25326         txdata_constr.datalen = txdata->arr_len;
25327         if (txdata_constr.datalen > 0)
25328                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
25329         else
25330                 txdata_constr.data = NULL;
25331         uint64_t* txdata_vals = txdata->elems;
25332         for (size_t c = 0; c < txdata_constr.datalen; c++) {
25333                 uint64_t txdata_conv_28 = txdata_vals[c];
25334                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
25335                 CHECK_ACCESS(txdata_conv_28_ptr);
25336                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
25337                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
25338                 txdata_constr.data[c] = txdata_conv_28_conv;
25339         }
25340         FREE(txdata);
25341         void* broadcaster_ptr = untag_ptr(broadcaster);
25342         CHECK_ACCESS(broadcaster_ptr);
25343         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25344         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25345                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25346                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25347         }
25348         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25349         CHECK_ACCESS(fee_estimator_ptr);
25350         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25351         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25352                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25353                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25354         }
25355         void* logger_ptr = untag_ptr(logger);
25356         CHECK_ACCESS(logger_ptr);
25357         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25358         if (logger_conv.free == LDKLogger_JCalls_free) {
25359                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25360                 LDKLogger_JCalls_cloned(&logger_conv);
25361         }
25362         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);
25363         uint64_tArray ret_arr = NULL;
25364         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25365         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25366         for (size_t n = 0; n < ret_var.datalen; n++) {
25367                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25368                 *ret_conv_39_conv = ret_var.data[n];
25369                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
25370         }
25371         
25372         FREE(ret_var.data);
25373         return ret_arr;
25374 }
25375
25376 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) {
25377         LDKChannelMonitor this_arg_conv;
25378         this_arg_conv.inner = untag_ptr(this_arg);
25379         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25381         this_arg_conv.is_owned = false;
25382         unsigned char header_arr[80];
25383         CHECK(header->arr_len == 80);
25384         memcpy(header_arr, header->elems, 80); FREE(header);
25385         unsigned char (*header_ref)[80] = &header_arr;
25386         void* broadcaster_ptr = untag_ptr(broadcaster);
25387         CHECK_ACCESS(broadcaster_ptr);
25388         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25389         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25390                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25391                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25392         }
25393         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25394         CHECK_ACCESS(fee_estimator_ptr);
25395         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25396         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25397                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25398                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25399         }
25400         void* logger_ptr = untag_ptr(logger);
25401         CHECK_ACCESS(logger_ptr);
25402         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25403         if (logger_conv.free == LDKLogger_JCalls_free) {
25404                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25405                 LDKLogger_JCalls_cloned(&logger_conv);
25406         }
25407         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
25408 }
25409
25410 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) {
25411         LDKChannelMonitor this_arg_conv;
25412         this_arg_conv.inner = untag_ptr(this_arg);
25413         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25415         this_arg_conv.is_owned = false;
25416         unsigned char header_arr[80];
25417         CHECK(header->arr_len == 80);
25418         memcpy(header_arr, header->elems, 80); FREE(header);
25419         unsigned char (*header_ref)[80] = &header_arr;
25420         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
25421         txdata_constr.datalen = txdata->arr_len;
25422         if (txdata_constr.datalen > 0)
25423                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
25424         else
25425                 txdata_constr.data = NULL;
25426         uint64_t* txdata_vals = txdata->elems;
25427         for (size_t c = 0; c < txdata_constr.datalen; c++) {
25428                 uint64_t txdata_conv_28 = txdata_vals[c];
25429                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
25430                 CHECK_ACCESS(txdata_conv_28_ptr);
25431                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
25432                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
25433                 txdata_constr.data[c] = txdata_conv_28_conv;
25434         }
25435         FREE(txdata);
25436         void* broadcaster_ptr = untag_ptr(broadcaster);
25437         CHECK_ACCESS(broadcaster_ptr);
25438         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25439         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25440                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25441                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25442         }
25443         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25444         CHECK_ACCESS(fee_estimator_ptr);
25445         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25446         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25447                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25448                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25449         }
25450         void* logger_ptr = untag_ptr(logger);
25451         CHECK_ACCESS(logger_ptr);
25452         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25453         if (logger_conv.free == LDKLogger_JCalls_free) {
25454                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25455                 LDKLogger_JCalls_cloned(&logger_conv);
25456         }
25457         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);
25458         uint64_tArray ret_arr = NULL;
25459         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25460         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25461         for (size_t n = 0; n < ret_var.datalen; n++) {
25462                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25463                 *ret_conv_39_conv = ret_var.data[n];
25464                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
25465         }
25466         
25467         FREE(ret_var.data);
25468         return ret_arr;
25469 }
25470
25471 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) {
25472         LDKChannelMonitor this_arg_conv;
25473         this_arg_conv.inner = untag_ptr(this_arg);
25474         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25476         this_arg_conv.is_owned = false;
25477         unsigned char txid_arr[32];
25478         CHECK(txid->arr_len == 32);
25479         memcpy(txid_arr, txid->elems, 32); FREE(txid);
25480         unsigned char (*txid_ref)[32] = &txid_arr;
25481         void* broadcaster_ptr = untag_ptr(broadcaster);
25482         CHECK_ACCESS(broadcaster_ptr);
25483         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25484         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25485                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25486                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25487         }
25488         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25489         CHECK_ACCESS(fee_estimator_ptr);
25490         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25491         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25492                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25493                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25494         }
25495         void* logger_ptr = untag_ptr(logger);
25496         CHECK_ACCESS(logger_ptr);
25497         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25498         if (logger_conv.free == LDKLogger_JCalls_free) {
25499                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25500                 LDKLogger_JCalls_cloned(&logger_conv);
25501         }
25502         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
25503 }
25504
25505 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) {
25506         LDKChannelMonitor this_arg_conv;
25507         this_arg_conv.inner = untag_ptr(this_arg);
25508         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25510         this_arg_conv.is_owned = false;
25511         unsigned char header_arr[80];
25512         CHECK(header->arr_len == 80);
25513         memcpy(header_arr, header->elems, 80); FREE(header);
25514         unsigned char (*header_ref)[80] = &header_arr;
25515         void* broadcaster_ptr = untag_ptr(broadcaster);
25516         CHECK_ACCESS(broadcaster_ptr);
25517         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
25518         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
25519                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25520                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
25521         }
25522         void* fee_estimator_ptr = untag_ptr(fee_estimator);
25523         CHECK_ACCESS(fee_estimator_ptr);
25524         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
25525         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
25526                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25527                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
25528         }
25529         void* logger_ptr = untag_ptr(logger);
25530         CHECK_ACCESS(logger_ptr);
25531         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
25532         if (logger_conv.free == LDKLogger_JCalls_free) {
25533                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25534                 LDKLogger_JCalls_cloned(&logger_conv);
25535         }
25536         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
25537         uint64_tArray ret_arr = NULL;
25538         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25539         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25540         for (size_t n = 0; n < ret_var.datalen; n++) {
25541                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
25542                 *ret_conv_39_conv = ret_var.data[n];
25543                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
25544         }
25545         
25546         FREE(ret_var.data);
25547         return ret_arr;
25548 }
25549
25550 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint64_t this_arg) {
25551         LDKChannelMonitor this_arg_conv;
25552         this_arg_conv.inner = untag_ptr(this_arg);
25553         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25555         this_arg_conv.is_owned = false;
25556         LDKCVec_C2Tuple_TxidBlockHashZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
25557         uint64_tArray ret_arr = NULL;
25558         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25559         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25560         for (size_t z = 0; z < ret_var.datalen; z++) {
25561                 LDKC2Tuple_TxidBlockHashZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ");
25562                 *ret_conv_25_conv = ret_var.data[z];
25563                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
25564         }
25565         
25566         FREE(ret_var.data);
25567         return ret_arr;
25568 }
25569
25570 uint64_t  __attribute__((export_name("TS_ChannelMonitor_current_best_block"))) TS_ChannelMonitor_current_best_block(uint64_t this_arg) {
25571         LDKChannelMonitor this_arg_conv;
25572         this_arg_conv.inner = untag_ptr(this_arg);
25573         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25575         this_arg_conv.is_owned = false;
25576         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
25577         uint64_t ret_ref = 0;
25578         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25579         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25580         return ret_ref;
25581 }
25582
25583 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_claimable_balances"))) TS_ChannelMonitor_get_claimable_balances(uint64_t this_arg) {
25584         LDKChannelMonitor this_arg_conv;
25585         this_arg_conv.inner = untag_ptr(this_arg);
25586         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25588         this_arg_conv.is_owned = false;
25589         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
25590         uint64_tArray ret_arr = NULL;
25591         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
25592         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
25593         for (size_t j = 0; j < ret_var.datalen; j++) {
25594                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
25595                 *ret_conv_9_copy = ret_var.data[j];
25596                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
25597                 ret_arr_ptr[j] = ret_conv_9_ref;
25598         }
25599         
25600         FREE(ret_var.data);
25601         return ret_arr;
25602 }
25603
25604 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_read"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint64_t arg) {
25605         LDKu8slice ser_ref;
25606         ser_ref.datalen = ser->arr_len;
25607         ser_ref.data = ser->elems;
25608         void* arg_ptr = untag_ptr(arg);
25609         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
25610         LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
25611         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
25612         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
25613         FREE(ser);
25614         return tag_ptr(ret_conv, true);
25615 }
25616
25617 void  __attribute__((export_name("TS_OutPoint_free"))) TS_OutPoint_free(uint64_t this_obj) {
25618         LDKOutPoint this_obj_conv;
25619         this_obj_conv.inner = untag_ptr(this_obj);
25620         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25622         OutPoint_free(this_obj_conv);
25623 }
25624
25625 int8_tArray  __attribute__((export_name("TS_OutPoint_get_txid"))) TS_OutPoint_get_txid(uint64_t this_ptr) {
25626         LDKOutPoint this_ptr_conv;
25627         this_ptr_conv.inner = untag_ptr(this_ptr);
25628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25630         this_ptr_conv.is_owned = false;
25631         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25632         memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
25633         return ret_arr;
25634 }
25635
25636 void  __attribute__((export_name("TS_OutPoint_set_txid"))) TS_OutPoint_set_txid(uint64_t this_ptr, int8_tArray val) {
25637         LDKOutPoint this_ptr_conv;
25638         this_ptr_conv.inner = untag_ptr(this_ptr);
25639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25641         this_ptr_conv.is_owned = false;
25642         LDKThirtyTwoBytes val_ref;
25643         CHECK(val->arr_len == 32);
25644         memcpy(val_ref.data, val->elems, 32); FREE(val);
25645         OutPoint_set_txid(&this_ptr_conv, val_ref);
25646 }
25647
25648 int16_t  __attribute__((export_name("TS_OutPoint_get_index"))) TS_OutPoint_get_index(uint64_t this_ptr) {
25649         LDKOutPoint this_ptr_conv;
25650         this_ptr_conv.inner = untag_ptr(this_ptr);
25651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25653         this_ptr_conv.is_owned = false;
25654         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
25655         return ret_conv;
25656 }
25657
25658 void  __attribute__((export_name("TS_OutPoint_set_index"))) TS_OutPoint_set_index(uint64_t this_ptr, int16_t val) {
25659         LDKOutPoint this_ptr_conv;
25660         this_ptr_conv.inner = untag_ptr(this_ptr);
25661         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25663         this_ptr_conv.is_owned = false;
25664         OutPoint_set_index(&this_ptr_conv, val);
25665 }
25666
25667 uint64_t  __attribute__((export_name("TS_OutPoint_new"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
25668         LDKThirtyTwoBytes txid_arg_ref;
25669         CHECK(txid_arg->arr_len == 32);
25670         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
25671         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
25672         uint64_t ret_ref = 0;
25673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25675         return ret_ref;
25676 }
25677
25678 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
25679         LDKOutPoint ret_var = OutPoint_clone(arg);
25680         uint64_t ret_ref = 0;
25681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25683         return ret_ref;
25684 }
25685 int64_t  __attribute__((export_name("TS_OutPoint_clone_ptr"))) TS_OutPoint_clone_ptr(uint64_t arg) {
25686         LDKOutPoint arg_conv;
25687         arg_conv.inner = untag_ptr(arg);
25688         arg_conv.is_owned = ptr_is_owned(arg);
25689         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25690         arg_conv.is_owned = false;
25691         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
25692         return ret_conv;
25693 }
25694
25695 uint64_t  __attribute__((export_name("TS_OutPoint_clone"))) TS_OutPoint_clone(uint64_t orig) {
25696         LDKOutPoint orig_conv;
25697         orig_conv.inner = untag_ptr(orig);
25698         orig_conv.is_owned = ptr_is_owned(orig);
25699         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25700         orig_conv.is_owned = false;
25701         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
25702         uint64_t ret_ref = 0;
25703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25705         return ret_ref;
25706 }
25707
25708 jboolean  __attribute__((export_name("TS_OutPoint_eq"))) TS_OutPoint_eq(uint64_t a, uint64_t b) {
25709         LDKOutPoint a_conv;
25710         a_conv.inner = untag_ptr(a);
25711         a_conv.is_owned = ptr_is_owned(a);
25712         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25713         a_conv.is_owned = false;
25714         LDKOutPoint b_conv;
25715         b_conv.inner = untag_ptr(b);
25716         b_conv.is_owned = ptr_is_owned(b);
25717         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25718         b_conv.is_owned = false;
25719         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
25720         return ret_conv;
25721 }
25722
25723 int64_t  __attribute__((export_name("TS_OutPoint_hash"))) TS_OutPoint_hash(uint64_t o) {
25724         LDKOutPoint o_conv;
25725         o_conv.inner = untag_ptr(o);
25726         o_conv.is_owned = ptr_is_owned(o);
25727         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25728         o_conv.is_owned = false;
25729         int64_t ret_conv = OutPoint_hash(&o_conv);
25730         return ret_conv;
25731 }
25732
25733 int8_tArray  __attribute__((export_name("TS_OutPoint_to_channel_id"))) TS_OutPoint_to_channel_id(uint64_t this_arg) {
25734         LDKOutPoint this_arg_conv;
25735         this_arg_conv.inner = untag_ptr(this_arg);
25736         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25738         this_arg_conv.is_owned = false;
25739         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25740         memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
25741         return ret_arr;
25742 }
25743
25744 int8_tArray  __attribute__((export_name("TS_OutPoint_write"))) TS_OutPoint_write(uint64_t obj) {
25745         LDKOutPoint obj_conv;
25746         obj_conv.inner = untag_ptr(obj);
25747         obj_conv.is_owned = ptr_is_owned(obj);
25748         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25749         obj_conv.is_owned = false;
25750         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
25751         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25752         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25753         CVec_u8Z_free(ret_var);
25754         return ret_arr;
25755 }
25756
25757 uint64_t  __attribute__((export_name("TS_OutPoint_read"))) TS_OutPoint_read(int8_tArray ser) {
25758         LDKu8slice ser_ref;
25759         ser_ref.datalen = ser->arr_len;
25760         ser_ref.data = ser->elems;
25761         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
25762         *ret_conv = OutPoint_read(ser_ref);
25763         FREE(ser);
25764         return tag_ptr(ret_conv, true);
25765 }
25766
25767 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_free"))) TS_DelayedPaymentOutputDescriptor_free(uint64_t this_obj) {
25768         LDKDelayedPaymentOutputDescriptor this_obj_conv;
25769         this_obj_conv.inner = untag_ptr(this_obj);
25770         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25772         DelayedPaymentOutputDescriptor_free(this_obj_conv);
25773 }
25774
25775 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_outpoint"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
25776         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
25777         this_ptr_conv.inner = untag_ptr(this_ptr);
25778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25780         this_ptr_conv.is_owned = false;
25781         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
25782         uint64_t ret_ref = 0;
25783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25785         return ret_ref;
25786 }
25787
25788 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_outpoint"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
25789         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
25790         this_ptr_conv.inner = untag_ptr(this_ptr);
25791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25793         this_ptr_conv.is_owned = false;
25794         LDKOutPoint val_conv;
25795         val_conv.inner = untag_ptr(val);
25796         val_conv.is_owned = ptr_is_owned(val);
25797         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25798         val_conv = OutPoint_clone(&val_conv);
25799         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
25800 }
25801
25802 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint64_t this_ptr) {
25803         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
25804         this_ptr_conv.inner = untag_ptr(this_ptr);
25805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25807         this_ptr_conv.is_owned = false;
25808         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
25809         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
25810         return ret_arr;
25811 }
25812
25813 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
25814         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
25815         this_ptr_conv.inner = untag_ptr(this_ptr);
25816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25818         this_ptr_conv.is_owned = false;
25819         LDKPublicKey val_ref;
25820         CHECK(val->arr_len == 33);
25821         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
25822         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
25823 }
25824
25825 int16_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint64_t this_ptr) {
25826         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
25827         this_ptr_conv.inner = untag_ptr(this_ptr);
25828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25830         this_ptr_conv.is_owned = false;
25831         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
25832         return ret_conv;
25833 }
25834
25835 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint64_t this_ptr, int16_t val) {
25836         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
25837         this_ptr_conv.inner = untag_ptr(this_ptr);
25838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25840         this_ptr_conv.is_owned = false;
25841         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
25842 }
25843
25844 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_output"))) TS_DelayedPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
25845         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
25846         this_ptr_conv.inner = untag_ptr(this_ptr);
25847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25849         this_ptr_conv.is_owned = false;
25850         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
25851         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
25852         return tag_ptr(ret_ref, true);
25853 }
25854
25855 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_output"))) TS_DelayedPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
25856         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
25857         this_ptr_conv.inner = untag_ptr(this_ptr);
25858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25860         this_ptr_conv.is_owned = false;
25861         void* val_ptr = untag_ptr(val);
25862         CHECK_ACCESS(val_ptr);
25863         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
25864         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
25865         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
25866 }
25867
25868 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint64_t this_ptr) {
25869         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
25870         this_ptr_conv.inner = untag_ptr(this_ptr);
25871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25873         this_ptr_conv.is_owned = false;
25874         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
25875         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
25876         return ret_arr;
25877 }
25878
25879 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint64_t this_ptr, int8_tArray val) {
25880         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
25881         this_ptr_conv.inner = untag_ptr(this_ptr);
25882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25884         this_ptr_conv.is_owned = false;
25885         LDKPublicKey val_ref;
25886         CHECK(val->arr_len == 33);
25887         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
25888         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
25889 }
25890
25891 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
25892         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
25893         this_ptr_conv.inner = untag_ptr(this_ptr);
25894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25896         this_ptr_conv.is_owned = false;
25897         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25898         memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
25899         return ret_arr;
25900 }
25901
25902 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
25903         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
25904         this_ptr_conv.inner = untag_ptr(this_ptr);
25905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25907         this_ptr_conv.is_owned = false;
25908         LDKThirtyTwoBytes val_ref;
25909         CHECK(val->arr_len == 32);
25910         memcpy(val_ref.data, val->elems, 32); FREE(val);
25911         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
25912 }
25913
25914 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
25915         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
25916         this_ptr_conv.inner = untag_ptr(this_ptr);
25917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25919         this_ptr_conv.is_owned = false;
25920         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
25921         return ret_conv;
25922 }
25923
25924 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
25925         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
25926         this_ptr_conv.inner = untag_ptr(this_ptr);
25927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25929         this_ptr_conv.is_owned = false;
25930         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
25931 }
25932
25933 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) {
25934         LDKOutPoint outpoint_arg_conv;
25935         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
25936         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
25937         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
25938         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
25939         LDKPublicKey per_commitment_point_arg_ref;
25940         CHECK(per_commitment_point_arg->arr_len == 33);
25941         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
25942         void* output_arg_ptr = untag_ptr(output_arg);
25943         CHECK_ACCESS(output_arg_ptr);
25944         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
25945         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
25946         LDKPublicKey revocation_pubkey_arg_ref;
25947         CHECK(revocation_pubkey_arg->arr_len == 33);
25948         memcpy(revocation_pubkey_arg_ref.compressed_form, revocation_pubkey_arg->elems, 33); FREE(revocation_pubkey_arg);
25949         LDKThirtyTwoBytes channel_keys_id_arg_ref;
25950         CHECK(channel_keys_id_arg->arr_len == 32);
25951         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
25952         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);
25953         uint64_t ret_ref = 0;
25954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25955         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25956         return ret_ref;
25957 }
25958
25959 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
25960         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
25961         uint64_t ret_ref = 0;
25962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25963         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25964         return ret_ref;
25965 }
25966 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone_ptr"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
25967         LDKDelayedPaymentOutputDescriptor arg_conv;
25968         arg_conv.inner = untag_ptr(arg);
25969         arg_conv.is_owned = ptr_is_owned(arg);
25970         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25971         arg_conv.is_owned = false;
25972         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
25973         return ret_conv;
25974 }
25975
25976 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone"))) TS_DelayedPaymentOutputDescriptor_clone(uint64_t orig) {
25977         LDKDelayedPaymentOutputDescriptor orig_conv;
25978         orig_conv.inner = untag_ptr(orig);
25979         orig_conv.is_owned = ptr_is_owned(orig);
25980         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25981         orig_conv.is_owned = false;
25982         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
25983         uint64_t ret_ref = 0;
25984         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25985         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25986         return ret_ref;
25987 }
25988
25989 jboolean  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_eq"))) TS_DelayedPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
25990         LDKDelayedPaymentOutputDescriptor a_conv;
25991         a_conv.inner = untag_ptr(a);
25992         a_conv.is_owned = ptr_is_owned(a);
25993         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25994         a_conv.is_owned = false;
25995         LDKDelayedPaymentOutputDescriptor b_conv;
25996         b_conv.inner = untag_ptr(b);
25997         b_conv.is_owned = ptr_is_owned(b);
25998         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
25999         b_conv.is_owned = false;
26000         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
26001         return ret_conv;
26002 }
26003
26004 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_write"))) TS_DelayedPaymentOutputDescriptor_write(uint64_t obj) {
26005         LDKDelayedPaymentOutputDescriptor obj_conv;
26006         obj_conv.inner = untag_ptr(obj);
26007         obj_conv.is_owned = ptr_is_owned(obj);
26008         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26009         obj_conv.is_owned = false;
26010         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
26011         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26012         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26013         CVec_u8Z_free(ret_var);
26014         return ret_arr;
26015 }
26016
26017 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_read"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
26018         LDKu8slice ser_ref;
26019         ser_ref.datalen = ser->arr_len;
26020         ser_ref.data = ser->elems;
26021         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
26022         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
26023         FREE(ser);
26024         return tag_ptr(ret_conv, true);
26025 }
26026
26027 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_free"))) TS_StaticPaymentOutputDescriptor_free(uint64_t this_obj) {
26028         LDKStaticPaymentOutputDescriptor this_obj_conv;
26029         this_obj_conv.inner = untag_ptr(this_obj);
26030         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26032         StaticPaymentOutputDescriptor_free(this_obj_conv);
26033 }
26034
26035 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_outpoint"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
26036         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26037         this_ptr_conv.inner = untag_ptr(this_ptr);
26038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26040         this_ptr_conv.is_owned = false;
26041         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
26042         uint64_t ret_ref = 0;
26043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26045         return ret_ref;
26046 }
26047
26048 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_outpoint"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
26049         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26050         this_ptr_conv.inner = untag_ptr(this_ptr);
26051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26053         this_ptr_conv.is_owned = false;
26054         LDKOutPoint val_conv;
26055         val_conv.inner = untag_ptr(val);
26056         val_conv.is_owned = ptr_is_owned(val);
26057         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26058         val_conv = OutPoint_clone(&val_conv);
26059         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
26060 }
26061
26062 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_output"))) TS_StaticPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
26063         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26064         this_ptr_conv.inner = untag_ptr(this_ptr);
26065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26067         this_ptr_conv.is_owned = false;
26068         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
26069         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
26070         return tag_ptr(ret_ref, true);
26071 }
26072
26073 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_output"))) TS_StaticPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
26074         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26075         this_ptr_conv.inner = untag_ptr(this_ptr);
26076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26078         this_ptr_conv.is_owned = false;
26079         void* val_ptr = untag_ptr(val);
26080         CHECK_ACCESS(val_ptr);
26081         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
26082         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
26083         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
26084 }
26085
26086 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
26087         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26088         this_ptr_conv.inner = untag_ptr(this_ptr);
26089         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26091         this_ptr_conv.is_owned = false;
26092         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26093         memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
26094         return ret_arr;
26095 }
26096
26097 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
26098         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26099         this_ptr_conv.inner = untag_ptr(this_ptr);
26100         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26102         this_ptr_conv.is_owned = false;
26103         LDKThirtyTwoBytes val_ref;
26104         CHECK(val->arr_len == 32);
26105         memcpy(val_ref.data, val->elems, 32); FREE(val);
26106         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
26107 }
26108
26109 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
26110         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26111         this_ptr_conv.inner = untag_ptr(this_ptr);
26112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26114         this_ptr_conv.is_owned = false;
26115         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
26116         return ret_conv;
26117 }
26118
26119 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
26120         LDKStaticPaymentOutputDescriptor this_ptr_conv;
26121         this_ptr_conv.inner = untag_ptr(this_ptr);
26122         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26123         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26124         this_ptr_conv.is_owned = false;
26125         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
26126 }
26127
26128 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) {
26129         LDKOutPoint outpoint_arg_conv;
26130         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
26131         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
26132         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
26133         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
26134         void* output_arg_ptr = untag_ptr(output_arg);
26135         CHECK_ACCESS(output_arg_ptr);
26136         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
26137         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
26138         LDKThirtyTwoBytes channel_keys_id_arg_ref;
26139         CHECK(channel_keys_id_arg->arr_len == 32);
26140         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
26141         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
26142         uint64_t ret_ref = 0;
26143         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26144         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26145         return ret_ref;
26146 }
26147
26148 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
26149         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
26150         uint64_t ret_ref = 0;
26151         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26152         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26153         return ret_ref;
26154 }
26155 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone_ptr"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
26156         LDKStaticPaymentOutputDescriptor arg_conv;
26157         arg_conv.inner = untag_ptr(arg);
26158         arg_conv.is_owned = ptr_is_owned(arg);
26159         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26160         arg_conv.is_owned = false;
26161         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
26162         return ret_conv;
26163 }
26164
26165 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone"))) TS_StaticPaymentOutputDescriptor_clone(uint64_t orig) {
26166         LDKStaticPaymentOutputDescriptor orig_conv;
26167         orig_conv.inner = untag_ptr(orig);
26168         orig_conv.is_owned = ptr_is_owned(orig);
26169         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26170         orig_conv.is_owned = false;
26171         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
26172         uint64_t ret_ref = 0;
26173         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26174         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26175         return ret_ref;
26176 }
26177
26178 jboolean  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_eq"))) TS_StaticPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
26179         LDKStaticPaymentOutputDescriptor a_conv;
26180         a_conv.inner = untag_ptr(a);
26181         a_conv.is_owned = ptr_is_owned(a);
26182         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26183         a_conv.is_owned = false;
26184         LDKStaticPaymentOutputDescriptor b_conv;
26185         b_conv.inner = untag_ptr(b);
26186         b_conv.is_owned = ptr_is_owned(b);
26187         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26188         b_conv.is_owned = false;
26189         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
26190         return ret_conv;
26191 }
26192
26193 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_write"))) TS_StaticPaymentOutputDescriptor_write(uint64_t obj) {
26194         LDKStaticPaymentOutputDescriptor obj_conv;
26195         obj_conv.inner = untag_ptr(obj);
26196         obj_conv.is_owned = ptr_is_owned(obj);
26197         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26198         obj_conv.is_owned = false;
26199         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
26200         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26201         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26202         CVec_u8Z_free(ret_var);
26203         return ret_arr;
26204 }
26205
26206 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_read"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
26207         LDKu8slice ser_ref;
26208         ser_ref.datalen = ser->arr_len;
26209         ser_ref.data = ser->elems;
26210         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
26211         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
26212         FREE(ser);
26213         return tag_ptr(ret_conv, true);
26214 }
26215
26216 void  __attribute__((export_name("TS_SpendableOutputDescriptor_free"))) TS_SpendableOutputDescriptor_free(uint64_t this_ptr) {
26217         if (!ptr_is_owned(this_ptr)) return;
26218         void* this_ptr_ptr = untag_ptr(this_ptr);
26219         CHECK_ACCESS(this_ptr_ptr);
26220         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
26221         FREE(untag_ptr(this_ptr));
26222         SpendableOutputDescriptor_free(this_ptr_conv);
26223 }
26224
26225 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
26226         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26227         *ret_copy = SpendableOutputDescriptor_clone(arg);
26228         uint64_t ret_ref = tag_ptr(ret_copy, true);
26229         return ret_ref;
26230 }
26231 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone_ptr"))) TS_SpendableOutputDescriptor_clone_ptr(uint64_t arg) {
26232         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
26233         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
26234         return ret_conv;
26235 }
26236
26237 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone"))) TS_SpendableOutputDescriptor_clone(uint64_t orig) {
26238         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
26239         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26240         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
26241         uint64_t ret_ref = tag_ptr(ret_copy, true);
26242         return ret_ref;
26243 }
26244
26245 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_output"))) TS_SpendableOutputDescriptor_static_output(uint64_t outpoint, uint64_t output) {
26246         LDKOutPoint outpoint_conv;
26247         outpoint_conv.inner = untag_ptr(outpoint);
26248         outpoint_conv.is_owned = ptr_is_owned(outpoint);
26249         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
26250         outpoint_conv = OutPoint_clone(&outpoint_conv);
26251         void* output_ptr = untag_ptr(output);
26252         CHECK_ACCESS(output_ptr);
26253         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
26254         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
26255         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26256         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
26257         uint64_t ret_ref = tag_ptr(ret_copy, true);
26258         return ret_ref;
26259 }
26260
26261 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_delayed_payment_output"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint64_t a) {
26262         LDKDelayedPaymentOutputDescriptor a_conv;
26263         a_conv.inner = untag_ptr(a);
26264         a_conv.is_owned = ptr_is_owned(a);
26265         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26266         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
26267         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26268         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
26269         uint64_t ret_ref = tag_ptr(ret_copy, true);
26270         return ret_ref;
26271 }
26272
26273 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_payment_output"))) TS_SpendableOutputDescriptor_static_payment_output(uint64_t a) {
26274         LDKStaticPaymentOutputDescriptor a_conv;
26275         a_conv.inner = untag_ptr(a);
26276         a_conv.is_owned = ptr_is_owned(a);
26277         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26278         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
26279         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
26280         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
26281         uint64_t ret_ref = tag_ptr(ret_copy, true);
26282         return ret_ref;
26283 }
26284
26285 jboolean  __attribute__((export_name("TS_SpendableOutputDescriptor_eq"))) TS_SpendableOutputDescriptor_eq(uint64_t a, uint64_t b) {
26286         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
26287         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
26288         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
26289         return ret_conv;
26290 }
26291
26292 int8_tArray  __attribute__((export_name("TS_SpendableOutputDescriptor_write"))) TS_SpendableOutputDescriptor_write(uint64_t obj) {
26293         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
26294         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
26295         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26296         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26297         CVec_u8Z_free(ret_var);
26298         return ret_arr;
26299 }
26300
26301 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
26302         LDKu8slice ser_ref;
26303         ser_ref.datalen = ser->arr_len;
26304         ser_ref.data = ser->elems;
26305         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
26306         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
26307         FREE(ser);
26308         return tag_ptr(ret_conv, true);
26309 }
26310
26311 void  __attribute__((export_name("TS_BaseSign_free"))) TS_BaseSign_free(uint64_t this_ptr) {
26312         if (!ptr_is_owned(this_ptr)) return;
26313         void* this_ptr_ptr = untag_ptr(this_ptr);
26314         CHECK_ACCESS(this_ptr_ptr);
26315         LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
26316         FREE(untag_ptr(this_ptr));
26317         BaseSign_free(this_ptr_conv);
26318 }
26319
26320 static inline uint64_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
26321         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
26322         *ret_ret = Sign_clone(arg);
26323         return tag_ptr(ret_ret, true);
26324 }
26325 int64_t  __attribute__((export_name("TS_Sign_clone_ptr"))) TS_Sign_clone_ptr(uint64_t arg) {
26326         void* arg_ptr = untag_ptr(arg);
26327         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
26328         LDKSign* arg_conv = (LDKSign*)arg_ptr;
26329         int64_t ret_conv = Sign_clone_ptr(arg_conv);
26330         return ret_conv;
26331 }
26332
26333 uint64_t  __attribute__((export_name("TS_Sign_clone"))) TS_Sign_clone(uint64_t orig) {
26334         void* orig_ptr = untag_ptr(orig);
26335         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
26336         LDKSign* orig_conv = (LDKSign*)orig_ptr;
26337         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
26338         *ret_ret = Sign_clone(orig_conv);
26339         return tag_ptr(ret_ret, true);
26340 }
26341
26342 void  __attribute__((export_name("TS_Sign_free"))) TS_Sign_free(uint64_t this_ptr) {
26343         if (!ptr_is_owned(this_ptr)) return;
26344         void* this_ptr_ptr = untag_ptr(this_ptr);
26345         CHECK_ACCESS(this_ptr_ptr);
26346         LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
26347         FREE(untag_ptr(this_ptr));
26348         Sign_free(this_ptr_conv);
26349 }
26350
26351 uint32_t  __attribute__((export_name("TS_Recipient_clone"))) TS_Recipient_clone(uint64_t orig) {
26352         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
26353         uint32_t ret_conv = LDKRecipient_to_js(Recipient_clone(orig_conv));
26354         return ret_conv;
26355 }
26356
26357 uint32_t  __attribute__((export_name("TS_Recipient_node"))) TS_Recipient_node() {
26358         uint32_t ret_conv = LDKRecipient_to_js(Recipient_node());
26359         return ret_conv;
26360 }
26361
26362 uint32_t  __attribute__((export_name("TS_Recipient_phantom_node"))) TS_Recipient_phantom_node() {
26363         uint32_t ret_conv = LDKRecipient_to_js(Recipient_phantom_node());
26364         return ret_conv;
26365 }
26366
26367 void  __attribute__((export_name("TS_KeysInterface_free"))) TS_KeysInterface_free(uint64_t this_ptr) {
26368         if (!ptr_is_owned(this_ptr)) return;
26369         void* this_ptr_ptr = untag_ptr(this_ptr);
26370         CHECK_ACCESS(this_ptr_ptr);
26371         LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
26372         FREE(untag_ptr(this_ptr));
26373         KeysInterface_free(this_ptr_conv);
26374 }
26375
26376 void  __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint64_t this_obj) {
26377         LDKInMemorySigner this_obj_conv;
26378         this_obj_conv.inner = untag_ptr(this_obj);
26379         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26381         InMemorySigner_free(this_obj_conv);
26382 }
26383
26384 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_funding_key"))) TS_InMemorySigner_get_funding_key(uint64_t this_ptr) {
26385         LDKInMemorySigner this_ptr_conv;
26386         this_ptr_conv.inner = untag_ptr(this_ptr);
26387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26389         this_ptr_conv.is_owned = false;
26390         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26391         memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
26392         return ret_arr;
26393 }
26394
26395 void  __attribute__((export_name("TS_InMemorySigner_set_funding_key"))) TS_InMemorySigner_set_funding_key(uint64_t this_ptr, int8_tArray val) {
26396         LDKInMemorySigner this_ptr_conv;
26397         this_ptr_conv.inner = untag_ptr(this_ptr);
26398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26400         this_ptr_conv.is_owned = false;
26401         LDKSecretKey val_ref;
26402         CHECK(val->arr_len == 32);
26403         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26404         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
26405 }
26406
26407 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_revocation_base_key"))) TS_InMemorySigner_get_revocation_base_key(uint64_t this_ptr) {
26408         LDKInMemorySigner this_ptr_conv;
26409         this_ptr_conv.inner = untag_ptr(this_ptr);
26410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26412         this_ptr_conv.is_owned = false;
26413         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26414         memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
26415         return ret_arr;
26416 }
26417
26418 void  __attribute__((export_name("TS_InMemorySigner_set_revocation_base_key"))) TS_InMemorySigner_set_revocation_base_key(uint64_t this_ptr, int8_tArray val) {
26419         LDKInMemorySigner this_ptr_conv;
26420         this_ptr_conv.inner = untag_ptr(this_ptr);
26421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26423         this_ptr_conv.is_owned = false;
26424         LDKSecretKey val_ref;
26425         CHECK(val->arr_len == 32);
26426         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26427         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
26428 }
26429
26430 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_payment_key"))) TS_InMemorySigner_get_payment_key(uint64_t this_ptr) {
26431         LDKInMemorySigner this_ptr_conv;
26432         this_ptr_conv.inner = untag_ptr(this_ptr);
26433         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26435         this_ptr_conv.is_owned = false;
26436         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26437         memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
26438         return ret_arr;
26439 }
26440
26441 void  __attribute__((export_name("TS_InMemorySigner_set_payment_key"))) TS_InMemorySigner_set_payment_key(uint64_t this_ptr, int8_tArray val) {
26442         LDKInMemorySigner this_ptr_conv;
26443         this_ptr_conv.inner = untag_ptr(this_ptr);
26444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26446         this_ptr_conv.is_owned = false;
26447         LDKSecretKey val_ref;
26448         CHECK(val->arr_len == 32);
26449         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26450         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
26451 }
26452
26453 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_delayed_payment_base_key"))) TS_InMemorySigner_get_delayed_payment_base_key(uint64_t this_ptr) {
26454         LDKInMemorySigner this_ptr_conv;
26455         this_ptr_conv.inner = untag_ptr(this_ptr);
26456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26458         this_ptr_conv.is_owned = false;
26459         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26460         memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
26461         return ret_arr;
26462 }
26463
26464 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) {
26465         LDKInMemorySigner this_ptr_conv;
26466         this_ptr_conv.inner = untag_ptr(this_ptr);
26467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26469         this_ptr_conv.is_owned = false;
26470         LDKSecretKey val_ref;
26471         CHECK(val->arr_len == 32);
26472         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26473         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
26474 }
26475
26476 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_htlc_base_key"))) TS_InMemorySigner_get_htlc_base_key(uint64_t this_ptr) {
26477         LDKInMemorySigner this_ptr_conv;
26478         this_ptr_conv.inner = untag_ptr(this_ptr);
26479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26481         this_ptr_conv.is_owned = false;
26482         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26483         memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
26484         return ret_arr;
26485 }
26486
26487 void  __attribute__((export_name("TS_InMemorySigner_set_htlc_base_key"))) TS_InMemorySigner_set_htlc_base_key(uint64_t this_ptr, int8_tArray val) {
26488         LDKInMemorySigner this_ptr_conv;
26489         this_ptr_conv.inner = untag_ptr(this_ptr);
26490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26492         this_ptr_conv.is_owned = false;
26493         LDKSecretKey val_ref;
26494         CHECK(val->arr_len == 32);
26495         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
26496         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
26497 }
26498
26499 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_commitment_seed"))) TS_InMemorySigner_get_commitment_seed(uint64_t this_ptr) {
26500         LDKInMemorySigner this_ptr_conv;
26501         this_ptr_conv.inner = untag_ptr(this_ptr);
26502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26504         this_ptr_conv.is_owned = false;
26505         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26506         memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
26507         return ret_arr;
26508 }
26509
26510 void  __attribute__((export_name("TS_InMemorySigner_set_commitment_seed"))) TS_InMemorySigner_set_commitment_seed(uint64_t this_ptr, int8_tArray val) {
26511         LDKInMemorySigner this_ptr_conv;
26512         this_ptr_conv.inner = untag_ptr(this_ptr);
26513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26515         this_ptr_conv.is_owned = false;
26516         LDKThirtyTwoBytes val_ref;
26517         CHECK(val->arr_len == 32);
26518         memcpy(val_ref.data, val->elems, 32); FREE(val);
26519         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
26520 }
26521
26522 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
26523         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
26524         uint64_t ret_ref = 0;
26525         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26526         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26527         return ret_ref;
26528 }
26529 int64_t  __attribute__((export_name("TS_InMemorySigner_clone_ptr"))) TS_InMemorySigner_clone_ptr(uint64_t arg) {
26530         LDKInMemorySigner arg_conv;
26531         arg_conv.inner = untag_ptr(arg);
26532         arg_conv.is_owned = ptr_is_owned(arg);
26533         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26534         arg_conv.is_owned = false;
26535         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
26536         return ret_conv;
26537 }
26538
26539 uint64_t  __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySigner_clone(uint64_t orig) {
26540         LDKInMemorySigner orig_conv;
26541         orig_conv.inner = untag_ptr(orig);
26542         orig_conv.is_owned = ptr_is_owned(orig);
26543         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26544         orig_conv.is_owned = false;
26545         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
26546         uint64_t ret_ref = 0;
26547         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26548         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26549         return ret_ref;
26550 }
26551
26552 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) {
26553         LDKSecretKey node_secret_ref;
26554         CHECK(node_secret->arr_len == 32);
26555         memcpy(node_secret_ref.bytes, node_secret->elems, 32); FREE(node_secret);
26556         LDKSecretKey funding_key_ref;
26557         CHECK(funding_key->arr_len == 32);
26558         memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
26559         LDKSecretKey revocation_base_key_ref;
26560         CHECK(revocation_base_key->arr_len == 32);
26561         memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
26562         LDKSecretKey payment_key_ref;
26563         CHECK(payment_key->arr_len == 32);
26564         memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
26565         LDKSecretKey delayed_payment_base_key_ref;
26566         CHECK(delayed_payment_base_key->arr_len == 32);
26567         memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
26568         LDKSecretKey htlc_base_key_ref;
26569         CHECK(htlc_base_key->arr_len == 32);
26570         memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
26571         LDKThirtyTwoBytes commitment_seed_ref;
26572         CHECK(commitment_seed->arr_len == 32);
26573         memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
26574         LDKThirtyTwoBytes channel_keys_id_ref;
26575         CHECK(channel_keys_id->arr_len == 32);
26576         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
26577         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);
26578         uint64_t ret_ref = 0;
26579         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26580         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26581         return ret_ref;
26582 }
26583
26584 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_pubkeys"))) TS_InMemorySigner_counterparty_pubkeys(uint64_t this_arg) {
26585         LDKInMemorySigner this_arg_conv;
26586         this_arg_conv.inner = untag_ptr(this_arg);
26587         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26589         this_arg_conv.is_owned = false;
26590         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
26591         uint64_t ret_ref = 0;
26592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26594         return ret_ref;
26595 }
26596
26597 int16_t  __attribute__((export_name("TS_InMemorySigner_counterparty_selected_contest_delay"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint64_t this_arg) {
26598         LDKInMemorySigner this_arg_conv;
26599         this_arg_conv.inner = untag_ptr(this_arg);
26600         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26602         this_arg_conv.is_owned = false;
26603         int16_t ret_conv = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
26604         return ret_conv;
26605 }
26606
26607 int16_t  __attribute__((export_name("TS_InMemorySigner_holder_selected_contest_delay"))) TS_InMemorySigner_holder_selected_contest_delay(uint64_t this_arg) {
26608         LDKInMemorySigner this_arg_conv;
26609         this_arg_conv.inner = untag_ptr(this_arg);
26610         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26612         this_arg_conv.is_owned = false;
26613         int16_t ret_conv = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
26614         return ret_conv;
26615 }
26616
26617 jboolean  __attribute__((export_name("TS_InMemorySigner_is_outbound"))) TS_InMemorySigner_is_outbound(uint64_t this_arg) {
26618         LDKInMemorySigner this_arg_conv;
26619         this_arg_conv.inner = untag_ptr(this_arg);
26620         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26622         this_arg_conv.is_owned = false;
26623         jboolean ret_conv = InMemorySigner_is_outbound(&this_arg_conv);
26624         return ret_conv;
26625 }
26626
26627 uint64_t  __attribute__((export_name("TS_InMemorySigner_funding_outpoint"))) TS_InMemorySigner_funding_outpoint(uint64_t this_arg) {
26628         LDKInMemorySigner this_arg_conv;
26629         this_arg_conv.inner = untag_ptr(this_arg);
26630         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26632         this_arg_conv.is_owned = false;
26633         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
26634         uint64_t ret_ref = 0;
26635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26636         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26637         return ret_ref;
26638 }
26639
26640 uint64_t  __attribute__((export_name("TS_InMemorySigner_get_channel_parameters"))) TS_InMemorySigner_get_channel_parameters(uint64_t this_arg) {
26641         LDKInMemorySigner this_arg_conv;
26642         this_arg_conv.inner = untag_ptr(this_arg);
26643         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26645         this_arg_conv.is_owned = false;
26646         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
26647         uint64_t ret_ref = 0;
26648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26650         return ret_ref;
26651 }
26652
26653 jboolean  __attribute__((export_name("TS_InMemorySigner_opt_anchors"))) TS_InMemorySigner_opt_anchors(uint64_t this_arg) {
26654         LDKInMemorySigner this_arg_conv;
26655         this_arg_conv.inner = untag_ptr(this_arg);
26656         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26658         this_arg_conv.is_owned = false;
26659         jboolean ret_conv = InMemorySigner_opt_anchors(&this_arg_conv);
26660         return ret_conv;
26661 }
26662
26663 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) {
26664         LDKInMemorySigner this_arg_conv;
26665         this_arg_conv.inner = untag_ptr(this_arg);
26666         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26668         this_arg_conv.is_owned = false;
26669         LDKTransaction spend_tx_ref;
26670         spend_tx_ref.datalen = spend_tx->arr_len;
26671         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
26672         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
26673         spend_tx_ref.data_is_owned = true;
26674         LDKStaticPaymentOutputDescriptor descriptor_conv;
26675         descriptor_conv.inner = untag_ptr(descriptor);
26676         descriptor_conv.is_owned = ptr_is_owned(descriptor);
26677         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
26678         descriptor_conv.is_owned = false;
26679         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
26680         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
26681         return tag_ptr(ret_conv, true);
26682 }
26683
26684 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) {
26685         LDKInMemorySigner this_arg_conv;
26686         this_arg_conv.inner = untag_ptr(this_arg);
26687         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26689         this_arg_conv.is_owned = false;
26690         LDKTransaction spend_tx_ref;
26691         spend_tx_ref.datalen = spend_tx->arr_len;
26692         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
26693         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
26694         spend_tx_ref.data_is_owned = true;
26695         LDKDelayedPaymentOutputDescriptor descriptor_conv;
26696         descriptor_conv.inner = untag_ptr(descriptor);
26697         descriptor_conv.is_owned = ptr_is_owned(descriptor);
26698         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
26699         descriptor_conv.is_owned = false;
26700         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
26701         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
26702         return tag_ptr(ret_conv, true);
26703 }
26704
26705 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_BaseSign"))) TS_InMemorySigner_as_BaseSign(uint64_t this_arg) {
26706         LDKInMemorySigner this_arg_conv;
26707         this_arg_conv.inner = untag_ptr(this_arg);
26708         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26710         this_arg_conv.is_owned = false;
26711         LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
26712         *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
26713         return tag_ptr(ret_ret, true);
26714 }
26715
26716 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_Sign"))) TS_InMemorySigner_as_Sign(uint64_t this_arg) {
26717         LDKInMemorySigner this_arg_conv;
26718         this_arg_conv.inner = untag_ptr(this_arg);
26719         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26721         this_arg_conv.is_owned = false;
26722         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
26723         *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
26724         return tag_ptr(ret_ret, true);
26725 }
26726
26727 int8_tArray  __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemorySigner_write(uint64_t obj) {
26728         LDKInMemorySigner obj_conv;
26729         obj_conv.inner = untag_ptr(obj);
26730         obj_conv.is_owned = ptr_is_owned(obj);
26731         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
26732         obj_conv.is_owned = false;
26733         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
26734         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
26735         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
26736         CVec_u8Z_free(ret_var);
26737         return ret_arr;
26738 }
26739
26740 uint64_t  __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser, int8_tArray arg) {
26741         LDKu8slice ser_ref;
26742         ser_ref.datalen = ser->arr_len;
26743         ser_ref.data = ser->elems;
26744         LDKSecretKey arg_ref;
26745         CHECK(arg->arr_len == 32);
26746         memcpy(arg_ref.bytes, arg->elems, 32); FREE(arg);
26747         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
26748         *ret_conv = InMemorySigner_read(ser_ref, arg_ref);
26749         FREE(ser);
26750         return tag_ptr(ret_conv, true);
26751 }
26752
26753 void  __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(uint64_t this_obj) {
26754         LDKKeysManager this_obj_conv;
26755         this_obj_conv.inner = untag_ptr(this_obj);
26756         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26758         KeysManager_free(this_obj_conv);
26759 }
26760
26761 uint64_t  __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
26762         unsigned char seed_arr[32];
26763         CHECK(seed->arr_len == 32);
26764         memcpy(seed_arr, seed->elems, 32); FREE(seed);
26765         unsigned char (*seed_ref)[32] = &seed_arr;
26766         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
26767         uint64_t ret_ref = 0;
26768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26770         return ret_ref;
26771 }
26772
26773 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) {
26774         LDKKeysManager this_arg_conv;
26775         this_arg_conv.inner = untag_ptr(this_arg);
26776         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26778         this_arg_conv.is_owned = false;
26779         unsigned char params_arr[32];
26780         CHECK(params->arr_len == 32);
26781         memcpy(params_arr, params->elems, 32); FREE(params);
26782         unsigned char (*params_ref)[32] = &params_arr;
26783         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
26784         uint64_t ret_ref = 0;
26785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26787         return ret_ref;
26788 }
26789
26790 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) {
26791         LDKKeysManager this_arg_conv;
26792         this_arg_conv.inner = untag_ptr(this_arg);
26793         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26795         this_arg_conv.is_owned = false;
26796         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
26797         descriptors_constr.datalen = descriptors->arr_len;
26798         if (descriptors_constr.datalen > 0)
26799                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
26800         else
26801                 descriptors_constr.data = NULL;
26802         uint64_t* descriptors_vals = descriptors->elems;
26803         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
26804                 uint64_t descriptors_conv_27 = descriptors_vals[b];
26805                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
26806                 CHECK_ACCESS(descriptors_conv_27_ptr);
26807                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
26808                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
26809                 descriptors_constr.data[b] = descriptors_conv_27_conv;
26810         }
26811         FREE(descriptors);
26812         LDKCVec_TxOutZ outputs_constr;
26813         outputs_constr.datalen = outputs->arr_len;
26814         if (outputs_constr.datalen > 0)
26815                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
26816         else
26817                 outputs_constr.data = NULL;
26818         uint64_t* outputs_vals = outputs->elems;
26819         for (size_t h = 0; h < outputs_constr.datalen; h++) {
26820                 uint64_t outputs_conv_7 = outputs_vals[h];
26821                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
26822                 CHECK_ACCESS(outputs_conv_7_ptr);
26823                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
26824                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
26825                 outputs_constr.data[h] = outputs_conv_7_conv;
26826         }
26827         FREE(outputs);
26828         LDKCVec_u8Z change_destination_script_ref;
26829         change_destination_script_ref.datalen = change_destination_script->arr_len;
26830         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
26831         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
26832         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
26833         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
26834         return tag_ptr(ret_conv, true);
26835 }
26836
26837 uint64_t  __attribute__((export_name("TS_KeysManager_as_KeysInterface"))) TS_KeysManager_as_KeysInterface(uint64_t this_arg) {
26838         LDKKeysManager this_arg_conv;
26839         this_arg_conv.inner = untag_ptr(this_arg);
26840         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26842         this_arg_conv.is_owned = false;
26843         LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
26844         *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
26845         return tag_ptr(ret_ret, true);
26846 }
26847
26848 void  __attribute__((export_name("TS_PhantomKeysManager_free"))) TS_PhantomKeysManager_free(uint64_t this_obj) {
26849         LDKPhantomKeysManager this_obj_conv;
26850         this_obj_conv.inner = untag_ptr(this_obj);
26851         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26853         PhantomKeysManager_free(this_obj_conv);
26854 }
26855
26856 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_KeysInterface"))) TS_PhantomKeysManager_as_KeysInterface(uint64_t this_arg) {
26857         LDKPhantomKeysManager this_arg_conv;
26858         this_arg_conv.inner = untag_ptr(this_arg);
26859         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26861         this_arg_conv.is_owned = false;
26862         LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
26863         *ret_ret = PhantomKeysManager_as_KeysInterface(&this_arg_conv);
26864         return tag_ptr(ret_ret, true);
26865 }
26866
26867 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) {
26868         unsigned char seed_arr[32];
26869         CHECK(seed->arr_len == 32);
26870         memcpy(seed_arr, seed->elems, 32); FREE(seed);
26871         unsigned char (*seed_ref)[32] = &seed_arr;
26872         unsigned char cross_node_seed_arr[32];
26873         CHECK(cross_node_seed->arr_len == 32);
26874         memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
26875         unsigned char (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
26876         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
26877         uint64_t ret_ref = 0;
26878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26880         return ret_ref;
26881 }
26882
26883 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) {
26884         LDKPhantomKeysManager this_arg_conv;
26885         this_arg_conv.inner = untag_ptr(this_arg);
26886         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26888         this_arg_conv.is_owned = false;
26889         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
26890         descriptors_constr.datalen = descriptors->arr_len;
26891         if (descriptors_constr.datalen > 0)
26892                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
26893         else
26894                 descriptors_constr.data = NULL;
26895         uint64_t* descriptors_vals = descriptors->elems;
26896         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
26897                 uint64_t descriptors_conv_27 = descriptors_vals[b];
26898                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
26899                 CHECK_ACCESS(descriptors_conv_27_ptr);
26900                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
26901                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
26902                 descriptors_constr.data[b] = descriptors_conv_27_conv;
26903         }
26904         FREE(descriptors);
26905         LDKCVec_TxOutZ outputs_constr;
26906         outputs_constr.datalen = outputs->arr_len;
26907         if (outputs_constr.datalen > 0)
26908                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
26909         else
26910                 outputs_constr.data = NULL;
26911         uint64_t* outputs_vals = outputs->elems;
26912         for (size_t h = 0; h < outputs_constr.datalen; h++) {
26913                 uint64_t outputs_conv_7 = outputs_vals[h];
26914                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
26915                 CHECK_ACCESS(outputs_conv_7_ptr);
26916                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
26917                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
26918                 outputs_constr.data[h] = outputs_conv_7_conv;
26919         }
26920         FREE(outputs);
26921         LDKCVec_u8Z change_destination_script_ref;
26922         change_destination_script_ref.datalen = change_destination_script->arr_len;
26923         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
26924         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
26925         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
26926         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
26927         return tag_ptr(ret_conv, true);
26928 }
26929
26930 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) {
26931         LDKPhantomKeysManager this_arg_conv;
26932         this_arg_conv.inner = untag_ptr(this_arg);
26933         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26935         this_arg_conv.is_owned = false;
26936         unsigned char params_arr[32];
26937         CHECK(params->arr_len == 32);
26938         memcpy(params_arr, params->elems, 32); FREE(params);
26939         unsigned char (*params_ref)[32] = &params_arr;
26940         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
26941         uint64_t ret_ref = 0;
26942         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26943         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26944         return ret_ref;
26945 }
26946
26947 void  __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint64_t this_obj) {
26948         LDKChannelManager this_obj_conv;
26949         this_obj_conv.inner = untag_ptr(this_obj);
26950         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26952         ChannelManager_free(this_obj_conv);
26953 }
26954
26955 void  __attribute__((export_name("TS_ChainParameters_free"))) TS_ChainParameters_free(uint64_t this_obj) {
26956         LDKChainParameters this_obj_conv;
26957         this_obj_conv.inner = untag_ptr(this_obj);
26958         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26960         ChainParameters_free(this_obj_conv);
26961 }
26962
26963 uint32_t  __attribute__((export_name("TS_ChainParameters_get_network"))) TS_ChainParameters_get_network(uint64_t this_ptr) {
26964         LDKChainParameters this_ptr_conv;
26965         this_ptr_conv.inner = untag_ptr(this_ptr);
26966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26968         this_ptr_conv.is_owned = false;
26969         uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
26970         return ret_conv;
26971 }
26972
26973 void  __attribute__((export_name("TS_ChainParameters_set_network"))) TS_ChainParameters_set_network(uint64_t this_ptr, uint32_t val) {
26974         LDKChainParameters this_ptr_conv;
26975         this_ptr_conv.inner = untag_ptr(this_ptr);
26976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26978         this_ptr_conv.is_owned = false;
26979         LDKNetwork val_conv = LDKNetwork_from_js(val);
26980         ChainParameters_set_network(&this_ptr_conv, val_conv);
26981 }
26982
26983 uint64_t  __attribute__((export_name("TS_ChainParameters_get_best_block"))) TS_ChainParameters_get_best_block(uint64_t this_ptr) {
26984         LDKChainParameters this_ptr_conv;
26985         this_ptr_conv.inner = untag_ptr(this_ptr);
26986         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26988         this_ptr_conv.is_owned = false;
26989         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
26990         uint64_t ret_ref = 0;
26991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26993         return ret_ref;
26994 }
26995
26996 void  __attribute__((export_name("TS_ChainParameters_set_best_block"))) TS_ChainParameters_set_best_block(uint64_t this_ptr, uint64_t val) {
26997         LDKChainParameters this_ptr_conv;
26998         this_ptr_conv.inner = untag_ptr(this_ptr);
26999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27001         this_ptr_conv.is_owned = false;
27002         LDKBestBlock val_conv;
27003         val_conv.inner = untag_ptr(val);
27004         val_conv.is_owned = ptr_is_owned(val);
27005         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27006         val_conv = BestBlock_clone(&val_conv);
27007         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
27008 }
27009
27010 uint64_t  __attribute__((export_name("TS_ChainParameters_new"))) TS_ChainParameters_new(uint32_t network_arg, uint64_t best_block_arg) {
27011         LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
27012         LDKBestBlock best_block_arg_conv;
27013         best_block_arg_conv.inner = untag_ptr(best_block_arg);
27014         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
27015         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
27016         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
27017         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
27018         uint64_t ret_ref = 0;
27019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27021         return ret_ref;
27022 }
27023
27024 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
27025         LDKChainParameters ret_var = ChainParameters_clone(arg);
27026         uint64_t ret_ref = 0;
27027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27029         return ret_ref;
27030 }
27031 int64_t  __attribute__((export_name("TS_ChainParameters_clone_ptr"))) TS_ChainParameters_clone_ptr(uint64_t arg) {
27032         LDKChainParameters arg_conv;
27033         arg_conv.inner = untag_ptr(arg);
27034         arg_conv.is_owned = ptr_is_owned(arg);
27035         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27036         arg_conv.is_owned = false;
27037         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
27038         return ret_conv;
27039 }
27040
27041 uint64_t  __attribute__((export_name("TS_ChainParameters_clone"))) TS_ChainParameters_clone(uint64_t orig) {
27042         LDKChainParameters orig_conv;
27043         orig_conv.inner = untag_ptr(orig);
27044         orig_conv.is_owned = ptr_is_owned(orig);
27045         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27046         orig_conv.is_owned = false;
27047         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
27048         uint64_t ret_ref = 0;
27049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27051         return ret_ref;
27052 }
27053
27054 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_free"))) TS_CounterpartyForwardingInfo_free(uint64_t this_obj) {
27055         LDKCounterpartyForwardingInfo this_obj_conv;
27056         this_obj_conv.inner = untag_ptr(this_obj);
27057         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27059         CounterpartyForwardingInfo_free(this_obj_conv);
27060 }
27061
27062 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_base_msat"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint64_t this_ptr) {
27063         LDKCounterpartyForwardingInfo this_ptr_conv;
27064         this_ptr_conv.inner = untag_ptr(this_ptr);
27065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27067         this_ptr_conv.is_owned = false;
27068         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
27069         return ret_conv;
27070 }
27071
27072 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_base_msat"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
27073         LDKCounterpartyForwardingInfo this_ptr_conv;
27074         this_ptr_conv.inner = untag_ptr(this_ptr);
27075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27077         this_ptr_conv.is_owned = false;
27078         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
27079 }
27080
27081 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
27082         LDKCounterpartyForwardingInfo this_ptr_conv;
27083         this_ptr_conv.inner = untag_ptr(this_ptr);
27084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27086         this_ptr_conv.is_owned = false;
27087         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
27088         return ret_conv;
27089 }
27090
27091 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
27092         LDKCounterpartyForwardingInfo this_ptr_conv;
27093         this_ptr_conv.inner = untag_ptr(this_ptr);
27094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27096         this_ptr_conv.is_owned = false;
27097         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
27098 }
27099
27100 int16_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
27101         LDKCounterpartyForwardingInfo this_ptr_conv;
27102         this_ptr_conv.inner = untag_ptr(this_ptr);
27103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27105         this_ptr_conv.is_owned = false;
27106         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
27107         return ret_conv;
27108 }
27109
27110 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
27111         LDKCounterpartyForwardingInfo this_ptr_conv;
27112         this_ptr_conv.inner = untag_ptr(this_ptr);
27113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27115         this_ptr_conv.is_owned = false;
27116         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
27117 }
27118
27119 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) {
27120         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
27121         uint64_t ret_ref = 0;
27122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27124         return ret_ref;
27125 }
27126
27127 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
27128         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
27129         uint64_t ret_ref = 0;
27130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27132         return ret_ref;
27133 }
27134 int64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone_ptr"))) TS_CounterpartyForwardingInfo_clone_ptr(uint64_t arg) {
27135         LDKCounterpartyForwardingInfo arg_conv;
27136         arg_conv.inner = untag_ptr(arg);
27137         arg_conv.is_owned = ptr_is_owned(arg);
27138         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27139         arg_conv.is_owned = false;
27140         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
27141         return ret_conv;
27142 }
27143
27144 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone"))) TS_CounterpartyForwardingInfo_clone(uint64_t orig) {
27145         LDKCounterpartyForwardingInfo orig_conv;
27146         orig_conv.inner = untag_ptr(orig);
27147         orig_conv.is_owned = ptr_is_owned(orig);
27148         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27149         orig_conv.is_owned = false;
27150         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
27151         uint64_t ret_ref = 0;
27152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27154         return ret_ref;
27155 }
27156
27157 void  __attribute__((export_name("TS_ChannelCounterparty_free"))) TS_ChannelCounterparty_free(uint64_t this_obj) {
27158         LDKChannelCounterparty this_obj_conv;
27159         this_obj_conv.inner = untag_ptr(this_obj);
27160         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27162         ChannelCounterparty_free(this_obj_conv);
27163 }
27164
27165 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_get_node_id"))) TS_ChannelCounterparty_get_node_id(uint64_t this_ptr) {
27166         LDKChannelCounterparty this_ptr_conv;
27167         this_ptr_conv.inner = untag_ptr(this_ptr);
27168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27170         this_ptr_conv.is_owned = false;
27171         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27172         memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
27173         return ret_arr;
27174 }
27175
27176 void  __attribute__((export_name("TS_ChannelCounterparty_set_node_id"))) TS_ChannelCounterparty_set_node_id(uint64_t this_ptr, int8_tArray val) {
27177         LDKChannelCounterparty this_ptr_conv;
27178         this_ptr_conv.inner = untag_ptr(this_ptr);
27179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27181         this_ptr_conv.is_owned = false;
27182         LDKPublicKey val_ref;
27183         CHECK(val->arr_len == 33);
27184         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27185         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
27186 }
27187
27188 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_features"))) TS_ChannelCounterparty_get_features(uint64_t this_ptr) {
27189         LDKChannelCounterparty this_ptr_conv;
27190         this_ptr_conv.inner = untag_ptr(this_ptr);
27191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27193         this_ptr_conv.is_owned = false;
27194         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
27195         uint64_t ret_ref = 0;
27196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27198         return ret_ref;
27199 }
27200
27201 void  __attribute__((export_name("TS_ChannelCounterparty_set_features"))) TS_ChannelCounterparty_set_features(uint64_t this_ptr, uint64_t val) {
27202         LDKChannelCounterparty this_ptr_conv;
27203         this_ptr_conv.inner = untag_ptr(this_ptr);
27204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27206         this_ptr_conv.is_owned = false;
27207         LDKInitFeatures val_conv;
27208         val_conv.inner = untag_ptr(val);
27209         val_conv.is_owned = ptr_is_owned(val);
27210         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27211         val_conv = InitFeatures_clone(&val_conv);
27212         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
27213 }
27214
27215 int64_t  __attribute__((export_name("TS_ChannelCounterparty_get_unspendable_punishment_reserve"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint64_t this_ptr) {
27216         LDKChannelCounterparty this_ptr_conv;
27217         this_ptr_conv.inner = untag_ptr(this_ptr);
27218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27220         this_ptr_conv.is_owned = false;
27221         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
27222         return ret_conv;
27223 }
27224
27225 void  __attribute__((export_name("TS_ChannelCounterparty_set_unspendable_punishment_reserve"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint64_t this_ptr, int64_t val) {
27226         LDKChannelCounterparty this_ptr_conv;
27227         this_ptr_conv.inner = untag_ptr(this_ptr);
27228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27230         this_ptr_conv.is_owned = false;
27231         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
27232 }
27233
27234 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_forwarding_info"))) TS_ChannelCounterparty_get_forwarding_info(uint64_t this_ptr) {
27235         LDKChannelCounterparty this_ptr_conv;
27236         this_ptr_conv.inner = untag_ptr(this_ptr);
27237         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27239         this_ptr_conv.is_owned = false;
27240         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
27241         uint64_t ret_ref = 0;
27242         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27243         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27244         return ret_ref;
27245 }
27246
27247 void  __attribute__((export_name("TS_ChannelCounterparty_set_forwarding_info"))) TS_ChannelCounterparty_set_forwarding_info(uint64_t this_ptr, uint64_t val) {
27248         LDKChannelCounterparty this_ptr_conv;
27249         this_ptr_conv.inner = untag_ptr(this_ptr);
27250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27252         this_ptr_conv.is_owned = false;
27253         LDKCounterpartyForwardingInfo val_conv;
27254         val_conv.inner = untag_ptr(val);
27255         val_conv.is_owned = ptr_is_owned(val);
27256         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27257         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
27258         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
27259 }
27260
27261 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_minimum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_minimum_msat(uint64_t this_ptr) {
27262         LDKChannelCounterparty this_ptr_conv;
27263         this_ptr_conv.inner = untag_ptr(this_ptr);
27264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27266         this_ptr_conv.is_owned = false;
27267         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27268         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
27269         uint64_t ret_ref = tag_ptr(ret_copy, true);
27270         return ret_ref;
27271 }
27272
27273 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) {
27274         LDKChannelCounterparty this_ptr_conv;
27275         this_ptr_conv.inner = untag_ptr(this_ptr);
27276         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27278         this_ptr_conv.is_owned = false;
27279         void* val_ptr = untag_ptr(val);
27280         CHECK_ACCESS(val_ptr);
27281         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27282         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27283         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
27284 }
27285
27286 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_maximum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_maximum_msat(uint64_t this_ptr) {
27287         LDKChannelCounterparty this_ptr_conv;
27288         this_ptr_conv.inner = untag_ptr(this_ptr);
27289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27291         this_ptr_conv.is_owned = false;
27292         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27293         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
27294         uint64_t ret_ref = tag_ptr(ret_copy, true);
27295         return ret_ref;
27296 }
27297
27298 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) {
27299         LDKChannelCounterparty this_ptr_conv;
27300         this_ptr_conv.inner = untag_ptr(this_ptr);
27301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27303         this_ptr_conv.is_owned = false;
27304         void* val_ptr = untag_ptr(val);
27305         CHECK_ACCESS(val_ptr);
27306         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27307         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27308         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
27309 }
27310
27311 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) {
27312         LDKPublicKey node_id_arg_ref;
27313         CHECK(node_id_arg->arr_len == 33);
27314         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
27315         LDKInitFeatures features_arg_conv;
27316         features_arg_conv.inner = untag_ptr(features_arg);
27317         features_arg_conv.is_owned = ptr_is_owned(features_arg);
27318         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
27319         features_arg_conv = InitFeatures_clone(&features_arg_conv);
27320         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
27321         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
27322         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
27323         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
27324         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
27325         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
27326         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
27327         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
27328         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
27329         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
27330         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
27331         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
27332         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
27333         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);
27334         uint64_t ret_ref = 0;
27335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27337         return ret_ref;
27338 }
27339
27340 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
27341         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
27342         uint64_t ret_ref = 0;
27343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27345         return ret_ref;
27346 }
27347 int64_t  __attribute__((export_name("TS_ChannelCounterparty_clone_ptr"))) TS_ChannelCounterparty_clone_ptr(uint64_t arg) {
27348         LDKChannelCounterparty arg_conv;
27349         arg_conv.inner = untag_ptr(arg);
27350         arg_conv.is_owned = ptr_is_owned(arg);
27351         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27352         arg_conv.is_owned = false;
27353         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
27354         return ret_conv;
27355 }
27356
27357 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_clone"))) TS_ChannelCounterparty_clone(uint64_t orig) {
27358         LDKChannelCounterparty orig_conv;
27359         orig_conv.inner = untag_ptr(orig);
27360         orig_conv.is_owned = ptr_is_owned(orig);
27361         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27362         orig_conv.is_owned = false;
27363         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
27364         uint64_t ret_ref = 0;
27365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27367         return ret_ref;
27368 }
27369
27370 void  __attribute__((export_name("TS_ChannelDetails_free"))) TS_ChannelDetails_free(uint64_t this_obj) {
27371         LDKChannelDetails this_obj_conv;
27372         this_obj_conv.inner = untag_ptr(this_obj);
27373         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27375         ChannelDetails_free(this_obj_conv);
27376 }
27377
27378 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_channel_id"))) TS_ChannelDetails_get_channel_id(uint64_t this_ptr) {
27379         LDKChannelDetails this_ptr_conv;
27380         this_ptr_conv.inner = untag_ptr(this_ptr);
27381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27383         this_ptr_conv.is_owned = false;
27384         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
27385         memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
27386         return ret_arr;
27387 }
27388
27389 void  __attribute__((export_name("TS_ChannelDetails_set_channel_id"))) TS_ChannelDetails_set_channel_id(uint64_t this_ptr, int8_tArray val) {
27390         LDKChannelDetails this_ptr_conv;
27391         this_ptr_conv.inner = untag_ptr(this_ptr);
27392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27394         this_ptr_conv.is_owned = false;
27395         LDKThirtyTwoBytes val_ref;
27396         CHECK(val->arr_len == 32);
27397         memcpy(val_ref.data, val->elems, 32); FREE(val);
27398         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
27399 }
27400
27401 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_counterparty"))) TS_ChannelDetails_get_counterparty(uint64_t this_ptr) {
27402         LDKChannelDetails this_ptr_conv;
27403         this_ptr_conv.inner = untag_ptr(this_ptr);
27404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27406         this_ptr_conv.is_owned = false;
27407         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
27408         uint64_t ret_ref = 0;
27409         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27410         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27411         return ret_ref;
27412 }
27413
27414 void  __attribute__((export_name("TS_ChannelDetails_set_counterparty"))) TS_ChannelDetails_set_counterparty(uint64_t this_ptr, uint64_t val) {
27415         LDKChannelDetails this_ptr_conv;
27416         this_ptr_conv.inner = untag_ptr(this_ptr);
27417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27419         this_ptr_conv.is_owned = false;
27420         LDKChannelCounterparty val_conv;
27421         val_conv.inner = untag_ptr(val);
27422         val_conv.is_owned = ptr_is_owned(val);
27423         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27424         val_conv = ChannelCounterparty_clone(&val_conv);
27425         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
27426 }
27427
27428 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_funding_txo"))) TS_ChannelDetails_get_funding_txo(uint64_t this_ptr) {
27429         LDKChannelDetails this_ptr_conv;
27430         this_ptr_conv.inner = untag_ptr(this_ptr);
27431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27433         this_ptr_conv.is_owned = false;
27434         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
27435         uint64_t ret_ref = 0;
27436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27438         return ret_ref;
27439 }
27440
27441 void  __attribute__((export_name("TS_ChannelDetails_set_funding_txo"))) TS_ChannelDetails_set_funding_txo(uint64_t this_ptr, uint64_t val) {
27442         LDKChannelDetails this_ptr_conv;
27443         this_ptr_conv.inner = untag_ptr(this_ptr);
27444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27446         this_ptr_conv.is_owned = false;
27447         LDKOutPoint val_conv;
27448         val_conv.inner = untag_ptr(val);
27449         val_conv.is_owned = ptr_is_owned(val);
27450         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27451         val_conv = OutPoint_clone(&val_conv);
27452         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
27453 }
27454
27455 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_type"))) TS_ChannelDetails_get_channel_type(uint64_t this_ptr) {
27456         LDKChannelDetails this_ptr_conv;
27457         this_ptr_conv.inner = untag_ptr(this_ptr);
27458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27460         this_ptr_conv.is_owned = false;
27461         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
27462         uint64_t ret_ref = 0;
27463         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27464         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27465         return ret_ref;
27466 }
27467
27468 void  __attribute__((export_name("TS_ChannelDetails_set_channel_type"))) TS_ChannelDetails_set_channel_type(uint64_t this_ptr, uint64_t val) {
27469         LDKChannelDetails this_ptr_conv;
27470         this_ptr_conv.inner = untag_ptr(this_ptr);
27471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27473         this_ptr_conv.is_owned = false;
27474         LDKChannelTypeFeatures val_conv;
27475         val_conv.inner = untag_ptr(val);
27476         val_conv.is_owned = ptr_is_owned(val);
27477         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27478         val_conv = ChannelTypeFeatures_clone(&val_conv);
27479         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
27480 }
27481
27482 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_short_channel_id"))) TS_ChannelDetails_get_short_channel_id(uint64_t this_ptr) {
27483         LDKChannelDetails this_ptr_conv;
27484         this_ptr_conv.inner = untag_ptr(this_ptr);
27485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27487         this_ptr_conv.is_owned = false;
27488         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27489         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
27490         uint64_t ret_ref = tag_ptr(ret_copy, true);
27491         return ret_ref;
27492 }
27493
27494 void  __attribute__((export_name("TS_ChannelDetails_set_short_channel_id"))) TS_ChannelDetails_set_short_channel_id(uint64_t this_ptr, uint64_t val) {
27495         LDKChannelDetails this_ptr_conv;
27496         this_ptr_conv.inner = untag_ptr(this_ptr);
27497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27499         this_ptr_conv.is_owned = false;
27500         void* val_ptr = untag_ptr(val);
27501         CHECK_ACCESS(val_ptr);
27502         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27503         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27504         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
27505 }
27506
27507 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_scid_alias"))) TS_ChannelDetails_get_outbound_scid_alias(uint64_t this_ptr) {
27508         LDKChannelDetails this_ptr_conv;
27509         this_ptr_conv.inner = untag_ptr(this_ptr);
27510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27512         this_ptr_conv.is_owned = false;
27513         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27514         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
27515         uint64_t ret_ref = tag_ptr(ret_copy, true);
27516         return ret_ref;
27517 }
27518
27519 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_scid_alias"))) TS_ChannelDetails_set_outbound_scid_alias(uint64_t this_ptr, uint64_t val) {
27520         LDKChannelDetails this_ptr_conv;
27521         this_ptr_conv.inner = untag_ptr(this_ptr);
27522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27524         this_ptr_conv.is_owned = false;
27525         void* val_ptr = untag_ptr(val);
27526         CHECK_ACCESS(val_ptr);
27527         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27528         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27529         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
27530 }
27531
27532 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_scid_alias"))) TS_ChannelDetails_get_inbound_scid_alias(uint64_t this_ptr) {
27533         LDKChannelDetails this_ptr_conv;
27534         this_ptr_conv.inner = untag_ptr(this_ptr);
27535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27537         this_ptr_conv.is_owned = false;
27538         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27539         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
27540         uint64_t ret_ref = tag_ptr(ret_copy, true);
27541         return ret_ref;
27542 }
27543
27544 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_scid_alias"))) TS_ChannelDetails_set_inbound_scid_alias(uint64_t this_ptr, uint64_t val) {
27545         LDKChannelDetails this_ptr_conv;
27546         this_ptr_conv.inner = untag_ptr(this_ptr);
27547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27549         this_ptr_conv.is_owned = false;
27550         void* val_ptr = untag_ptr(val);
27551         CHECK_ACCESS(val_ptr);
27552         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27553         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27554         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
27555 }
27556
27557 int64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_value_satoshis"))) TS_ChannelDetails_get_channel_value_satoshis(uint64_t this_ptr) {
27558         LDKChannelDetails this_ptr_conv;
27559         this_ptr_conv.inner = untag_ptr(this_ptr);
27560         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27562         this_ptr_conv.is_owned = false;
27563         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
27564         return ret_conv;
27565 }
27566
27567 void  __attribute__((export_name("TS_ChannelDetails_set_channel_value_satoshis"))) TS_ChannelDetails_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
27568         LDKChannelDetails this_ptr_conv;
27569         this_ptr_conv.inner = untag_ptr(this_ptr);
27570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27572         this_ptr_conv.is_owned = false;
27573         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
27574 }
27575
27576 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_unspendable_punishment_reserve"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint64_t this_ptr) {
27577         LDKChannelDetails this_ptr_conv;
27578         this_ptr_conv.inner = untag_ptr(this_ptr);
27579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27581         this_ptr_conv.is_owned = false;
27582         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27583         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
27584         uint64_t ret_ref = tag_ptr(ret_copy, true);
27585         return ret_ref;
27586 }
27587
27588 void  __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_reserve"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint64_t this_ptr, uint64_t val) {
27589         LDKChannelDetails this_ptr_conv;
27590         this_ptr_conv.inner = untag_ptr(this_ptr);
27591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27593         this_ptr_conv.is_owned = false;
27594         void* val_ptr = untag_ptr(val);
27595         CHECK_ACCESS(val_ptr);
27596         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27597         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27598         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
27599 }
27600
27601 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint64_t this_ptr) {
27602         LDKChannelDetails this_ptr_conv;
27603         this_ptr_conv.inner = untag_ptr(this_ptr);
27604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27606         this_ptr_conv.is_owned = false;
27607         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
27608         memcpy(ret_arr->elems, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
27609         return ret_arr;
27610 }
27611
27612 void  __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint64_t this_ptr, int8_tArray val) {
27613         LDKChannelDetails this_ptr_conv;
27614         this_ptr_conv.inner = untag_ptr(this_ptr);
27615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27617         this_ptr_conv.is_owned = false;
27618         LDKU128 val_ref;
27619         CHECK(val->arr_len == 16);
27620         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
27621         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
27622 }
27623
27624 int64_t  __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint64_t this_ptr) {
27625         LDKChannelDetails this_ptr_conv;
27626         this_ptr_conv.inner = untag_ptr(this_ptr);
27627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27629         this_ptr_conv.is_owned = false;
27630         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
27631         return ret_conv;
27632 }
27633
27634 void  __attribute__((export_name("TS_ChannelDetails_set_balance_msat"))) TS_ChannelDetails_set_balance_msat(uint64_t this_ptr, int64_t val) {
27635         LDKChannelDetails this_ptr_conv;
27636         this_ptr_conv.inner = untag_ptr(this_ptr);
27637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27639         this_ptr_conv.is_owned = false;
27640         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
27641 }
27642
27643 int64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_capacity_msat"))) TS_ChannelDetails_get_outbound_capacity_msat(uint64_t this_ptr) {
27644         LDKChannelDetails this_ptr_conv;
27645         this_ptr_conv.inner = untag_ptr(this_ptr);
27646         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27648         this_ptr_conv.is_owned = false;
27649         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
27650         return ret_conv;
27651 }
27652
27653 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_capacity_msat"))) TS_ChannelDetails_set_outbound_capacity_msat(uint64_t this_ptr, int64_t val) {
27654         LDKChannelDetails this_ptr_conv;
27655         this_ptr_conv.inner = untag_ptr(this_ptr);
27656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27658         this_ptr_conv.is_owned = false;
27659         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
27660 }
27661
27662 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) {
27663         LDKChannelDetails this_ptr_conv;
27664         this_ptr_conv.inner = untag_ptr(this_ptr);
27665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27667         this_ptr_conv.is_owned = false;
27668         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
27669         return ret_conv;
27670 }
27671
27672 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) {
27673         LDKChannelDetails this_ptr_conv;
27674         this_ptr_conv.inner = untag_ptr(this_ptr);
27675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27677         this_ptr_conv.is_owned = false;
27678         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
27679 }
27680
27681 int64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_capacity_msat"))) TS_ChannelDetails_get_inbound_capacity_msat(uint64_t this_ptr) {
27682         LDKChannelDetails this_ptr_conv;
27683         this_ptr_conv.inner = untag_ptr(this_ptr);
27684         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27686         this_ptr_conv.is_owned = false;
27687         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
27688         return ret_conv;
27689 }
27690
27691 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_capacity_msat"))) TS_ChannelDetails_set_inbound_capacity_msat(uint64_t this_ptr, int64_t val) {
27692         LDKChannelDetails this_ptr_conv;
27693         this_ptr_conv.inner = untag_ptr(this_ptr);
27694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27696         this_ptr_conv.is_owned = false;
27697         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
27698 }
27699
27700 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations_required"))) TS_ChannelDetails_get_confirmations_required(uint64_t this_ptr) {
27701         LDKChannelDetails this_ptr_conv;
27702         this_ptr_conv.inner = untag_ptr(this_ptr);
27703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27705         this_ptr_conv.is_owned = false;
27706         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
27707         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
27708         uint64_t ret_ref = tag_ptr(ret_copy, true);
27709         return ret_ref;
27710 }
27711
27712 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations_required"))) TS_ChannelDetails_set_confirmations_required(uint64_t this_ptr, uint64_t val) {
27713         LDKChannelDetails this_ptr_conv;
27714         this_ptr_conv.inner = untag_ptr(this_ptr);
27715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27717         this_ptr_conv.is_owned = false;
27718         void* val_ptr = untag_ptr(val);
27719         CHECK_ACCESS(val_ptr);
27720         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
27721         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
27722         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
27723 }
27724
27725 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations"))) TS_ChannelDetails_get_confirmations(uint64_t this_ptr) {
27726         LDKChannelDetails this_ptr_conv;
27727         this_ptr_conv.inner = untag_ptr(this_ptr);
27728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27730         this_ptr_conv.is_owned = false;
27731         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
27732         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
27733         uint64_t ret_ref = tag_ptr(ret_copy, true);
27734         return ret_ref;
27735 }
27736
27737 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations"))) TS_ChannelDetails_set_confirmations(uint64_t this_ptr, uint64_t val) {
27738         LDKChannelDetails this_ptr_conv;
27739         this_ptr_conv.inner = untag_ptr(this_ptr);
27740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27742         this_ptr_conv.is_owned = false;
27743         void* val_ptr = untag_ptr(val);
27744         CHECK_ACCESS(val_ptr);
27745         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
27746         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
27747         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
27748 }
27749
27750 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint64_t this_ptr) {
27751         LDKChannelDetails this_ptr_conv;
27752         this_ptr_conv.inner = untag_ptr(this_ptr);
27753         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27755         this_ptr_conv.is_owned = false;
27756         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
27757         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
27758         uint64_t ret_ref = tag_ptr(ret_copy, true);
27759         return ret_ref;
27760 }
27761
27762 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) {
27763         LDKChannelDetails this_ptr_conv;
27764         this_ptr_conv.inner = untag_ptr(this_ptr);
27765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27767         this_ptr_conv.is_owned = false;
27768         void* val_ptr = untag_ptr(val);
27769         CHECK_ACCESS(val_ptr);
27770         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
27771         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
27772         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
27773 }
27774
27775 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_outbound"))) TS_ChannelDetails_get_is_outbound(uint64_t this_ptr) {
27776         LDKChannelDetails this_ptr_conv;
27777         this_ptr_conv.inner = untag_ptr(this_ptr);
27778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27780         this_ptr_conv.is_owned = false;
27781         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
27782         return ret_conv;
27783 }
27784
27785 void  __attribute__((export_name("TS_ChannelDetails_set_is_outbound"))) TS_ChannelDetails_set_is_outbound(uint64_t this_ptr, jboolean val) {
27786         LDKChannelDetails this_ptr_conv;
27787         this_ptr_conv.inner = untag_ptr(this_ptr);
27788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27790         this_ptr_conv.is_owned = false;
27791         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
27792 }
27793
27794 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_channel_ready"))) TS_ChannelDetails_get_is_channel_ready(uint64_t this_ptr) {
27795         LDKChannelDetails this_ptr_conv;
27796         this_ptr_conv.inner = untag_ptr(this_ptr);
27797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27799         this_ptr_conv.is_owned = false;
27800         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
27801         return ret_conv;
27802 }
27803
27804 void  __attribute__((export_name("TS_ChannelDetails_set_is_channel_ready"))) TS_ChannelDetails_set_is_channel_ready(uint64_t this_ptr, jboolean val) {
27805         LDKChannelDetails this_ptr_conv;
27806         this_ptr_conv.inner = untag_ptr(this_ptr);
27807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27809         this_ptr_conv.is_owned = false;
27810         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
27811 }
27812
27813 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_usable"))) TS_ChannelDetails_get_is_usable(uint64_t this_ptr) {
27814         LDKChannelDetails this_ptr_conv;
27815         this_ptr_conv.inner = untag_ptr(this_ptr);
27816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27818         this_ptr_conv.is_owned = false;
27819         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
27820         return ret_conv;
27821 }
27822
27823 void  __attribute__((export_name("TS_ChannelDetails_set_is_usable"))) TS_ChannelDetails_set_is_usable(uint64_t this_ptr, jboolean val) {
27824         LDKChannelDetails this_ptr_conv;
27825         this_ptr_conv.inner = untag_ptr(this_ptr);
27826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27828         this_ptr_conv.is_owned = false;
27829         ChannelDetails_set_is_usable(&this_ptr_conv, val);
27830 }
27831
27832 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_public"))) TS_ChannelDetails_get_is_public(uint64_t this_ptr) {
27833         LDKChannelDetails this_ptr_conv;
27834         this_ptr_conv.inner = untag_ptr(this_ptr);
27835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27837         this_ptr_conv.is_owned = false;
27838         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
27839         return ret_conv;
27840 }
27841
27842 void  __attribute__((export_name("TS_ChannelDetails_set_is_public"))) TS_ChannelDetails_set_is_public(uint64_t this_ptr, jboolean val) {
27843         LDKChannelDetails this_ptr_conv;
27844         this_ptr_conv.inner = untag_ptr(this_ptr);
27845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27847         this_ptr_conv.is_owned = false;
27848         ChannelDetails_set_is_public(&this_ptr_conv, val);
27849 }
27850
27851 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_minimum_msat"))) TS_ChannelDetails_get_inbound_htlc_minimum_msat(uint64_t this_ptr) {
27852         LDKChannelDetails this_ptr_conv;
27853         this_ptr_conv.inner = untag_ptr(this_ptr);
27854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27856         this_ptr_conv.is_owned = false;
27857         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27858         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
27859         uint64_t ret_ref = tag_ptr(ret_copy, true);
27860         return ret_ref;
27861 }
27862
27863 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) {
27864         LDKChannelDetails this_ptr_conv;
27865         this_ptr_conv.inner = untag_ptr(this_ptr);
27866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27868         this_ptr_conv.is_owned = false;
27869         void* val_ptr = untag_ptr(val);
27870         CHECK_ACCESS(val_ptr);
27871         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27872         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27873         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
27874 }
27875
27876 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_maximum_msat"))) TS_ChannelDetails_get_inbound_htlc_maximum_msat(uint64_t this_ptr) {
27877         LDKChannelDetails this_ptr_conv;
27878         this_ptr_conv.inner = untag_ptr(this_ptr);
27879         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27881         this_ptr_conv.is_owned = false;
27882         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
27883         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
27884         uint64_t ret_ref = tag_ptr(ret_copy, true);
27885         return ret_ref;
27886 }
27887
27888 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) {
27889         LDKChannelDetails this_ptr_conv;
27890         this_ptr_conv.inner = untag_ptr(this_ptr);
27891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27893         this_ptr_conv.is_owned = false;
27894         void* val_ptr = untag_ptr(val);
27895         CHECK_ACCESS(val_ptr);
27896         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
27897         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
27898         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
27899 }
27900
27901 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_config"))) TS_ChannelDetails_get_config(uint64_t this_ptr) {
27902         LDKChannelDetails this_ptr_conv;
27903         this_ptr_conv.inner = untag_ptr(this_ptr);
27904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27906         this_ptr_conv.is_owned = false;
27907         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
27908         uint64_t ret_ref = 0;
27909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27911         return ret_ref;
27912 }
27913
27914 void  __attribute__((export_name("TS_ChannelDetails_set_config"))) TS_ChannelDetails_set_config(uint64_t this_ptr, uint64_t val) {
27915         LDKChannelDetails this_ptr_conv;
27916         this_ptr_conv.inner = untag_ptr(this_ptr);
27917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27919         this_ptr_conv.is_owned = false;
27920         LDKChannelConfig val_conv;
27921         val_conv.inner = untag_ptr(val);
27922         val_conv.is_owned = ptr_is_owned(val);
27923         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
27924         val_conv = ChannelConfig_clone(&val_conv);
27925         ChannelDetails_set_config(&this_ptr_conv, val_conv);
27926 }
27927
27928 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) {
27929         LDKThirtyTwoBytes channel_id_arg_ref;
27930         CHECK(channel_id_arg->arr_len == 32);
27931         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
27932         LDKChannelCounterparty counterparty_arg_conv;
27933         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
27934         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
27935         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
27936         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
27937         LDKOutPoint funding_txo_arg_conv;
27938         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
27939         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
27940         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
27941         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
27942         LDKChannelTypeFeatures channel_type_arg_conv;
27943         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
27944         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
27945         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
27946         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
27947         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
27948         CHECK_ACCESS(short_channel_id_arg_ptr);
27949         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
27950         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
27951         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
27952         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
27953         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
27954         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
27955         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
27956         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
27957         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
27958         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
27959         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
27960         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
27961         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
27962         LDKU128 user_channel_id_arg_ref;
27963         CHECK(user_channel_id_arg->arr_len == 16);
27964         memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg);
27965         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
27966         CHECK_ACCESS(confirmations_required_arg_ptr);
27967         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
27968         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
27969         void* confirmations_arg_ptr = untag_ptr(confirmations_arg);
27970         CHECK_ACCESS(confirmations_arg_ptr);
27971         LDKCOption_u32Z confirmations_arg_conv = *(LDKCOption_u32Z*)(confirmations_arg_ptr);
27972         confirmations_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_arg));
27973         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
27974         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
27975         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
27976         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
27977         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
27978         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
27979         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
27980         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
27981         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
27982         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
27983         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
27984         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
27985         LDKChannelConfig config_arg_conv;
27986         config_arg_conv.inner = untag_ptr(config_arg);
27987         config_arg_conv.is_owned = ptr_is_owned(config_arg);
27988         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
27989         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
27990         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);
27991         uint64_t ret_ref = 0;
27992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27994         return ret_ref;
27995 }
27996
27997 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
27998         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
27999         uint64_t ret_ref = 0;
28000         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28001         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28002         return ret_ref;
28003 }
28004 int64_t  __attribute__((export_name("TS_ChannelDetails_clone_ptr"))) TS_ChannelDetails_clone_ptr(uint64_t arg) {
28005         LDKChannelDetails arg_conv;
28006         arg_conv.inner = untag_ptr(arg);
28007         arg_conv.is_owned = ptr_is_owned(arg);
28008         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28009         arg_conv.is_owned = false;
28010         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
28011         return ret_conv;
28012 }
28013
28014 uint64_t  __attribute__((export_name("TS_ChannelDetails_clone"))) TS_ChannelDetails_clone(uint64_t orig) {
28015         LDKChannelDetails orig_conv;
28016         orig_conv.inner = untag_ptr(orig);
28017         orig_conv.is_owned = ptr_is_owned(orig);
28018         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28019         orig_conv.is_owned = false;
28020         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
28021         uint64_t ret_ref = 0;
28022         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28023         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28024         return ret_ref;
28025 }
28026
28027 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_payment_scid"))) TS_ChannelDetails_get_inbound_payment_scid(uint64_t this_arg) {
28028         LDKChannelDetails this_arg_conv;
28029         this_arg_conv.inner = untag_ptr(this_arg);
28030         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28032         this_arg_conv.is_owned = false;
28033         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28034         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
28035         uint64_t ret_ref = tag_ptr(ret_copy, true);
28036         return ret_ref;
28037 }
28038
28039 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_payment_scid"))) TS_ChannelDetails_get_outbound_payment_scid(uint64_t this_arg) {
28040         LDKChannelDetails this_arg_conv;
28041         this_arg_conv.inner = untag_ptr(this_arg);
28042         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28044         this_arg_conv.is_owned = false;
28045         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
28046         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
28047         uint64_t ret_ref = tag_ptr(ret_copy, true);
28048         return ret_ref;
28049 }
28050
28051 void  __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint64_t this_ptr) {
28052         if (!ptr_is_owned(this_ptr)) return;
28053         void* this_ptr_ptr = untag_ptr(this_ptr);
28054         CHECK_ACCESS(this_ptr_ptr);
28055         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
28056         FREE(untag_ptr(this_ptr));
28057         PaymentSendFailure_free(this_ptr_conv);
28058 }
28059
28060 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
28061         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28062         *ret_copy = PaymentSendFailure_clone(arg);
28063         uint64_t ret_ref = tag_ptr(ret_copy, true);
28064         return ret_ref;
28065 }
28066 int64_t  __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint64_t arg) {
28067         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
28068         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
28069         return ret_conv;
28070 }
28071
28072 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint64_t orig) {
28073         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
28074         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28075         *ret_copy = PaymentSendFailure_clone(orig_conv);
28076         uint64_t ret_ref = tag_ptr(ret_copy, true);
28077         return ret_ref;
28078 }
28079
28080 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint64_t a) {
28081         void* a_ptr = untag_ptr(a);
28082         CHECK_ACCESS(a_ptr);
28083         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
28084         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
28085         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28086         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
28087         uint64_t ret_ref = tag_ptr(ret_copy, true);
28088         return ret_ref;
28089 }
28090
28091 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint64_tArray a) {
28092         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
28093         a_constr.datalen = a->arr_len;
28094         if (a_constr.datalen > 0)
28095                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
28096         else
28097                 a_constr.data = NULL;
28098         uint64_t* a_vals = a->elems;
28099         for (size_t w = 0; w < a_constr.datalen; w++) {
28100                 uint64_t a_conv_22 = a_vals[w];
28101                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
28102                 CHECK_ACCESS(a_conv_22_ptr);
28103                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
28104                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
28105                 a_constr.data[w] = a_conv_22_conv;
28106         }
28107         FREE(a);
28108         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28109         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
28110         uint64_t ret_ref = tag_ptr(ret_copy, true);
28111         return ret_ref;
28112 }
28113
28114 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_all_failed_resend_safe"))) TS_PaymentSendFailure_all_failed_resend_safe(uint64_tArray a) {
28115         LDKCVec_APIErrorZ a_constr;
28116         a_constr.datalen = a->arr_len;
28117         if (a_constr.datalen > 0)
28118                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
28119         else
28120                 a_constr.data = NULL;
28121         uint64_t* a_vals = a->elems;
28122         for (size_t k = 0; k < a_constr.datalen; k++) {
28123                 uint64_t a_conv_10 = a_vals[k];
28124                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
28125                 CHECK_ACCESS(a_conv_10_ptr);
28126                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
28127                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
28128                 a_constr.data[k] = a_conv_10_conv;
28129         }
28130         FREE(a);
28131         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28132         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
28133         uint64_t ret_ref = tag_ptr(ret_copy, true);
28134         return ret_ref;
28135 }
28136
28137 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_duplicate_payment"))) TS_PaymentSendFailure_duplicate_payment() {
28138         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28139         *ret_copy = PaymentSendFailure_duplicate_payment();
28140         uint64_t ret_ref = tag_ptr(ret_copy, true);
28141         return ret_ref;
28142 }
28143
28144 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) {
28145         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
28146         results_constr.datalen = results->arr_len;
28147         if (results_constr.datalen > 0)
28148                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
28149         else
28150                 results_constr.data = NULL;
28151         uint64_t* results_vals = results->elems;
28152         for (size_t w = 0; w < results_constr.datalen; w++) {
28153                 uint64_t results_conv_22 = results_vals[w];
28154                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
28155                 CHECK_ACCESS(results_conv_22_ptr);
28156                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
28157                 results_constr.data[w] = results_conv_22_conv;
28158         }
28159         FREE(results);
28160         LDKRouteParameters failed_paths_retry_conv;
28161         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
28162         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
28163         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
28164         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
28165         LDKThirtyTwoBytes payment_id_ref;
28166         CHECK(payment_id->arr_len == 32);
28167         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
28168         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
28169         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
28170         uint64_t ret_ref = tag_ptr(ret_copy, true);
28171         return ret_ref;
28172 }
28173
28174 void  __attribute__((export_name("TS_PhantomRouteHints_free"))) TS_PhantomRouteHints_free(uint64_t this_obj) {
28175         LDKPhantomRouteHints this_obj_conv;
28176         this_obj_conv.inner = untag_ptr(this_obj);
28177         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28179         PhantomRouteHints_free(this_obj_conv);
28180 }
28181
28182 uint64_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_channels"))) TS_PhantomRouteHints_get_channels(uint64_t this_ptr) {
28183         LDKPhantomRouteHints this_ptr_conv;
28184         this_ptr_conv.inner = untag_ptr(this_ptr);
28185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28187         this_ptr_conv.is_owned = false;
28188         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
28189         uint64_tArray ret_arr = NULL;
28190         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28191         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28192         for (size_t q = 0; q < ret_var.datalen; q++) {
28193                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28194                 uint64_t ret_conv_16_ref = 0;
28195                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28196                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
28197                 ret_arr_ptr[q] = ret_conv_16_ref;
28198         }
28199         
28200         FREE(ret_var.data);
28201         return ret_arr;
28202 }
28203
28204 void  __attribute__((export_name("TS_PhantomRouteHints_set_channels"))) TS_PhantomRouteHints_set_channels(uint64_t this_ptr, uint64_tArray val) {
28205         LDKPhantomRouteHints this_ptr_conv;
28206         this_ptr_conv.inner = untag_ptr(this_ptr);
28207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28209         this_ptr_conv.is_owned = false;
28210         LDKCVec_ChannelDetailsZ val_constr;
28211         val_constr.datalen = val->arr_len;
28212         if (val_constr.datalen > 0)
28213                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
28214         else
28215                 val_constr.data = NULL;
28216         uint64_t* val_vals = val->elems;
28217         for (size_t q = 0; q < val_constr.datalen; q++) {
28218                 uint64_t val_conv_16 = val_vals[q];
28219                 LDKChannelDetails val_conv_16_conv;
28220                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
28221                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
28222                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
28223                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
28224                 val_constr.data[q] = val_conv_16_conv;
28225         }
28226         FREE(val);
28227         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
28228 }
28229
28230 int64_t  __attribute__((export_name("TS_PhantomRouteHints_get_phantom_scid"))) TS_PhantomRouteHints_get_phantom_scid(uint64_t this_ptr) {
28231         LDKPhantomRouteHints this_ptr_conv;
28232         this_ptr_conv.inner = untag_ptr(this_ptr);
28233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28235         this_ptr_conv.is_owned = false;
28236         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
28237         return ret_conv;
28238 }
28239
28240 void  __attribute__((export_name("TS_PhantomRouteHints_set_phantom_scid"))) TS_PhantomRouteHints_set_phantom_scid(uint64_t this_ptr, int64_t val) {
28241         LDKPhantomRouteHints this_ptr_conv;
28242         this_ptr_conv.inner = untag_ptr(this_ptr);
28243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28245         this_ptr_conv.is_owned = false;
28246         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
28247 }
28248
28249 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_real_node_pubkey"))) TS_PhantomRouteHints_get_real_node_pubkey(uint64_t this_ptr) {
28250         LDKPhantomRouteHints this_ptr_conv;
28251         this_ptr_conv.inner = untag_ptr(this_ptr);
28252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28254         this_ptr_conv.is_owned = false;
28255         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28256         memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
28257         return ret_arr;
28258 }
28259
28260 void  __attribute__((export_name("TS_PhantomRouteHints_set_real_node_pubkey"))) TS_PhantomRouteHints_set_real_node_pubkey(uint64_t this_ptr, int8_tArray val) {
28261         LDKPhantomRouteHints this_ptr_conv;
28262         this_ptr_conv.inner = untag_ptr(this_ptr);
28263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28265         this_ptr_conv.is_owned = false;
28266         LDKPublicKey val_ref;
28267         CHECK(val->arr_len == 33);
28268         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28269         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
28270 }
28271
28272 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) {
28273         LDKCVec_ChannelDetailsZ channels_arg_constr;
28274         channels_arg_constr.datalen = channels_arg->arr_len;
28275         if (channels_arg_constr.datalen > 0)
28276                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
28277         else
28278                 channels_arg_constr.data = NULL;
28279         uint64_t* channels_arg_vals = channels_arg->elems;
28280         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
28281                 uint64_t channels_arg_conv_16 = channels_arg_vals[q];
28282                 LDKChannelDetails channels_arg_conv_16_conv;
28283                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
28284                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
28285                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
28286                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
28287                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
28288         }
28289         FREE(channels_arg);
28290         LDKPublicKey real_node_pubkey_arg_ref;
28291         CHECK(real_node_pubkey_arg->arr_len == 33);
28292         memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
28293         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
28294         uint64_t ret_ref = 0;
28295         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28296         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28297         return ret_ref;
28298 }
28299
28300 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
28301         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
28302         uint64_t ret_ref = 0;
28303         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28304         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28305         return ret_ref;
28306 }
28307 int64_t  __attribute__((export_name("TS_PhantomRouteHints_clone_ptr"))) TS_PhantomRouteHints_clone_ptr(uint64_t arg) {
28308         LDKPhantomRouteHints arg_conv;
28309         arg_conv.inner = untag_ptr(arg);
28310         arg_conv.is_owned = ptr_is_owned(arg);
28311         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28312         arg_conv.is_owned = false;
28313         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
28314         return ret_conv;
28315 }
28316
28317 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_clone"))) TS_PhantomRouteHints_clone(uint64_t orig) {
28318         LDKPhantomRouteHints orig_conv;
28319         orig_conv.inner = untag_ptr(orig);
28320         orig_conv.is_owned = ptr_is_owned(orig);
28321         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28322         orig_conv.is_owned = false;
28323         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
28324         uint64_t ret_ref = 0;
28325         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28326         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28327         return ret_ref;
28328 }
28329
28330 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) {
28331         void* fee_est_ptr = untag_ptr(fee_est);
28332         CHECK_ACCESS(fee_est_ptr);
28333         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
28334         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
28335                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28336                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
28337         }
28338         void* chain_monitor_ptr = untag_ptr(chain_monitor);
28339         CHECK_ACCESS(chain_monitor_ptr);
28340         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
28341         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
28342                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28343                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
28344         }
28345         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
28346         CHECK_ACCESS(tx_broadcaster_ptr);
28347         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
28348         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
28349                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28350                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
28351         }
28352         void* logger_ptr = untag_ptr(logger);
28353         CHECK_ACCESS(logger_ptr);
28354         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
28355         if (logger_conv.free == LDKLogger_JCalls_free) {
28356                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28357                 LDKLogger_JCalls_cloned(&logger_conv);
28358         }
28359         void* keys_manager_ptr = untag_ptr(keys_manager);
28360         CHECK_ACCESS(keys_manager_ptr);
28361         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
28362         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
28363                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28364                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
28365         }
28366         LDKUserConfig config_conv;
28367         config_conv.inner = untag_ptr(config);
28368         config_conv.is_owned = ptr_is_owned(config);
28369         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
28370         config_conv = UserConfig_clone(&config_conv);
28371         LDKChainParameters params_conv;
28372         params_conv.inner = untag_ptr(params);
28373         params_conv.is_owned = ptr_is_owned(params);
28374         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
28375         params_conv = ChainParameters_clone(&params_conv);
28376         LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
28377         uint64_t ret_ref = 0;
28378         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28379         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28380         return ret_ref;
28381 }
28382
28383 uint64_t  __attribute__((export_name("TS_ChannelManager_get_current_default_configuration"))) TS_ChannelManager_get_current_default_configuration(uint64_t this_arg) {
28384         LDKChannelManager this_arg_conv;
28385         this_arg_conv.inner = untag_ptr(this_arg);
28386         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28388         this_arg_conv.is_owned = false;
28389         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
28390         uint64_t ret_ref = 0;
28391         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28392         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28393         return ret_ref;
28394 }
28395
28396 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) {
28397         LDKChannelManager this_arg_conv;
28398         this_arg_conv.inner = untag_ptr(this_arg);
28399         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28401         this_arg_conv.is_owned = false;
28402         LDKPublicKey their_network_key_ref;
28403         CHECK(their_network_key->arr_len == 33);
28404         memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
28405         LDKU128 user_channel_id_ref;
28406         CHECK(user_channel_id->arr_len == 16);
28407         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
28408         LDKUserConfig override_config_conv;
28409         override_config_conv.inner = untag_ptr(override_config);
28410         override_config_conv.is_owned = ptr_is_owned(override_config);
28411         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
28412         override_config_conv = UserConfig_clone(&override_config_conv);
28413         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
28414         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id_ref, override_config_conv);
28415         return tag_ptr(ret_conv, true);
28416 }
28417
28418 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_channels"))) TS_ChannelManager_list_channels(uint64_t this_arg) {
28419         LDKChannelManager this_arg_conv;
28420         this_arg_conv.inner = untag_ptr(this_arg);
28421         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28423         this_arg_conv.is_owned = false;
28424         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
28425         uint64_tArray ret_arr = NULL;
28426         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28427         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28428         for (size_t q = 0; q < ret_var.datalen; q++) {
28429                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28430                 uint64_t ret_conv_16_ref = 0;
28431                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28432                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
28433                 ret_arr_ptr[q] = ret_conv_16_ref;
28434         }
28435         
28436         FREE(ret_var.data);
28437         return ret_arr;
28438 }
28439
28440 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_usable_channels"))) TS_ChannelManager_list_usable_channels(uint64_t this_arg) {
28441         LDKChannelManager this_arg_conv;
28442         this_arg_conv.inner = untag_ptr(this_arg);
28443         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28445         this_arg_conv.is_owned = false;
28446         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
28447         uint64_tArray ret_arr = NULL;
28448         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
28449         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
28450         for (size_t q = 0; q < ret_var.datalen; q++) {
28451                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
28452                 uint64_t ret_conv_16_ref = 0;
28453                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
28454                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
28455                 ret_arr_ptr[q] = ret_conv_16_ref;
28456         }
28457         
28458         FREE(ret_var.data);
28459         return ret_arr;
28460 }
28461
28462 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) {
28463         LDKChannelManager this_arg_conv;
28464         this_arg_conv.inner = untag_ptr(this_arg);
28465         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28467         this_arg_conv.is_owned = false;
28468         unsigned char channel_id_arr[32];
28469         CHECK(channel_id->arr_len == 32);
28470         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
28471         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
28472         LDKPublicKey counterparty_node_id_ref;
28473         CHECK(counterparty_node_id->arr_len == 33);
28474         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28475         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28476         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
28477         return tag_ptr(ret_conv, true);
28478 }
28479
28480 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) {
28481         LDKChannelManager this_arg_conv;
28482         this_arg_conv.inner = untag_ptr(this_arg);
28483         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28485         this_arg_conv.is_owned = false;
28486         unsigned char channel_id_arr[32];
28487         CHECK(channel_id->arr_len == 32);
28488         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
28489         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
28490         LDKPublicKey counterparty_node_id_ref;
28491         CHECK(counterparty_node_id->arr_len == 33);
28492         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28493         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28494         *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight);
28495         return tag_ptr(ret_conv, true);
28496 }
28497
28498 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) {
28499         LDKChannelManager this_arg_conv;
28500         this_arg_conv.inner = untag_ptr(this_arg);
28501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28503         this_arg_conv.is_owned = false;
28504         unsigned char channel_id_arr[32];
28505         CHECK(channel_id->arr_len == 32);
28506         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
28507         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
28508         LDKPublicKey counterparty_node_id_ref;
28509         CHECK(counterparty_node_id->arr_len == 33);
28510         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28511         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28512         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
28513         return tag_ptr(ret_conv, true);
28514 }
28515
28516 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) {
28517         LDKChannelManager this_arg_conv;
28518         this_arg_conv.inner = untag_ptr(this_arg);
28519         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28521         this_arg_conv.is_owned = false;
28522         unsigned char channel_id_arr[32];
28523         CHECK(channel_id->arr_len == 32);
28524         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
28525         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
28526         LDKPublicKey counterparty_node_id_ref;
28527         CHECK(counterparty_node_id->arr_len == 33);
28528         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28529         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28530         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
28531         return tag_ptr(ret_conv, true);
28532 }
28533
28534 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) {
28535         LDKChannelManager this_arg_conv;
28536         this_arg_conv.inner = untag_ptr(this_arg);
28537         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28539         this_arg_conv.is_owned = false;
28540         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
28541 }
28542
28543 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) {
28544         LDKChannelManager this_arg_conv;
28545         this_arg_conv.inner = untag_ptr(this_arg);
28546         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28548         this_arg_conv.is_owned = false;
28549         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
28550 }
28551
28552 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) {
28553         LDKChannelManager this_arg_conv;
28554         this_arg_conv.inner = untag_ptr(this_arg);
28555         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28557         this_arg_conv.is_owned = false;
28558         LDKRoute route_conv;
28559         route_conv.inner = untag_ptr(route);
28560         route_conv.is_owned = ptr_is_owned(route);
28561         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
28562         route_conv.is_owned = false;
28563         LDKThirtyTwoBytes payment_hash_ref;
28564         CHECK(payment_hash->arr_len == 32);
28565         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28566         LDKThirtyTwoBytes payment_secret_ref;
28567         CHECK(payment_secret->arr_len == 32);
28568         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
28569         LDKThirtyTwoBytes payment_id_ref;
28570         CHECK(payment_id->arr_len == 32);
28571         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
28572         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
28573         *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref, payment_id_ref);
28574         return tag_ptr(ret_conv, true);
28575 }
28576
28577 uint64_t  __attribute__((export_name("TS_ChannelManager_retry_payment"))) TS_ChannelManager_retry_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_id) {
28578         LDKChannelManager this_arg_conv;
28579         this_arg_conv.inner = untag_ptr(this_arg);
28580         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28582         this_arg_conv.is_owned = false;
28583         LDKRoute route_conv;
28584         route_conv.inner = untag_ptr(route);
28585         route_conv.is_owned = ptr_is_owned(route);
28586         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
28587         route_conv.is_owned = false;
28588         LDKThirtyTwoBytes payment_id_ref;
28589         CHECK(payment_id->arr_len == 32);
28590         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
28591         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
28592         *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
28593         return tag_ptr(ret_conv, true);
28594 }
28595
28596 void  __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_ChannelManager_abandon_payment(uint64_t this_arg, int8_tArray payment_id) {
28597         LDKChannelManager this_arg_conv;
28598         this_arg_conv.inner = untag_ptr(this_arg);
28599         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28601         this_arg_conv.is_owned = false;
28602         LDKThirtyTwoBytes payment_id_ref;
28603         CHECK(payment_id->arr_len == 32);
28604         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
28605         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
28606 }
28607
28608 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) {
28609         LDKChannelManager this_arg_conv;
28610         this_arg_conv.inner = untag_ptr(this_arg);
28611         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28613         this_arg_conv.is_owned = false;
28614         LDKRoute route_conv;
28615         route_conv.inner = untag_ptr(route);
28616         route_conv.is_owned = ptr_is_owned(route);
28617         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
28618         route_conv.is_owned = false;
28619         LDKThirtyTwoBytes payment_preimage_ref;
28620         CHECK(payment_preimage->arr_len == 32);
28621         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
28622         LDKThirtyTwoBytes payment_id_ref;
28623         CHECK(payment_id->arr_len == 32);
28624         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
28625         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
28626         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref, payment_id_ref);
28627         return tag_ptr(ret_conv, true);
28628 }
28629
28630 uint64_t  __attribute__((export_name("TS_ChannelManager_send_probe"))) TS_ChannelManager_send_probe(uint64_t this_arg, uint64_tArray hops) {
28631         LDKChannelManager this_arg_conv;
28632         this_arg_conv.inner = untag_ptr(this_arg);
28633         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28635         this_arg_conv.is_owned = false;
28636         LDKCVec_RouteHopZ hops_constr;
28637         hops_constr.datalen = hops->arr_len;
28638         if (hops_constr.datalen > 0)
28639                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
28640         else
28641                 hops_constr.data = NULL;
28642         uint64_t* hops_vals = hops->elems;
28643         for (size_t k = 0; k < hops_constr.datalen; k++) {
28644                 uint64_t hops_conv_10 = hops_vals[k];
28645                 LDKRouteHop hops_conv_10_conv;
28646                 hops_conv_10_conv.inner = untag_ptr(hops_conv_10);
28647                 hops_conv_10_conv.is_owned = ptr_is_owned(hops_conv_10);
28648                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv_10_conv);
28649                 hops_conv_10_conv = RouteHop_clone(&hops_conv_10_conv);
28650                 hops_constr.data[k] = hops_conv_10_conv;
28651         }
28652         FREE(hops);
28653         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
28654         *ret_conv = ChannelManager_send_probe(&this_arg_conv, hops_constr);
28655         return tag_ptr(ret_conv, true);
28656 }
28657
28658 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) {
28659         LDKChannelManager this_arg_conv;
28660         this_arg_conv.inner = untag_ptr(this_arg);
28661         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28663         this_arg_conv.is_owned = false;
28664         unsigned char temporary_channel_id_arr[32];
28665         CHECK(temporary_channel_id->arr_len == 32);
28666         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
28667         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
28668         LDKPublicKey counterparty_node_id_ref;
28669         CHECK(counterparty_node_id->arr_len == 33);
28670         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28671         LDKTransaction funding_transaction_ref;
28672         funding_transaction_ref.datalen = funding_transaction->arr_len;
28673         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
28674         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
28675         funding_transaction_ref.data_is_owned = true;
28676         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28677         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
28678         return tag_ptr(ret_conv, true);
28679 }
28680
28681 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) {
28682         LDKChannelManager this_arg_conv;
28683         this_arg_conv.inner = untag_ptr(this_arg);
28684         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28686         this_arg_conv.is_owned = false;
28687         LDKPublicKey counterparty_node_id_ref;
28688         CHECK(counterparty_node_id->arr_len == 33);
28689         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28690         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
28691         channel_ids_constr.datalen = channel_ids->arr_len;
28692         if (channel_ids_constr.datalen > 0)
28693                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
28694         else
28695                 channel_ids_constr.data = NULL;
28696         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
28697         for (size_t m = 0; m < channel_ids_constr.datalen; m++) {
28698                 int8_tArray channel_ids_conv_12 = channel_ids_vals[m];
28699                 LDKThirtyTwoBytes channel_ids_conv_12_ref;
28700                 CHECK(channel_ids_conv_12->arr_len == 32);
28701                 memcpy(channel_ids_conv_12_ref.data, channel_ids_conv_12->elems, 32); FREE(channel_ids_conv_12);
28702                 channel_ids_constr.data[m] = channel_ids_conv_12_ref;
28703         }
28704         FREE(channel_ids);
28705         LDKChannelConfig config_conv;
28706         config_conv.inner = untag_ptr(config);
28707         config_conv.is_owned = ptr_is_owned(config);
28708         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
28709         config_conv.is_owned = false;
28710         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28711         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
28712         return tag_ptr(ret_conv, true);
28713 }
28714
28715 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) {
28716         LDKChannelManager this_arg_conv;
28717         this_arg_conv.inner = untag_ptr(this_arg);
28718         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28720         this_arg_conv.is_owned = false;
28721         LDKThirtyTwoBytes intercept_id_ref;
28722         CHECK(intercept_id->arr_len == 32);
28723         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
28724         unsigned char next_hop_channel_id_arr[32];
28725         CHECK(next_hop_channel_id->arr_len == 32);
28726         memcpy(next_hop_channel_id_arr, next_hop_channel_id->elems, 32); FREE(next_hop_channel_id);
28727         unsigned char (*next_hop_channel_id_ref)[32] = &next_hop_channel_id_arr;
28728         LDKPublicKey _next_node_id_ref;
28729         CHECK(_next_node_id->arr_len == 33);
28730         memcpy(_next_node_id_ref.compressed_form, _next_node_id->elems, 33); FREE(_next_node_id);
28731         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28732         *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);
28733         return tag_ptr(ret_conv, true);
28734 }
28735
28736 uint64_t  __attribute__((export_name("TS_ChannelManager_fail_intercepted_htlc"))) TS_ChannelManager_fail_intercepted_htlc(uint64_t this_arg, int8_tArray intercept_id) {
28737         LDKChannelManager this_arg_conv;
28738         this_arg_conv.inner = untag_ptr(this_arg);
28739         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28741         this_arg_conv.is_owned = false;
28742         LDKThirtyTwoBytes intercept_id_ref;
28743         CHECK(intercept_id->arr_len == 32);
28744         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
28745         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28746         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
28747         return tag_ptr(ret_conv, true);
28748 }
28749
28750 void  __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint64_t this_arg) {
28751         LDKChannelManager this_arg_conv;
28752         this_arg_conv.inner = untag_ptr(this_arg);
28753         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28755         this_arg_conv.is_owned = false;
28756         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
28757 }
28758
28759 void  __attribute__((export_name("TS_ChannelManager_timer_tick_occurred"))) TS_ChannelManager_timer_tick_occurred(uint64_t this_arg) {
28760         LDKChannelManager this_arg_conv;
28761         this_arg_conv.inner = untag_ptr(this_arg);
28762         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28764         this_arg_conv.is_owned = false;
28765         ChannelManager_timer_tick_occurred(&this_arg_conv);
28766 }
28767
28768 void  __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_ChannelManager_fail_htlc_backwards(uint64_t this_arg, int8_tArray payment_hash) {
28769         LDKChannelManager this_arg_conv;
28770         this_arg_conv.inner = untag_ptr(this_arg);
28771         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28773         this_arg_conv.is_owned = false;
28774         unsigned char payment_hash_arr[32];
28775         CHECK(payment_hash->arr_len == 32);
28776         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
28777         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
28778         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
28779 }
28780
28781 void  __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint64_t this_arg, int8_tArray payment_preimage) {
28782         LDKChannelManager this_arg_conv;
28783         this_arg_conv.inner = untag_ptr(this_arg);
28784         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28786         this_arg_conv.is_owned = false;
28787         LDKThirtyTwoBytes payment_preimage_ref;
28788         CHECK(payment_preimage->arr_len == 32);
28789         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
28790         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
28791 }
28792
28793 int8_tArray  __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) TS_ChannelManager_get_our_node_id(uint64_t this_arg) {
28794         LDKChannelManager this_arg_conv;
28795         this_arg_conv.inner = untag_ptr(this_arg);
28796         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28798         this_arg_conv.is_owned = false;
28799         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28800         memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
28801         return ret_arr;
28802 }
28803
28804 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) {
28805         LDKChannelManager this_arg_conv;
28806         this_arg_conv.inner = untag_ptr(this_arg);
28807         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28809         this_arg_conv.is_owned = false;
28810         unsigned char temporary_channel_id_arr[32];
28811         CHECK(temporary_channel_id->arr_len == 32);
28812         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
28813         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
28814         LDKPublicKey counterparty_node_id_ref;
28815         CHECK(counterparty_node_id->arr_len == 33);
28816         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28817         LDKU128 user_channel_id_ref;
28818         CHECK(user_channel_id->arr_len == 16);
28819         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
28820         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28821         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
28822         return tag_ptr(ret_conv, true);
28823 }
28824
28825 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) {
28826         LDKChannelManager this_arg_conv;
28827         this_arg_conv.inner = untag_ptr(this_arg);
28828         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28830         this_arg_conv.is_owned = false;
28831         unsigned char temporary_channel_id_arr[32];
28832         CHECK(temporary_channel_id->arr_len == 32);
28833         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
28834         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
28835         LDKPublicKey counterparty_node_id_ref;
28836         CHECK(counterparty_node_id->arr_len == 33);
28837         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
28838         LDKU128 user_channel_id_ref;
28839         CHECK(user_channel_id->arr_len == 16);
28840         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
28841         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
28842         *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);
28843         return tag_ptr(ret_conv, true);
28844 }
28845
28846 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) {
28847         LDKChannelManager this_arg_conv;
28848         this_arg_conv.inner = untag_ptr(this_arg);
28849         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28851         this_arg_conv.is_owned = false;
28852         void* min_value_msat_ptr = untag_ptr(min_value_msat);
28853         CHECK_ACCESS(min_value_msat_ptr);
28854         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
28855         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
28856         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
28857         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
28858         return tag_ptr(ret_conv, true);
28859 }
28860
28861 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) {
28862         LDKChannelManager this_arg_conv;
28863         this_arg_conv.inner = untag_ptr(this_arg);
28864         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28866         this_arg_conv.is_owned = false;
28867         void* min_value_msat_ptr = untag_ptr(min_value_msat);
28868         CHECK_ACCESS(min_value_msat_ptr);
28869         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
28870         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
28871         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
28872         *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
28873         return tag_ptr(ret_conv, true);
28874 }
28875
28876 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) {
28877         LDKChannelManager this_arg_conv;
28878         this_arg_conv.inner = untag_ptr(this_arg);
28879         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28881         this_arg_conv.is_owned = false;
28882         LDKThirtyTwoBytes payment_hash_ref;
28883         CHECK(payment_hash->arr_len == 32);
28884         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28885         void* min_value_msat_ptr = untag_ptr(min_value_msat);
28886         CHECK_ACCESS(min_value_msat_ptr);
28887         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
28888         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
28889         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
28890         *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
28891         return tag_ptr(ret_conv, true);
28892 }
28893
28894 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) {
28895         LDKChannelManager this_arg_conv;
28896         this_arg_conv.inner = untag_ptr(this_arg);
28897         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28899         this_arg_conv.is_owned = false;
28900         LDKThirtyTwoBytes payment_hash_ref;
28901         CHECK(payment_hash->arr_len == 32);
28902         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28903         void* min_value_msat_ptr = untag_ptr(min_value_msat);
28904         CHECK_ACCESS(min_value_msat_ptr);
28905         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
28906         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
28907         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
28908         *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
28909         return tag_ptr(ret_conv, true);
28910 }
28911
28912 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) {
28913         LDKChannelManager this_arg_conv;
28914         this_arg_conv.inner = untag_ptr(this_arg);
28915         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28917         this_arg_conv.is_owned = false;
28918         LDKThirtyTwoBytes payment_hash_ref;
28919         CHECK(payment_hash->arr_len == 32);
28920         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28921         LDKThirtyTwoBytes payment_secret_ref;
28922         CHECK(payment_secret->arr_len == 32);
28923         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
28924         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
28925         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
28926         return tag_ptr(ret_conv, true);
28927 }
28928
28929 int64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_scid"))) TS_ChannelManager_get_phantom_scid(uint64_t this_arg) {
28930         LDKChannelManager this_arg_conv;
28931         this_arg_conv.inner = untag_ptr(this_arg);
28932         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28934         this_arg_conv.is_owned = false;
28935         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
28936         return ret_conv;
28937 }
28938
28939 uint64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_route_hints"))) TS_ChannelManager_get_phantom_route_hints(uint64_t this_arg) {
28940         LDKChannelManager this_arg_conv;
28941         this_arg_conv.inner = untag_ptr(this_arg);
28942         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28944         this_arg_conv.is_owned = false;
28945         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
28946         uint64_t ret_ref = 0;
28947         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28948         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28949         return ret_ref;
28950 }
28951
28952 int64_t  __attribute__((export_name("TS_ChannelManager_get_intercept_scid"))) TS_ChannelManager_get_intercept_scid(uint64_t this_arg) {
28953         LDKChannelManager this_arg_conv;
28954         this_arg_conv.inner = untag_ptr(this_arg);
28955         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28957         this_arg_conv.is_owned = false;
28958         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
28959         return ret_conv;
28960 }
28961
28962 uint64_t  __attribute__((export_name("TS_ChannelManager_compute_inflight_htlcs"))) TS_ChannelManager_compute_inflight_htlcs(uint64_t this_arg) {
28963         LDKChannelManager this_arg_conv;
28964         this_arg_conv.inner = untag_ptr(this_arg);
28965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28967         this_arg_conv.is_owned = false;
28968         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
28969         uint64_t ret_ref = 0;
28970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28972         return ret_ref;
28973 }
28974
28975 uint64_t  __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint64_t this_arg) {
28976         LDKChannelManager this_arg_conv;
28977         this_arg_conv.inner = untag_ptr(this_arg);
28978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28980         this_arg_conv.is_owned = false;
28981         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
28982         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
28983         return tag_ptr(ret_ret, true);
28984 }
28985
28986 uint64_t  __attribute__((export_name("TS_ChannelManager_as_EventsProvider"))) TS_ChannelManager_as_EventsProvider(uint64_t this_arg) {
28987         LDKChannelManager this_arg_conv;
28988         this_arg_conv.inner = untag_ptr(this_arg);
28989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28991         this_arg_conv.is_owned = false;
28992         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
28993         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
28994         return tag_ptr(ret_ret, true);
28995 }
28996
28997 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Listen"))) TS_ChannelManager_as_Listen(uint64_t this_arg) {
28998         LDKChannelManager this_arg_conv;
28999         this_arg_conv.inner = untag_ptr(this_arg);
29000         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29002         this_arg_conv.is_owned = false;
29003         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
29004         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
29005         return tag_ptr(ret_ret, true);
29006 }
29007
29008 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Confirm"))) TS_ChannelManager_as_Confirm(uint64_t this_arg) {
29009         LDKChannelManager this_arg_conv;
29010         this_arg_conv.inner = untag_ptr(this_arg);
29011         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29013         this_arg_conv.is_owned = false;
29014         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
29015         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
29016         return tag_ptr(ret_ret, true);
29017 }
29018
29019 void  __attribute__((export_name("TS_ChannelManager_await_persistable_update"))) TS_ChannelManager_await_persistable_update(uint64_t this_arg) {
29020         LDKChannelManager this_arg_conv;
29021         this_arg_conv.inner = untag_ptr(this_arg);
29022         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29024         this_arg_conv.is_owned = false;
29025         ChannelManager_await_persistable_update(&this_arg_conv);
29026 }
29027
29028 uint64_t  __attribute__((export_name("TS_ChannelManager_get_persistable_update_future"))) TS_ChannelManager_get_persistable_update_future(uint64_t this_arg) {
29029         LDKChannelManager this_arg_conv;
29030         this_arg_conv.inner = untag_ptr(this_arg);
29031         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29033         this_arg_conv.is_owned = false;
29034         LDKFuture ret_var = ChannelManager_get_persistable_update_future(&this_arg_conv);
29035         uint64_t ret_ref = 0;
29036         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29037         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29038         return ret_ref;
29039 }
29040
29041 uint64_t  __attribute__((export_name("TS_ChannelManager_current_best_block"))) TS_ChannelManager_current_best_block(uint64_t this_arg) {
29042         LDKChannelManager this_arg_conv;
29043         this_arg_conv.inner = untag_ptr(this_arg);
29044         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29046         this_arg_conv.is_owned = false;
29047         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
29048         uint64_t ret_ref = 0;
29049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29051         return ret_ref;
29052 }
29053
29054 uint64_t  __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(uint64_t this_arg) {
29055         LDKChannelManager this_arg_conv;
29056         this_arg_conv.inner = untag_ptr(this_arg);
29057         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29059         this_arg_conv.is_owned = false;
29060         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
29061         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
29062         return tag_ptr(ret_ret, true);
29063 }
29064
29065 uint64_t  __attribute__((export_name("TS_provided_node_features"))) TS_provided_node_features() {
29066         LDKNodeFeatures ret_var = provided_node_features();
29067         uint64_t ret_ref = 0;
29068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29070         return ret_ref;
29071 }
29072
29073 uint64_t  __attribute__((export_name("TS_provided_channel_features"))) TS_provided_channel_features() {
29074         LDKChannelFeatures ret_var = provided_channel_features();
29075         uint64_t ret_ref = 0;
29076         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29077         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29078         return ret_ref;
29079 }
29080
29081 uint64_t  __attribute__((export_name("TS_provided_init_features"))) TS_provided_init_features() {
29082         LDKInitFeatures ret_var = provided_init_features();
29083         uint64_t ret_ref = 0;
29084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29086         return ret_ref;
29087 }
29088
29089 int8_tArray  __attribute__((export_name("TS_CounterpartyForwardingInfo_write"))) TS_CounterpartyForwardingInfo_write(uint64_t obj) {
29090         LDKCounterpartyForwardingInfo obj_conv;
29091         obj_conv.inner = untag_ptr(obj);
29092         obj_conv.is_owned = ptr_is_owned(obj);
29093         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29094         obj_conv.is_owned = false;
29095         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
29096         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29097         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29098         CVec_u8Z_free(ret_var);
29099         return ret_arr;
29100 }
29101
29102 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_read"))) TS_CounterpartyForwardingInfo_read(int8_tArray ser) {
29103         LDKu8slice ser_ref;
29104         ser_ref.datalen = ser->arr_len;
29105         ser_ref.data = ser->elems;
29106         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
29107         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
29108         FREE(ser);
29109         return tag_ptr(ret_conv, true);
29110 }
29111
29112 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_write"))) TS_ChannelCounterparty_write(uint64_t obj) {
29113         LDKChannelCounterparty obj_conv;
29114         obj_conv.inner = untag_ptr(obj);
29115         obj_conv.is_owned = ptr_is_owned(obj);
29116         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29117         obj_conv.is_owned = false;
29118         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
29119         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29120         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29121         CVec_u8Z_free(ret_var);
29122         return ret_arr;
29123 }
29124
29125 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_read"))) TS_ChannelCounterparty_read(int8_tArray ser) {
29126         LDKu8slice ser_ref;
29127         ser_ref.datalen = ser->arr_len;
29128         ser_ref.data = ser->elems;
29129         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
29130         *ret_conv = ChannelCounterparty_read(ser_ref);
29131         FREE(ser);
29132         return tag_ptr(ret_conv, true);
29133 }
29134
29135 int8_tArray  __attribute__((export_name("TS_ChannelDetails_write"))) TS_ChannelDetails_write(uint64_t obj) {
29136         LDKChannelDetails obj_conv;
29137         obj_conv.inner = untag_ptr(obj);
29138         obj_conv.is_owned = ptr_is_owned(obj);
29139         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29140         obj_conv.is_owned = false;
29141         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
29142         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29143         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29144         CVec_u8Z_free(ret_var);
29145         return ret_arr;
29146 }
29147
29148 uint64_t  __attribute__((export_name("TS_ChannelDetails_read"))) TS_ChannelDetails_read(int8_tArray ser) {
29149         LDKu8slice ser_ref;
29150         ser_ref.datalen = ser->arr_len;
29151         ser_ref.data = ser->elems;
29152         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
29153         *ret_conv = ChannelDetails_read(ser_ref);
29154         FREE(ser);
29155         return tag_ptr(ret_conv, true);
29156 }
29157
29158 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_write"))) TS_PhantomRouteHints_write(uint64_t obj) {
29159         LDKPhantomRouteHints obj_conv;
29160         obj_conv.inner = untag_ptr(obj);
29161         obj_conv.is_owned = ptr_is_owned(obj);
29162         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29163         obj_conv.is_owned = false;
29164         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
29165         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29166         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29167         CVec_u8Z_free(ret_var);
29168         return ret_arr;
29169 }
29170
29171 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_read"))) TS_PhantomRouteHints_read(int8_tArray ser) {
29172         LDKu8slice ser_ref;
29173         ser_ref.datalen = ser->arr_len;
29174         ser_ref.data = ser->elems;
29175         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
29176         *ret_conv = PhantomRouteHints_read(ser_ref);
29177         FREE(ser);
29178         return tag_ptr(ret_conv, true);
29179 }
29180
29181 int8_tArray  __attribute__((export_name("TS_ChannelManager_write"))) TS_ChannelManager_write(uint64_t obj) {
29182         LDKChannelManager obj_conv;
29183         obj_conv.inner = untag_ptr(obj);
29184         obj_conv.is_owned = ptr_is_owned(obj);
29185         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29186         obj_conv.is_owned = false;
29187         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
29188         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29189         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29190         CVec_u8Z_free(ret_var);
29191         return ret_arr;
29192 }
29193
29194 void  __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelManagerReadArgs_free(uint64_t this_obj) {
29195         LDKChannelManagerReadArgs this_obj_conv;
29196         this_obj_conv.inner = untag_ptr(this_obj);
29197         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29199         ChannelManagerReadArgs_free(this_obj_conv);
29200 }
29201
29202 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_keys_manager"))) TS_ChannelManagerReadArgs_get_keys_manager(uint64_t this_ptr) {
29203         LDKChannelManagerReadArgs this_ptr_conv;
29204         this_ptr_conv.inner = untag_ptr(this_ptr);
29205         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29207         this_ptr_conv.is_owned = false;
29208         // WARNING: This object doesn't live past this scope, needs clone!
29209         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv), false);
29210         return ret_ret;
29211 }
29212
29213 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_keys_manager"))) TS_ChannelManagerReadArgs_set_keys_manager(uint64_t this_ptr, uint64_t val) {
29214         LDKChannelManagerReadArgs this_ptr_conv;
29215         this_ptr_conv.inner = untag_ptr(this_ptr);
29216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29218         this_ptr_conv.is_owned = false;
29219         void* val_ptr = untag_ptr(val);
29220         CHECK_ACCESS(val_ptr);
29221         LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
29222         if (val_conv.free == LDKKeysInterface_JCalls_free) {
29223                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29224                 LDKKeysInterface_JCalls_cloned(&val_conv);
29225         }
29226         ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
29227 }
29228
29229 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint64_t this_ptr) {
29230         LDKChannelManagerReadArgs this_ptr_conv;
29231         this_ptr_conv.inner = untag_ptr(this_ptr);
29232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29234         this_ptr_conv.is_owned = false;
29235         // WARNING: This object doesn't live past this scope, needs clone!
29236         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
29237         return ret_ret;
29238 }
29239
29240 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_fee_estimator"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint64_t this_ptr, uint64_t val) {
29241         LDKChannelManagerReadArgs this_ptr_conv;
29242         this_ptr_conv.inner = untag_ptr(this_ptr);
29243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29245         this_ptr_conv.is_owned = false;
29246         void* val_ptr = untag_ptr(val);
29247         CHECK_ACCESS(val_ptr);
29248         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
29249         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
29250                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29251                 LDKFeeEstimator_JCalls_cloned(&val_conv);
29252         }
29253         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
29254 }
29255
29256 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_chain_monitor"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint64_t this_ptr) {
29257         LDKChannelManagerReadArgs this_ptr_conv;
29258         this_ptr_conv.inner = untag_ptr(this_ptr);
29259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29261         this_ptr_conv.is_owned = false;
29262         // WARNING: This object doesn't live past this scope, needs clone!
29263         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
29264         return ret_ret;
29265 }
29266
29267 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_chain_monitor"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint64_t this_ptr, uint64_t val) {
29268         LDKChannelManagerReadArgs this_ptr_conv;
29269         this_ptr_conv.inner = untag_ptr(this_ptr);
29270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29272         this_ptr_conv.is_owned = false;
29273         void* val_ptr = untag_ptr(val);
29274         CHECK_ACCESS(val_ptr);
29275         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
29276         if (val_conv.free == LDKWatch_JCalls_free) {
29277                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29278                 LDKWatch_JCalls_cloned(&val_conv);
29279         }
29280         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
29281 }
29282
29283 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_tx_broadcaster"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint64_t this_ptr) {
29284         LDKChannelManagerReadArgs this_ptr_conv;
29285         this_ptr_conv.inner = untag_ptr(this_ptr);
29286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29288         this_ptr_conv.is_owned = false;
29289         // WARNING: This object doesn't live past this scope, needs clone!
29290         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
29291         return ret_ret;
29292 }
29293
29294 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint64_t this_ptr, uint64_t val) {
29295         LDKChannelManagerReadArgs this_ptr_conv;
29296         this_ptr_conv.inner = untag_ptr(this_ptr);
29297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29299         this_ptr_conv.is_owned = false;
29300         void* val_ptr = untag_ptr(val);
29301         CHECK_ACCESS(val_ptr);
29302         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
29303         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
29304                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29305                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
29306         }
29307         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
29308 }
29309
29310 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint64_t this_ptr) {
29311         LDKChannelManagerReadArgs this_ptr_conv;
29312         this_ptr_conv.inner = untag_ptr(this_ptr);
29313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29315         this_ptr_conv.is_owned = false;
29316         // WARNING: This object doesn't live past this scope, needs clone!
29317         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
29318         return ret_ret;
29319 }
29320
29321 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_logger"))) TS_ChannelManagerReadArgs_set_logger(uint64_t this_ptr, uint64_t val) {
29322         LDKChannelManagerReadArgs this_ptr_conv;
29323         this_ptr_conv.inner = untag_ptr(this_ptr);
29324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29326         this_ptr_conv.is_owned = false;
29327         void* val_ptr = untag_ptr(val);
29328         CHECK_ACCESS(val_ptr);
29329         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
29330         if (val_conv.free == LDKLogger_JCalls_free) {
29331                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29332                 LDKLogger_JCalls_cloned(&val_conv);
29333         }
29334         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
29335 }
29336
29337 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_default_config"))) TS_ChannelManagerReadArgs_get_default_config(uint64_t this_ptr) {
29338         LDKChannelManagerReadArgs this_ptr_conv;
29339         this_ptr_conv.inner = untag_ptr(this_ptr);
29340         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29342         this_ptr_conv.is_owned = false;
29343         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
29344         uint64_t ret_ref = 0;
29345         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29346         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29347         return ret_ref;
29348 }
29349
29350 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config"))) TS_ChannelManagerReadArgs_set_default_config(uint64_t this_ptr, uint64_t val) {
29351         LDKChannelManagerReadArgs this_ptr_conv;
29352         this_ptr_conv.inner = untag_ptr(this_ptr);
29353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29355         this_ptr_conv.is_owned = false;
29356         LDKUserConfig val_conv;
29357         val_conv.inner = untag_ptr(val);
29358         val_conv.is_owned = ptr_is_owned(val);
29359         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29360         val_conv = UserConfig_clone(&val_conv);
29361         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
29362 }
29363
29364 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) {
29365         void* keys_manager_ptr = untag_ptr(keys_manager);
29366         CHECK_ACCESS(keys_manager_ptr);
29367         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
29368         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
29369                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29370                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
29371         }
29372         void* fee_estimator_ptr = untag_ptr(fee_estimator);
29373         CHECK_ACCESS(fee_estimator_ptr);
29374         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
29375         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
29376                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29377                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
29378         }
29379         void* chain_monitor_ptr = untag_ptr(chain_monitor);
29380         CHECK_ACCESS(chain_monitor_ptr);
29381         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
29382         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
29383                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29384                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
29385         }
29386         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
29387         CHECK_ACCESS(tx_broadcaster_ptr);
29388         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
29389         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
29390                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29391                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
29392         }
29393         void* logger_ptr = untag_ptr(logger);
29394         CHECK_ACCESS(logger_ptr);
29395         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
29396         if (logger_conv.free == LDKLogger_JCalls_free) {
29397                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29398                 LDKLogger_JCalls_cloned(&logger_conv);
29399         }
29400         LDKUserConfig default_config_conv;
29401         default_config_conv.inner = untag_ptr(default_config);
29402         default_config_conv.is_owned = ptr_is_owned(default_config);
29403         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
29404         default_config_conv = UserConfig_clone(&default_config_conv);
29405         LDKCVec_ChannelMonitorZ channel_monitors_constr;
29406         channel_monitors_constr.datalen = channel_monitors->arr_len;
29407         if (channel_monitors_constr.datalen > 0)
29408                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
29409         else
29410                 channel_monitors_constr.data = NULL;
29411         uint64_t* channel_monitors_vals = channel_monitors->elems;
29412         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
29413                 uint64_t channel_monitors_conv_16 = channel_monitors_vals[q];
29414                 LDKChannelMonitor channel_monitors_conv_16_conv;
29415                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
29416                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
29417                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
29418                 channel_monitors_conv_16_conv.is_owned = false;
29419                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
29420         }
29421         FREE(channel_monitors);
29422         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);
29423         uint64_t ret_ref = 0;
29424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29426         return ret_ref;
29427 }
29428
29429 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_read"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint64_t arg) {
29430         LDKu8slice ser_ref;
29431         ser_ref.datalen = ser->arr_len;
29432         ser_ref.data = ser->elems;
29433         LDKChannelManagerReadArgs arg_conv;
29434         arg_conv.inner = untag_ptr(arg);
29435         arg_conv.is_owned = ptr_is_owned(arg);
29436         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29437         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
29438         
29439         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
29440         *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
29441         FREE(ser);
29442         return tag_ptr(ret_conv, true);
29443 }
29444
29445 void  __attribute__((export_name("TS_ExpandedKey_free"))) TS_ExpandedKey_free(uint64_t this_obj) {
29446         LDKExpandedKey this_obj_conv;
29447         this_obj_conv.inner = untag_ptr(this_obj);
29448         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29450         ExpandedKey_free(this_obj_conv);
29451 }
29452
29453 uint64_t  __attribute__((export_name("TS_ExpandedKey_new"))) TS_ExpandedKey_new(int8_tArray key_material) {
29454         unsigned char key_material_arr[32];
29455         CHECK(key_material->arr_len == 32);
29456         memcpy(key_material_arr, key_material->elems, 32); FREE(key_material);
29457         unsigned char (*key_material_ref)[32] = &key_material_arr;
29458         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
29459         uint64_t ret_ref = 0;
29460         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29461         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29462         return ret_ref;
29463 }
29464
29465 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) {
29466         LDKExpandedKey keys_conv;
29467         keys_conv.inner = untag_ptr(keys);
29468         keys_conv.is_owned = ptr_is_owned(keys);
29469         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
29470         keys_conv.is_owned = false;
29471         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29472         CHECK_ACCESS(min_value_msat_ptr);
29473         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29474         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29475         void* keys_manager_ptr = untag_ptr(keys_manager);
29476         if (ptr_is_owned(keys_manager)) { CHECK_ACCESS(keys_manager_ptr); }
29477         LDKKeysInterface* keys_manager_conv = (LDKKeysInterface*)keys_manager_ptr;
29478         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
29479         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, keys_manager_conv, current_time);
29480         return tag_ptr(ret_conv, true);
29481 }
29482
29483 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) {
29484         LDKExpandedKey keys_conv;
29485         keys_conv.inner = untag_ptr(keys);
29486         keys_conv.is_owned = ptr_is_owned(keys);
29487         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
29488         keys_conv.is_owned = false;
29489         void* min_value_msat_ptr = untag_ptr(min_value_msat);
29490         CHECK_ACCESS(min_value_msat_ptr);
29491         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
29492         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
29493         LDKThirtyTwoBytes payment_hash_ref;
29494         CHECK(payment_hash->arr_len == 32);
29495         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
29496         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
29497         *ret_conv = create_from_hash(&keys_conv, min_value_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, current_time);
29498         return tag_ptr(ret_conv, true);
29499 }
29500
29501 void  __attribute__((export_name("TS_DecodeError_free"))) TS_DecodeError_free(uint64_t this_ptr) {
29502         if (!ptr_is_owned(this_ptr)) return;
29503         void* this_ptr_ptr = untag_ptr(this_ptr);
29504         CHECK_ACCESS(this_ptr_ptr);
29505         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
29506         FREE(untag_ptr(this_ptr));
29507         DecodeError_free(this_ptr_conv);
29508 }
29509
29510 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
29511         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
29512         *ret_copy = DecodeError_clone(arg);
29513         uint64_t ret_ref = tag_ptr(ret_copy, true);
29514         return ret_ref;
29515 }
29516 int64_t  __attribute__((export_name("TS_DecodeError_clone_ptr"))) TS_DecodeError_clone_ptr(uint64_t arg) {
29517         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
29518         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
29519         return ret_conv;
29520 }
29521
29522 uint64_t  __attribute__((export_name("TS_DecodeError_clone"))) TS_DecodeError_clone(uint64_t orig) {
29523         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
29524         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
29525         *ret_copy = DecodeError_clone(orig_conv);
29526         uint64_t ret_ref = tag_ptr(ret_copy, true);
29527         return ret_ref;
29528 }
29529
29530 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_version"))) TS_DecodeError_unknown_version() {
29531         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
29532         *ret_copy = DecodeError_unknown_version();
29533         uint64_t ret_ref = tag_ptr(ret_copy, true);
29534         return ret_ref;
29535 }
29536
29537 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_required_feature"))) TS_DecodeError_unknown_required_feature() {
29538         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
29539         *ret_copy = DecodeError_unknown_required_feature();
29540         uint64_t ret_ref = tag_ptr(ret_copy, true);
29541         return ret_ref;
29542 }
29543
29544 uint64_t  __attribute__((export_name("TS_DecodeError_invalid_value"))) TS_DecodeError_invalid_value() {
29545         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
29546         *ret_copy = DecodeError_invalid_value();
29547         uint64_t ret_ref = tag_ptr(ret_copy, true);
29548         return ret_ref;
29549 }
29550
29551 uint64_t  __attribute__((export_name("TS_DecodeError_short_read"))) TS_DecodeError_short_read() {
29552         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
29553         *ret_copy = DecodeError_short_read();
29554         uint64_t ret_ref = tag_ptr(ret_copy, true);
29555         return ret_ref;
29556 }
29557
29558 uint64_t  __attribute__((export_name("TS_DecodeError_bad_length_descriptor"))) TS_DecodeError_bad_length_descriptor() {
29559         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
29560         *ret_copy = DecodeError_bad_length_descriptor();
29561         uint64_t ret_ref = tag_ptr(ret_copy, true);
29562         return ret_ref;
29563 }
29564
29565 uint64_t  __attribute__((export_name("TS_DecodeError_io"))) TS_DecodeError_io(uint32_t a) {
29566         LDKIOError a_conv = LDKIOError_from_js(a);
29567         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
29568         *ret_copy = DecodeError_io(a_conv);
29569         uint64_t ret_ref = tag_ptr(ret_copy, true);
29570         return ret_ref;
29571 }
29572
29573 uint64_t  __attribute__((export_name("TS_DecodeError_unsupported_compression"))) TS_DecodeError_unsupported_compression() {
29574         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
29575         *ret_copy = DecodeError_unsupported_compression();
29576         uint64_t ret_ref = tag_ptr(ret_copy, true);
29577         return ret_ref;
29578 }
29579
29580 jboolean  __attribute__((export_name("TS_DecodeError_eq"))) TS_DecodeError_eq(uint64_t a, uint64_t b) {
29581         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
29582         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
29583         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
29584         return ret_conv;
29585 }
29586
29587 void  __attribute__((export_name("TS_Init_free"))) TS_Init_free(uint64_t this_obj) {
29588         LDKInit this_obj_conv;
29589         this_obj_conv.inner = untag_ptr(this_obj);
29590         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29592         Init_free(this_obj_conv);
29593 }
29594
29595 uint64_t  __attribute__((export_name("TS_Init_get_features"))) TS_Init_get_features(uint64_t this_ptr) {
29596         LDKInit this_ptr_conv;
29597         this_ptr_conv.inner = untag_ptr(this_ptr);
29598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29600         this_ptr_conv.is_owned = false;
29601         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
29602         uint64_t ret_ref = 0;
29603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29604         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29605         return ret_ref;
29606 }
29607
29608 void  __attribute__((export_name("TS_Init_set_features"))) TS_Init_set_features(uint64_t this_ptr, uint64_t val) {
29609         LDKInit this_ptr_conv;
29610         this_ptr_conv.inner = untag_ptr(this_ptr);
29611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29613         this_ptr_conv.is_owned = false;
29614         LDKInitFeatures val_conv;
29615         val_conv.inner = untag_ptr(val);
29616         val_conv.is_owned = ptr_is_owned(val);
29617         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29618         val_conv = InitFeatures_clone(&val_conv);
29619         Init_set_features(&this_ptr_conv, val_conv);
29620 }
29621
29622 uint64_t  __attribute__((export_name("TS_Init_get_remote_network_address"))) TS_Init_get_remote_network_address(uint64_t this_ptr) {
29623         LDKInit this_ptr_conv;
29624         this_ptr_conv.inner = untag_ptr(this_ptr);
29625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29627         this_ptr_conv.is_owned = false;
29628         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
29629         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
29630         uint64_t ret_ref = tag_ptr(ret_copy, true);
29631         return ret_ref;
29632 }
29633
29634 void  __attribute__((export_name("TS_Init_set_remote_network_address"))) TS_Init_set_remote_network_address(uint64_t this_ptr, uint64_t val) {
29635         LDKInit this_ptr_conv;
29636         this_ptr_conv.inner = untag_ptr(this_ptr);
29637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29639         this_ptr_conv.is_owned = false;
29640         void* val_ptr = untag_ptr(val);
29641         CHECK_ACCESS(val_ptr);
29642         LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr);
29643         val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(val));
29644         Init_set_remote_network_address(&this_ptr_conv, val_conv);
29645 }
29646
29647 uint64_t  __attribute__((export_name("TS_Init_new"))) TS_Init_new(uint64_t features_arg, uint64_t remote_network_address_arg) {
29648         LDKInitFeatures features_arg_conv;
29649         features_arg_conv.inner = untag_ptr(features_arg);
29650         features_arg_conv.is_owned = ptr_is_owned(features_arg);
29651         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
29652         features_arg_conv = InitFeatures_clone(&features_arg_conv);
29653         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
29654         CHECK_ACCESS(remote_network_address_arg_ptr);
29655         LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr);
29656         LDKInit ret_var = Init_new(features_arg_conv, remote_network_address_arg_conv);
29657         uint64_t ret_ref = 0;
29658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29660         return ret_ref;
29661 }
29662
29663 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
29664         LDKInit ret_var = Init_clone(arg);
29665         uint64_t ret_ref = 0;
29666         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29667         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29668         return ret_ref;
29669 }
29670 int64_t  __attribute__((export_name("TS_Init_clone_ptr"))) TS_Init_clone_ptr(uint64_t arg) {
29671         LDKInit arg_conv;
29672         arg_conv.inner = untag_ptr(arg);
29673         arg_conv.is_owned = ptr_is_owned(arg);
29674         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29675         arg_conv.is_owned = false;
29676         int64_t ret_conv = Init_clone_ptr(&arg_conv);
29677         return ret_conv;
29678 }
29679
29680 uint64_t  __attribute__((export_name("TS_Init_clone"))) TS_Init_clone(uint64_t orig) {
29681         LDKInit orig_conv;
29682         orig_conv.inner = untag_ptr(orig);
29683         orig_conv.is_owned = ptr_is_owned(orig);
29684         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29685         orig_conv.is_owned = false;
29686         LDKInit ret_var = Init_clone(&orig_conv);
29687         uint64_t ret_ref = 0;
29688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29690         return ret_ref;
29691 }
29692
29693 jboolean  __attribute__((export_name("TS_Init_eq"))) TS_Init_eq(uint64_t a, uint64_t b) {
29694         LDKInit a_conv;
29695         a_conv.inner = untag_ptr(a);
29696         a_conv.is_owned = ptr_is_owned(a);
29697         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29698         a_conv.is_owned = false;
29699         LDKInit b_conv;
29700         b_conv.inner = untag_ptr(b);
29701         b_conv.is_owned = ptr_is_owned(b);
29702         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29703         b_conv.is_owned = false;
29704         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
29705         return ret_conv;
29706 }
29707
29708 void  __attribute__((export_name("TS_ErrorMessage_free"))) TS_ErrorMessage_free(uint64_t this_obj) {
29709         LDKErrorMessage this_obj_conv;
29710         this_obj_conv.inner = untag_ptr(this_obj);
29711         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29713         ErrorMessage_free(this_obj_conv);
29714 }
29715
29716 int8_tArray  __attribute__((export_name("TS_ErrorMessage_get_channel_id"))) TS_ErrorMessage_get_channel_id(uint64_t this_ptr) {
29717         LDKErrorMessage this_ptr_conv;
29718         this_ptr_conv.inner = untag_ptr(this_ptr);
29719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29721         this_ptr_conv.is_owned = false;
29722         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29723         memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
29724         return ret_arr;
29725 }
29726
29727 void  __attribute__((export_name("TS_ErrorMessage_set_channel_id"))) TS_ErrorMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
29728         LDKErrorMessage this_ptr_conv;
29729         this_ptr_conv.inner = untag_ptr(this_ptr);
29730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29732         this_ptr_conv.is_owned = false;
29733         LDKThirtyTwoBytes val_ref;
29734         CHECK(val->arr_len == 32);
29735         memcpy(val_ref.data, val->elems, 32); FREE(val);
29736         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
29737 }
29738
29739 jstring  __attribute__((export_name("TS_ErrorMessage_get_data"))) TS_ErrorMessage_get_data(uint64_t this_ptr) {
29740         LDKErrorMessage this_ptr_conv;
29741         this_ptr_conv.inner = untag_ptr(this_ptr);
29742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29744         this_ptr_conv.is_owned = false;
29745         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
29746         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
29747         Str_free(ret_str);
29748         return ret_conv;
29749 }
29750
29751 void  __attribute__((export_name("TS_ErrorMessage_set_data"))) TS_ErrorMessage_set_data(uint64_t this_ptr, jstring val) {
29752         LDKErrorMessage this_ptr_conv;
29753         this_ptr_conv.inner = untag_ptr(this_ptr);
29754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29756         this_ptr_conv.is_owned = false;
29757         LDKStr val_conv = str_ref_to_owned_c(val);
29758         ErrorMessage_set_data(&this_ptr_conv, val_conv);
29759 }
29760
29761 uint64_t  __attribute__((export_name("TS_ErrorMessage_new"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
29762         LDKThirtyTwoBytes channel_id_arg_ref;
29763         CHECK(channel_id_arg->arr_len == 32);
29764         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29765         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
29766         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
29767         uint64_t ret_ref = 0;
29768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29770         return ret_ref;
29771 }
29772
29773 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
29774         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
29775         uint64_t ret_ref = 0;
29776         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29777         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29778         return ret_ref;
29779 }
29780 int64_t  __attribute__((export_name("TS_ErrorMessage_clone_ptr"))) TS_ErrorMessage_clone_ptr(uint64_t arg) {
29781         LDKErrorMessage arg_conv;
29782         arg_conv.inner = untag_ptr(arg);
29783         arg_conv.is_owned = ptr_is_owned(arg);
29784         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29785         arg_conv.is_owned = false;
29786         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
29787         return ret_conv;
29788 }
29789
29790 uint64_t  __attribute__((export_name("TS_ErrorMessage_clone"))) TS_ErrorMessage_clone(uint64_t orig) {
29791         LDKErrorMessage orig_conv;
29792         orig_conv.inner = untag_ptr(orig);
29793         orig_conv.is_owned = ptr_is_owned(orig);
29794         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29795         orig_conv.is_owned = false;
29796         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
29797         uint64_t ret_ref = 0;
29798         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29799         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29800         return ret_ref;
29801 }
29802
29803 jboolean  __attribute__((export_name("TS_ErrorMessage_eq"))) TS_ErrorMessage_eq(uint64_t a, uint64_t b) {
29804         LDKErrorMessage a_conv;
29805         a_conv.inner = untag_ptr(a);
29806         a_conv.is_owned = ptr_is_owned(a);
29807         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29808         a_conv.is_owned = false;
29809         LDKErrorMessage b_conv;
29810         b_conv.inner = untag_ptr(b);
29811         b_conv.is_owned = ptr_is_owned(b);
29812         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29813         b_conv.is_owned = false;
29814         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
29815         return ret_conv;
29816 }
29817
29818 void  __attribute__((export_name("TS_WarningMessage_free"))) TS_WarningMessage_free(uint64_t this_obj) {
29819         LDKWarningMessage this_obj_conv;
29820         this_obj_conv.inner = untag_ptr(this_obj);
29821         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29823         WarningMessage_free(this_obj_conv);
29824 }
29825
29826 int8_tArray  __attribute__((export_name("TS_WarningMessage_get_channel_id"))) TS_WarningMessage_get_channel_id(uint64_t this_ptr) {
29827         LDKWarningMessage this_ptr_conv;
29828         this_ptr_conv.inner = untag_ptr(this_ptr);
29829         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29831         this_ptr_conv.is_owned = false;
29832         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29833         memcpy(ret_arr->elems, *WarningMessage_get_channel_id(&this_ptr_conv), 32);
29834         return ret_arr;
29835 }
29836
29837 void  __attribute__((export_name("TS_WarningMessage_set_channel_id"))) TS_WarningMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
29838         LDKWarningMessage this_ptr_conv;
29839         this_ptr_conv.inner = untag_ptr(this_ptr);
29840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29842         this_ptr_conv.is_owned = false;
29843         LDKThirtyTwoBytes val_ref;
29844         CHECK(val->arr_len == 32);
29845         memcpy(val_ref.data, val->elems, 32); FREE(val);
29846         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
29847 }
29848
29849 jstring  __attribute__((export_name("TS_WarningMessage_get_data"))) TS_WarningMessage_get_data(uint64_t this_ptr) {
29850         LDKWarningMessage this_ptr_conv;
29851         this_ptr_conv.inner = untag_ptr(this_ptr);
29852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29854         this_ptr_conv.is_owned = false;
29855         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
29856         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
29857         Str_free(ret_str);
29858         return ret_conv;
29859 }
29860
29861 void  __attribute__((export_name("TS_WarningMessage_set_data"))) TS_WarningMessage_set_data(uint64_t this_ptr, jstring val) {
29862         LDKWarningMessage this_ptr_conv;
29863         this_ptr_conv.inner = untag_ptr(this_ptr);
29864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29866         this_ptr_conv.is_owned = false;
29867         LDKStr val_conv = str_ref_to_owned_c(val);
29868         WarningMessage_set_data(&this_ptr_conv, val_conv);
29869 }
29870
29871 uint64_t  __attribute__((export_name("TS_WarningMessage_new"))) TS_WarningMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
29872         LDKThirtyTwoBytes channel_id_arg_ref;
29873         CHECK(channel_id_arg->arr_len == 32);
29874         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29875         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
29876         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
29877         uint64_t ret_ref = 0;
29878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29880         return ret_ref;
29881 }
29882
29883 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
29884         LDKWarningMessage ret_var = WarningMessage_clone(arg);
29885         uint64_t ret_ref = 0;
29886         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29887         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29888         return ret_ref;
29889 }
29890 int64_t  __attribute__((export_name("TS_WarningMessage_clone_ptr"))) TS_WarningMessage_clone_ptr(uint64_t arg) {
29891         LDKWarningMessage arg_conv;
29892         arg_conv.inner = untag_ptr(arg);
29893         arg_conv.is_owned = ptr_is_owned(arg);
29894         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29895         arg_conv.is_owned = false;
29896         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
29897         return ret_conv;
29898 }
29899
29900 uint64_t  __attribute__((export_name("TS_WarningMessage_clone"))) TS_WarningMessage_clone(uint64_t orig) {
29901         LDKWarningMessage orig_conv;
29902         orig_conv.inner = untag_ptr(orig);
29903         orig_conv.is_owned = ptr_is_owned(orig);
29904         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29905         orig_conv.is_owned = false;
29906         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
29907         uint64_t ret_ref = 0;
29908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29910         return ret_ref;
29911 }
29912
29913 jboolean  __attribute__((export_name("TS_WarningMessage_eq"))) TS_WarningMessage_eq(uint64_t a, uint64_t b) {
29914         LDKWarningMessage a_conv;
29915         a_conv.inner = untag_ptr(a);
29916         a_conv.is_owned = ptr_is_owned(a);
29917         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29918         a_conv.is_owned = false;
29919         LDKWarningMessage b_conv;
29920         b_conv.inner = untag_ptr(b);
29921         b_conv.is_owned = ptr_is_owned(b);
29922         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29923         b_conv.is_owned = false;
29924         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
29925         return ret_conv;
29926 }
29927
29928 void  __attribute__((export_name("TS_Ping_free"))) TS_Ping_free(uint64_t this_obj) {
29929         LDKPing this_obj_conv;
29930         this_obj_conv.inner = untag_ptr(this_obj);
29931         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29933         Ping_free(this_obj_conv);
29934 }
29935
29936 int16_t  __attribute__((export_name("TS_Ping_get_ponglen"))) TS_Ping_get_ponglen(uint64_t this_ptr) {
29937         LDKPing this_ptr_conv;
29938         this_ptr_conv.inner = untag_ptr(this_ptr);
29939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29941         this_ptr_conv.is_owned = false;
29942         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
29943         return ret_conv;
29944 }
29945
29946 void  __attribute__((export_name("TS_Ping_set_ponglen"))) TS_Ping_set_ponglen(uint64_t this_ptr, int16_t val) {
29947         LDKPing this_ptr_conv;
29948         this_ptr_conv.inner = untag_ptr(this_ptr);
29949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29951         this_ptr_conv.is_owned = false;
29952         Ping_set_ponglen(&this_ptr_conv, val);
29953 }
29954
29955 int16_t  __attribute__((export_name("TS_Ping_get_byteslen"))) TS_Ping_get_byteslen(uint64_t this_ptr) {
29956         LDKPing this_ptr_conv;
29957         this_ptr_conv.inner = untag_ptr(this_ptr);
29958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29960         this_ptr_conv.is_owned = false;
29961         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
29962         return ret_conv;
29963 }
29964
29965 void  __attribute__((export_name("TS_Ping_set_byteslen"))) TS_Ping_set_byteslen(uint64_t this_ptr, int16_t val) {
29966         LDKPing this_ptr_conv;
29967         this_ptr_conv.inner = untag_ptr(this_ptr);
29968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29970         this_ptr_conv.is_owned = false;
29971         Ping_set_byteslen(&this_ptr_conv, val);
29972 }
29973
29974 uint64_t  __attribute__((export_name("TS_Ping_new"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
29975         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
29976         uint64_t ret_ref = 0;
29977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29979         return ret_ref;
29980 }
29981
29982 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
29983         LDKPing ret_var = Ping_clone(arg);
29984         uint64_t ret_ref = 0;
29985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29987         return ret_ref;
29988 }
29989 int64_t  __attribute__((export_name("TS_Ping_clone_ptr"))) TS_Ping_clone_ptr(uint64_t arg) {
29990         LDKPing arg_conv;
29991         arg_conv.inner = untag_ptr(arg);
29992         arg_conv.is_owned = ptr_is_owned(arg);
29993         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29994         arg_conv.is_owned = false;
29995         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
29996         return ret_conv;
29997 }
29998
29999 uint64_t  __attribute__((export_name("TS_Ping_clone"))) TS_Ping_clone(uint64_t orig) {
30000         LDKPing orig_conv;
30001         orig_conv.inner = untag_ptr(orig);
30002         orig_conv.is_owned = ptr_is_owned(orig);
30003         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30004         orig_conv.is_owned = false;
30005         LDKPing ret_var = Ping_clone(&orig_conv);
30006         uint64_t ret_ref = 0;
30007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30009         return ret_ref;
30010 }
30011
30012 jboolean  __attribute__((export_name("TS_Ping_eq"))) TS_Ping_eq(uint64_t a, uint64_t b) {
30013         LDKPing a_conv;
30014         a_conv.inner = untag_ptr(a);
30015         a_conv.is_owned = ptr_is_owned(a);
30016         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30017         a_conv.is_owned = false;
30018         LDKPing b_conv;
30019         b_conv.inner = untag_ptr(b);
30020         b_conv.is_owned = ptr_is_owned(b);
30021         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30022         b_conv.is_owned = false;
30023         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
30024         return ret_conv;
30025 }
30026
30027 void  __attribute__((export_name("TS_Pong_free"))) TS_Pong_free(uint64_t this_obj) {
30028         LDKPong this_obj_conv;
30029         this_obj_conv.inner = untag_ptr(this_obj);
30030         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30032         Pong_free(this_obj_conv);
30033 }
30034
30035 int16_t  __attribute__((export_name("TS_Pong_get_byteslen"))) TS_Pong_get_byteslen(uint64_t this_ptr) {
30036         LDKPong this_ptr_conv;
30037         this_ptr_conv.inner = untag_ptr(this_ptr);
30038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30040         this_ptr_conv.is_owned = false;
30041         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
30042         return ret_conv;
30043 }
30044
30045 void  __attribute__((export_name("TS_Pong_set_byteslen"))) TS_Pong_set_byteslen(uint64_t this_ptr, int16_t val) {
30046         LDKPong this_ptr_conv;
30047         this_ptr_conv.inner = untag_ptr(this_ptr);
30048         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30050         this_ptr_conv.is_owned = false;
30051         Pong_set_byteslen(&this_ptr_conv, val);
30052 }
30053
30054 uint64_t  __attribute__((export_name("TS_Pong_new"))) TS_Pong_new(int16_t byteslen_arg) {
30055         LDKPong ret_var = Pong_new(byteslen_arg);
30056         uint64_t ret_ref = 0;
30057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30059         return ret_ref;
30060 }
30061
30062 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
30063         LDKPong ret_var = Pong_clone(arg);
30064         uint64_t ret_ref = 0;
30065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30067         return ret_ref;
30068 }
30069 int64_t  __attribute__((export_name("TS_Pong_clone_ptr"))) TS_Pong_clone_ptr(uint64_t arg) {
30070         LDKPong arg_conv;
30071         arg_conv.inner = untag_ptr(arg);
30072         arg_conv.is_owned = ptr_is_owned(arg);
30073         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30074         arg_conv.is_owned = false;
30075         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
30076         return ret_conv;
30077 }
30078
30079 uint64_t  __attribute__((export_name("TS_Pong_clone"))) TS_Pong_clone(uint64_t orig) {
30080         LDKPong orig_conv;
30081         orig_conv.inner = untag_ptr(orig);
30082         orig_conv.is_owned = ptr_is_owned(orig);
30083         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30084         orig_conv.is_owned = false;
30085         LDKPong ret_var = Pong_clone(&orig_conv);
30086         uint64_t ret_ref = 0;
30087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30089         return ret_ref;
30090 }
30091
30092 jboolean  __attribute__((export_name("TS_Pong_eq"))) TS_Pong_eq(uint64_t a, uint64_t b) {
30093         LDKPong a_conv;
30094         a_conv.inner = untag_ptr(a);
30095         a_conv.is_owned = ptr_is_owned(a);
30096         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30097         a_conv.is_owned = false;
30098         LDKPong b_conv;
30099         b_conv.inner = untag_ptr(b);
30100         b_conv.is_owned = ptr_is_owned(b);
30101         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30102         b_conv.is_owned = false;
30103         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
30104         return ret_conv;
30105 }
30106
30107 void  __attribute__((export_name("TS_OpenChannel_free"))) TS_OpenChannel_free(uint64_t this_obj) {
30108         LDKOpenChannel this_obj_conv;
30109         this_obj_conv.inner = untag_ptr(this_obj);
30110         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30112         OpenChannel_free(this_obj_conv);
30113 }
30114
30115 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_chain_hash"))) TS_OpenChannel_get_chain_hash(uint64_t this_ptr) {
30116         LDKOpenChannel this_ptr_conv;
30117         this_ptr_conv.inner = untag_ptr(this_ptr);
30118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30120         this_ptr_conv.is_owned = false;
30121         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30122         memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
30123         return ret_arr;
30124 }
30125
30126 void  __attribute__((export_name("TS_OpenChannel_set_chain_hash"))) TS_OpenChannel_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
30127         LDKOpenChannel this_ptr_conv;
30128         this_ptr_conv.inner = untag_ptr(this_ptr);
30129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30131         this_ptr_conv.is_owned = false;
30132         LDKThirtyTwoBytes val_ref;
30133         CHECK(val->arr_len == 32);
30134         memcpy(val_ref.data, val->elems, 32); FREE(val);
30135         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
30136 }
30137
30138 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_temporary_channel_id"))) TS_OpenChannel_get_temporary_channel_id(uint64_t this_ptr) {
30139         LDKOpenChannel this_ptr_conv;
30140         this_ptr_conv.inner = untag_ptr(this_ptr);
30141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30143         this_ptr_conv.is_owned = false;
30144         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30145         memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
30146         return ret_arr;
30147 }
30148
30149 void  __attribute__((export_name("TS_OpenChannel_set_temporary_channel_id"))) TS_OpenChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
30150         LDKOpenChannel this_ptr_conv;
30151         this_ptr_conv.inner = untag_ptr(this_ptr);
30152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30154         this_ptr_conv.is_owned = false;
30155         LDKThirtyTwoBytes val_ref;
30156         CHECK(val->arr_len == 32);
30157         memcpy(val_ref.data, val->elems, 32); FREE(val);
30158         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
30159 }
30160
30161 int64_t  __attribute__((export_name("TS_OpenChannel_get_funding_satoshis"))) TS_OpenChannel_get_funding_satoshis(uint64_t this_ptr) {
30162         LDKOpenChannel this_ptr_conv;
30163         this_ptr_conv.inner = untag_ptr(this_ptr);
30164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30166         this_ptr_conv.is_owned = false;
30167         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
30168         return ret_conv;
30169 }
30170
30171 void  __attribute__((export_name("TS_OpenChannel_set_funding_satoshis"))) TS_OpenChannel_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
30172         LDKOpenChannel this_ptr_conv;
30173         this_ptr_conv.inner = untag_ptr(this_ptr);
30174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30176         this_ptr_conv.is_owned = false;
30177         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
30178 }
30179
30180 int64_t  __attribute__((export_name("TS_OpenChannel_get_push_msat"))) TS_OpenChannel_get_push_msat(uint64_t this_ptr) {
30181         LDKOpenChannel this_ptr_conv;
30182         this_ptr_conv.inner = untag_ptr(this_ptr);
30183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30185         this_ptr_conv.is_owned = false;
30186         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
30187         return ret_conv;
30188 }
30189
30190 void  __attribute__((export_name("TS_OpenChannel_set_push_msat"))) TS_OpenChannel_set_push_msat(uint64_t this_ptr, int64_t val) {
30191         LDKOpenChannel this_ptr_conv;
30192         this_ptr_conv.inner = untag_ptr(this_ptr);
30193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30195         this_ptr_conv.is_owned = false;
30196         OpenChannel_set_push_msat(&this_ptr_conv, val);
30197 }
30198
30199 int64_t  __attribute__((export_name("TS_OpenChannel_get_dust_limit_satoshis"))) TS_OpenChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
30200         LDKOpenChannel this_ptr_conv;
30201         this_ptr_conv.inner = untag_ptr(this_ptr);
30202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30204         this_ptr_conv.is_owned = false;
30205         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
30206         return ret_conv;
30207 }
30208
30209 void  __attribute__((export_name("TS_OpenChannel_set_dust_limit_satoshis"))) TS_OpenChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
30210         LDKOpenChannel this_ptr_conv;
30211         this_ptr_conv.inner = untag_ptr(this_ptr);
30212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30214         this_ptr_conv.is_owned = false;
30215         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
30216 }
30217
30218 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) {
30219         LDKOpenChannel this_ptr_conv;
30220         this_ptr_conv.inner = untag_ptr(this_ptr);
30221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30223         this_ptr_conv.is_owned = false;
30224         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
30225         return ret_conv;
30226 }
30227
30228 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) {
30229         LDKOpenChannel this_ptr_conv;
30230         this_ptr_conv.inner = untag_ptr(this_ptr);
30231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30233         this_ptr_conv.is_owned = false;
30234         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
30235 }
30236
30237 int64_t  __attribute__((export_name("TS_OpenChannel_get_channel_reserve_satoshis"))) TS_OpenChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
30238         LDKOpenChannel this_ptr_conv;
30239         this_ptr_conv.inner = untag_ptr(this_ptr);
30240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30242         this_ptr_conv.is_owned = false;
30243         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
30244         return ret_conv;
30245 }
30246
30247 void  __attribute__((export_name("TS_OpenChannel_set_channel_reserve_satoshis"))) TS_OpenChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
30248         LDKOpenChannel this_ptr_conv;
30249         this_ptr_conv.inner = untag_ptr(this_ptr);
30250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30252         this_ptr_conv.is_owned = false;
30253         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
30254 }
30255
30256 int64_t  __attribute__((export_name("TS_OpenChannel_get_htlc_minimum_msat"))) TS_OpenChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
30257         LDKOpenChannel this_ptr_conv;
30258         this_ptr_conv.inner = untag_ptr(this_ptr);
30259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30261         this_ptr_conv.is_owned = false;
30262         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
30263         return ret_conv;
30264 }
30265
30266 void  __attribute__((export_name("TS_OpenChannel_set_htlc_minimum_msat"))) TS_OpenChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
30267         LDKOpenChannel this_ptr_conv;
30268         this_ptr_conv.inner = untag_ptr(this_ptr);
30269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30271         this_ptr_conv.is_owned = false;
30272         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
30273 }
30274
30275 int32_t  __attribute__((export_name("TS_OpenChannel_get_feerate_per_kw"))) TS_OpenChannel_get_feerate_per_kw(uint64_t this_ptr) {
30276         LDKOpenChannel this_ptr_conv;
30277         this_ptr_conv.inner = untag_ptr(this_ptr);
30278         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30280         this_ptr_conv.is_owned = false;
30281         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
30282         return ret_conv;
30283 }
30284
30285 void  __attribute__((export_name("TS_OpenChannel_set_feerate_per_kw"))) TS_OpenChannel_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
30286         LDKOpenChannel this_ptr_conv;
30287         this_ptr_conv.inner = untag_ptr(this_ptr);
30288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30290         this_ptr_conv.is_owned = false;
30291         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
30292 }
30293
30294 int16_t  __attribute__((export_name("TS_OpenChannel_get_to_self_delay"))) TS_OpenChannel_get_to_self_delay(uint64_t this_ptr) {
30295         LDKOpenChannel this_ptr_conv;
30296         this_ptr_conv.inner = untag_ptr(this_ptr);
30297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30299         this_ptr_conv.is_owned = false;
30300         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
30301         return ret_conv;
30302 }
30303
30304 void  __attribute__((export_name("TS_OpenChannel_set_to_self_delay"))) TS_OpenChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
30305         LDKOpenChannel this_ptr_conv;
30306         this_ptr_conv.inner = untag_ptr(this_ptr);
30307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30309         this_ptr_conv.is_owned = false;
30310         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
30311 }
30312
30313 int16_t  __attribute__((export_name("TS_OpenChannel_get_max_accepted_htlcs"))) TS_OpenChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
30314         LDKOpenChannel this_ptr_conv;
30315         this_ptr_conv.inner = untag_ptr(this_ptr);
30316         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30318         this_ptr_conv.is_owned = false;
30319         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
30320         return ret_conv;
30321 }
30322
30323 void  __attribute__((export_name("TS_OpenChannel_set_max_accepted_htlcs"))) TS_OpenChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
30324         LDKOpenChannel this_ptr_conv;
30325         this_ptr_conv.inner = untag_ptr(this_ptr);
30326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30328         this_ptr_conv.is_owned = false;
30329         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
30330 }
30331
30332 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_funding_pubkey"))) TS_OpenChannel_get_funding_pubkey(uint64_t this_ptr) {
30333         LDKOpenChannel this_ptr_conv;
30334         this_ptr_conv.inner = untag_ptr(this_ptr);
30335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30337         this_ptr_conv.is_owned = false;
30338         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30339         memcpy(ret_arr->elems, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
30340         return ret_arr;
30341 }
30342
30343 void  __attribute__((export_name("TS_OpenChannel_set_funding_pubkey"))) TS_OpenChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
30344         LDKOpenChannel this_ptr_conv;
30345         this_ptr_conv.inner = untag_ptr(this_ptr);
30346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30348         this_ptr_conv.is_owned = false;
30349         LDKPublicKey val_ref;
30350         CHECK(val->arr_len == 33);
30351         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30352         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
30353 }
30354
30355 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_revocation_basepoint"))) TS_OpenChannel_get_revocation_basepoint(uint64_t this_ptr) {
30356         LDKOpenChannel this_ptr_conv;
30357         this_ptr_conv.inner = untag_ptr(this_ptr);
30358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30360         this_ptr_conv.is_owned = false;
30361         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30362         memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
30363         return ret_arr;
30364 }
30365
30366 void  __attribute__((export_name("TS_OpenChannel_set_revocation_basepoint"))) TS_OpenChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
30367         LDKOpenChannel this_ptr_conv;
30368         this_ptr_conv.inner = untag_ptr(this_ptr);
30369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30371         this_ptr_conv.is_owned = false;
30372         LDKPublicKey val_ref;
30373         CHECK(val->arr_len == 33);
30374         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30375         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
30376 }
30377
30378 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_payment_point"))) TS_OpenChannel_get_payment_point(uint64_t this_ptr) {
30379         LDKOpenChannel this_ptr_conv;
30380         this_ptr_conv.inner = untag_ptr(this_ptr);
30381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30383         this_ptr_conv.is_owned = false;
30384         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30385         memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
30386         return ret_arr;
30387 }
30388
30389 void  __attribute__((export_name("TS_OpenChannel_set_payment_point"))) TS_OpenChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
30390         LDKOpenChannel this_ptr_conv;
30391         this_ptr_conv.inner = untag_ptr(this_ptr);
30392         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30394         this_ptr_conv.is_owned = false;
30395         LDKPublicKey val_ref;
30396         CHECK(val->arr_len == 33);
30397         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30398         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
30399 }
30400
30401 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_delayed_payment_basepoint"))) TS_OpenChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
30402         LDKOpenChannel this_ptr_conv;
30403         this_ptr_conv.inner = untag_ptr(this_ptr);
30404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30406         this_ptr_conv.is_owned = false;
30407         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30408         memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
30409         return ret_arr;
30410 }
30411
30412 void  __attribute__((export_name("TS_OpenChannel_set_delayed_payment_basepoint"))) TS_OpenChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
30413         LDKOpenChannel this_ptr_conv;
30414         this_ptr_conv.inner = untag_ptr(this_ptr);
30415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30417         this_ptr_conv.is_owned = false;
30418         LDKPublicKey val_ref;
30419         CHECK(val->arr_len == 33);
30420         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30421         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
30422 }
30423
30424 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_htlc_basepoint"))) TS_OpenChannel_get_htlc_basepoint(uint64_t this_ptr) {
30425         LDKOpenChannel this_ptr_conv;
30426         this_ptr_conv.inner = untag_ptr(this_ptr);
30427         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30429         this_ptr_conv.is_owned = false;
30430         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30431         memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
30432         return ret_arr;
30433 }
30434
30435 void  __attribute__((export_name("TS_OpenChannel_set_htlc_basepoint"))) TS_OpenChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
30436         LDKOpenChannel this_ptr_conv;
30437         this_ptr_conv.inner = untag_ptr(this_ptr);
30438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30440         this_ptr_conv.is_owned = false;
30441         LDKPublicKey val_ref;
30442         CHECK(val->arr_len == 33);
30443         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30444         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
30445 }
30446
30447 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_first_per_commitment_point"))) TS_OpenChannel_get_first_per_commitment_point(uint64_t this_ptr) {
30448         LDKOpenChannel this_ptr_conv;
30449         this_ptr_conv.inner = untag_ptr(this_ptr);
30450         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30452         this_ptr_conv.is_owned = false;
30453         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30454         memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
30455         return ret_arr;
30456 }
30457
30458 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) {
30459         LDKOpenChannel this_ptr_conv;
30460         this_ptr_conv.inner = untag_ptr(this_ptr);
30461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30463         this_ptr_conv.is_owned = false;
30464         LDKPublicKey val_ref;
30465         CHECK(val->arr_len == 33);
30466         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30467         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
30468 }
30469
30470 int8_t  __attribute__((export_name("TS_OpenChannel_get_channel_flags"))) TS_OpenChannel_get_channel_flags(uint64_t this_ptr) {
30471         LDKOpenChannel this_ptr_conv;
30472         this_ptr_conv.inner = untag_ptr(this_ptr);
30473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30475         this_ptr_conv.is_owned = false;
30476         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
30477         return ret_conv;
30478 }
30479
30480 void  __attribute__((export_name("TS_OpenChannel_set_channel_flags"))) TS_OpenChannel_set_channel_flags(uint64_t this_ptr, int8_t val) {
30481         LDKOpenChannel this_ptr_conv;
30482         this_ptr_conv.inner = untag_ptr(this_ptr);
30483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30485         this_ptr_conv.is_owned = false;
30486         OpenChannel_set_channel_flags(&this_ptr_conv, val);
30487 }
30488
30489 uint64_t  __attribute__((export_name("TS_OpenChannel_get_channel_type"))) TS_OpenChannel_get_channel_type(uint64_t this_ptr) {
30490         LDKOpenChannel this_ptr_conv;
30491         this_ptr_conv.inner = untag_ptr(this_ptr);
30492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30494         this_ptr_conv.is_owned = false;
30495         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
30496         uint64_t ret_ref = 0;
30497         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30498         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30499         return ret_ref;
30500 }
30501
30502 void  __attribute__((export_name("TS_OpenChannel_set_channel_type"))) TS_OpenChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
30503         LDKOpenChannel this_ptr_conv;
30504         this_ptr_conv.inner = untag_ptr(this_ptr);
30505         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30507         this_ptr_conv.is_owned = false;
30508         LDKChannelTypeFeatures val_conv;
30509         val_conv.inner = untag_ptr(val);
30510         val_conv.is_owned = ptr_is_owned(val);
30511         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30512         val_conv = ChannelTypeFeatures_clone(&val_conv);
30513         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
30514 }
30515
30516 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
30517         LDKOpenChannel ret_var = OpenChannel_clone(arg);
30518         uint64_t ret_ref = 0;
30519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30520         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30521         return ret_ref;
30522 }
30523 int64_t  __attribute__((export_name("TS_OpenChannel_clone_ptr"))) TS_OpenChannel_clone_ptr(uint64_t arg) {
30524         LDKOpenChannel arg_conv;
30525         arg_conv.inner = untag_ptr(arg);
30526         arg_conv.is_owned = ptr_is_owned(arg);
30527         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30528         arg_conv.is_owned = false;
30529         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
30530         return ret_conv;
30531 }
30532
30533 uint64_t  __attribute__((export_name("TS_OpenChannel_clone"))) TS_OpenChannel_clone(uint64_t orig) {
30534         LDKOpenChannel orig_conv;
30535         orig_conv.inner = untag_ptr(orig);
30536         orig_conv.is_owned = ptr_is_owned(orig);
30537         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30538         orig_conv.is_owned = false;
30539         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
30540         uint64_t ret_ref = 0;
30541         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30542         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30543         return ret_ref;
30544 }
30545
30546 jboolean  __attribute__((export_name("TS_OpenChannel_eq"))) TS_OpenChannel_eq(uint64_t a, uint64_t b) {
30547         LDKOpenChannel a_conv;
30548         a_conv.inner = untag_ptr(a);
30549         a_conv.is_owned = ptr_is_owned(a);
30550         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30551         a_conv.is_owned = false;
30552         LDKOpenChannel b_conv;
30553         b_conv.inner = untag_ptr(b);
30554         b_conv.is_owned = ptr_is_owned(b);
30555         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30556         b_conv.is_owned = false;
30557         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
30558         return ret_conv;
30559 }
30560
30561 void  __attribute__((export_name("TS_AcceptChannel_free"))) TS_AcceptChannel_free(uint64_t this_obj) {
30562         LDKAcceptChannel this_obj_conv;
30563         this_obj_conv.inner = untag_ptr(this_obj);
30564         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30566         AcceptChannel_free(this_obj_conv);
30567 }
30568
30569 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_temporary_channel_id"))) TS_AcceptChannel_get_temporary_channel_id(uint64_t this_ptr) {
30570         LDKAcceptChannel this_ptr_conv;
30571         this_ptr_conv.inner = untag_ptr(this_ptr);
30572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30574         this_ptr_conv.is_owned = false;
30575         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30576         memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
30577         return ret_arr;
30578 }
30579
30580 void  __attribute__((export_name("TS_AcceptChannel_set_temporary_channel_id"))) TS_AcceptChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
30581         LDKAcceptChannel this_ptr_conv;
30582         this_ptr_conv.inner = untag_ptr(this_ptr);
30583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30585         this_ptr_conv.is_owned = false;
30586         LDKThirtyTwoBytes val_ref;
30587         CHECK(val->arr_len == 32);
30588         memcpy(val_ref.data, val->elems, 32); FREE(val);
30589         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
30590 }
30591
30592 int64_t  __attribute__((export_name("TS_AcceptChannel_get_dust_limit_satoshis"))) TS_AcceptChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
30593         LDKAcceptChannel this_ptr_conv;
30594         this_ptr_conv.inner = untag_ptr(this_ptr);
30595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30597         this_ptr_conv.is_owned = false;
30598         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
30599         return ret_conv;
30600 }
30601
30602 void  __attribute__((export_name("TS_AcceptChannel_set_dust_limit_satoshis"))) TS_AcceptChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
30603         LDKAcceptChannel this_ptr_conv;
30604         this_ptr_conv.inner = untag_ptr(this_ptr);
30605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30607         this_ptr_conv.is_owned = false;
30608         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
30609 }
30610
30611 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) {
30612         LDKAcceptChannel this_ptr_conv;
30613         this_ptr_conv.inner = untag_ptr(this_ptr);
30614         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30616         this_ptr_conv.is_owned = false;
30617         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
30618         return ret_conv;
30619 }
30620
30621 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) {
30622         LDKAcceptChannel this_ptr_conv;
30623         this_ptr_conv.inner = untag_ptr(this_ptr);
30624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30626         this_ptr_conv.is_owned = false;
30627         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
30628 }
30629
30630 int64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_reserve_satoshis"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
30631         LDKAcceptChannel this_ptr_conv;
30632         this_ptr_conv.inner = untag_ptr(this_ptr);
30633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30635         this_ptr_conv.is_owned = false;
30636         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
30637         return ret_conv;
30638 }
30639
30640 void  __attribute__((export_name("TS_AcceptChannel_set_channel_reserve_satoshis"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
30641         LDKAcceptChannel this_ptr_conv;
30642         this_ptr_conv.inner = untag_ptr(this_ptr);
30643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30645         this_ptr_conv.is_owned = false;
30646         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
30647 }
30648
30649 int64_t  __attribute__((export_name("TS_AcceptChannel_get_htlc_minimum_msat"))) TS_AcceptChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
30650         LDKAcceptChannel this_ptr_conv;
30651         this_ptr_conv.inner = untag_ptr(this_ptr);
30652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30654         this_ptr_conv.is_owned = false;
30655         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
30656         return ret_conv;
30657 }
30658
30659 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_minimum_msat"))) TS_AcceptChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
30660         LDKAcceptChannel this_ptr_conv;
30661         this_ptr_conv.inner = untag_ptr(this_ptr);
30662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30664         this_ptr_conv.is_owned = false;
30665         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
30666 }
30667
30668 int32_t  __attribute__((export_name("TS_AcceptChannel_get_minimum_depth"))) TS_AcceptChannel_get_minimum_depth(uint64_t this_ptr) {
30669         LDKAcceptChannel this_ptr_conv;
30670         this_ptr_conv.inner = untag_ptr(this_ptr);
30671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30673         this_ptr_conv.is_owned = false;
30674         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
30675         return ret_conv;
30676 }
30677
30678 void  __attribute__((export_name("TS_AcceptChannel_set_minimum_depth"))) TS_AcceptChannel_set_minimum_depth(uint64_t this_ptr, int32_t val) {
30679         LDKAcceptChannel this_ptr_conv;
30680         this_ptr_conv.inner = untag_ptr(this_ptr);
30681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30683         this_ptr_conv.is_owned = false;
30684         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
30685 }
30686
30687 int16_t  __attribute__((export_name("TS_AcceptChannel_get_to_self_delay"))) TS_AcceptChannel_get_to_self_delay(uint64_t this_ptr) {
30688         LDKAcceptChannel this_ptr_conv;
30689         this_ptr_conv.inner = untag_ptr(this_ptr);
30690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30692         this_ptr_conv.is_owned = false;
30693         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
30694         return ret_conv;
30695 }
30696
30697 void  __attribute__((export_name("TS_AcceptChannel_set_to_self_delay"))) TS_AcceptChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
30698         LDKAcceptChannel this_ptr_conv;
30699         this_ptr_conv.inner = untag_ptr(this_ptr);
30700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30702         this_ptr_conv.is_owned = false;
30703         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
30704 }
30705
30706 int16_t  __attribute__((export_name("TS_AcceptChannel_get_max_accepted_htlcs"))) TS_AcceptChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
30707         LDKAcceptChannel this_ptr_conv;
30708         this_ptr_conv.inner = untag_ptr(this_ptr);
30709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30711         this_ptr_conv.is_owned = false;
30712         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
30713         return ret_conv;
30714 }
30715
30716 void  __attribute__((export_name("TS_AcceptChannel_set_max_accepted_htlcs"))) TS_AcceptChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
30717         LDKAcceptChannel this_ptr_conv;
30718         this_ptr_conv.inner = untag_ptr(this_ptr);
30719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30721         this_ptr_conv.is_owned = false;
30722         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
30723 }
30724
30725 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_funding_pubkey"))) TS_AcceptChannel_get_funding_pubkey(uint64_t this_ptr) {
30726         LDKAcceptChannel this_ptr_conv;
30727         this_ptr_conv.inner = untag_ptr(this_ptr);
30728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30730         this_ptr_conv.is_owned = false;
30731         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30732         memcpy(ret_arr->elems, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
30733         return ret_arr;
30734 }
30735
30736 void  __attribute__((export_name("TS_AcceptChannel_set_funding_pubkey"))) TS_AcceptChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
30737         LDKAcceptChannel this_ptr_conv;
30738         this_ptr_conv.inner = untag_ptr(this_ptr);
30739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30741         this_ptr_conv.is_owned = false;
30742         LDKPublicKey val_ref;
30743         CHECK(val->arr_len == 33);
30744         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30745         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
30746 }
30747
30748 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_revocation_basepoint"))) TS_AcceptChannel_get_revocation_basepoint(uint64_t this_ptr) {
30749         LDKAcceptChannel this_ptr_conv;
30750         this_ptr_conv.inner = untag_ptr(this_ptr);
30751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30753         this_ptr_conv.is_owned = false;
30754         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30755         memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
30756         return ret_arr;
30757 }
30758
30759 void  __attribute__((export_name("TS_AcceptChannel_set_revocation_basepoint"))) TS_AcceptChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
30760         LDKAcceptChannel this_ptr_conv;
30761         this_ptr_conv.inner = untag_ptr(this_ptr);
30762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30764         this_ptr_conv.is_owned = false;
30765         LDKPublicKey val_ref;
30766         CHECK(val->arr_len == 33);
30767         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30768         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
30769 }
30770
30771 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_payment_point"))) TS_AcceptChannel_get_payment_point(uint64_t this_ptr) {
30772         LDKAcceptChannel this_ptr_conv;
30773         this_ptr_conv.inner = untag_ptr(this_ptr);
30774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30776         this_ptr_conv.is_owned = false;
30777         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30778         memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
30779         return ret_arr;
30780 }
30781
30782 void  __attribute__((export_name("TS_AcceptChannel_set_payment_point"))) TS_AcceptChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
30783         LDKAcceptChannel this_ptr_conv;
30784         this_ptr_conv.inner = untag_ptr(this_ptr);
30785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30787         this_ptr_conv.is_owned = false;
30788         LDKPublicKey val_ref;
30789         CHECK(val->arr_len == 33);
30790         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30791         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
30792 }
30793
30794 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_delayed_payment_basepoint"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
30795         LDKAcceptChannel this_ptr_conv;
30796         this_ptr_conv.inner = untag_ptr(this_ptr);
30797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30799         this_ptr_conv.is_owned = false;
30800         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30801         memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
30802         return ret_arr;
30803 }
30804
30805 void  __attribute__((export_name("TS_AcceptChannel_set_delayed_payment_basepoint"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
30806         LDKAcceptChannel this_ptr_conv;
30807         this_ptr_conv.inner = untag_ptr(this_ptr);
30808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30810         this_ptr_conv.is_owned = false;
30811         LDKPublicKey val_ref;
30812         CHECK(val->arr_len == 33);
30813         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30814         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
30815 }
30816
30817 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_htlc_basepoint"))) TS_AcceptChannel_get_htlc_basepoint(uint64_t this_ptr) {
30818         LDKAcceptChannel this_ptr_conv;
30819         this_ptr_conv.inner = untag_ptr(this_ptr);
30820         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30822         this_ptr_conv.is_owned = false;
30823         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30824         memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
30825         return ret_arr;
30826 }
30827
30828 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_basepoint"))) TS_AcceptChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
30829         LDKAcceptChannel this_ptr_conv;
30830         this_ptr_conv.inner = untag_ptr(this_ptr);
30831         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30833         this_ptr_conv.is_owned = false;
30834         LDKPublicKey val_ref;
30835         CHECK(val->arr_len == 33);
30836         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30837         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
30838 }
30839
30840 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_first_per_commitment_point"))) TS_AcceptChannel_get_first_per_commitment_point(uint64_t this_ptr) {
30841         LDKAcceptChannel this_ptr_conv;
30842         this_ptr_conv.inner = untag_ptr(this_ptr);
30843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30845         this_ptr_conv.is_owned = false;
30846         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30847         memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
30848         return ret_arr;
30849 }
30850
30851 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) {
30852         LDKAcceptChannel this_ptr_conv;
30853         this_ptr_conv.inner = untag_ptr(this_ptr);
30854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30856         this_ptr_conv.is_owned = false;
30857         LDKPublicKey val_ref;
30858         CHECK(val->arr_len == 33);
30859         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30860         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
30861 }
30862
30863 uint64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_type"))) TS_AcceptChannel_get_channel_type(uint64_t this_ptr) {
30864         LDKAcceptChannel this_ptr_conv;
30865         this_ptr_conv.inner = untag_ptr(this_ptr);
30866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30868         this_ptr_conv.is_owned = false;
30869         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
30870         uint64_t ret_ref = 0;
30871         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30872         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30873         return ret_ref;
30874 }
30875
30876 void  __attribute__((export_name("TS_AcceptChannel_set_channel_type"))) TS_AcceptChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
30877         LDKAcceptChannel this_ptr_conv;
30878         this_ptr_conv.inner = untag_ptr(this_ptr);
30879         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30881         this_ptr_conv.is_owned = false;
30882         LDKChannelTypeFeatures val_conv;
30883         val_conv.inner = untag_ptr(val);
30884         val_conv.is_owned = ptr_is_owned(val);
30885         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30886         val_conv = ChannelTypeFeatures_clone(&val_conv);
30887         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
30888 }
30889
30890 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
30891         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
30892         uint64_t ret_ref = 0;
30893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30895         return ret_ref;
30896 }
30897 int64_t  __attribute__((export_name("TS_AcceptChannel_clone_ptr"))) TS_AcceptChannel_clone_ptr(uint64_t arg) {
30898         LDKAcceptChannel arg_conv;
30899         arg_conv.inner = untag_ptr(arg);
30900         arg_conv.is_owned = ptr_is_owned(arg);
30901         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30902         arg_conv.is_owned = false;
30903         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
30904         return ret_conv;
30905 }
30906
30907 uint64_t  __attribute__((export_name("TS_AcceptChannel_clone"))) TS_AcceptChannel_clone(uint64_t orig) {
30908         LDKAcceptChannel orig_conv;
30909         orig_conv.inner = untag_ptr(orig);
30910         orig_conv.is_owned = ptr_is_owned(orig);
30911         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30912         orig_conv.is_owned = false;
30913         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
30914         uint64_t ret_ref = 0;
30915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30917         return ret_ref;
30918 }
30919
30920 jboolean  __attribute__((export_name("TS_AcceptChannel_eq"))) TS_AcceptChannel_eq(uint64_t a, uint64_t b) {
30921         LDKAcceptChannel a_conv;
30922         a_conv.inner = untag_ptr(a);
30923         a_conv.is_owned = ptr_is_owned(a);
30924         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30925         a_conv.is_owned = false;
30926         LDKAcceptChannel b_conv;
30927         b_conv.inner = untag_ptr(b);
30928         b_conv.is_owned = ptr_is_owned(b);
30929         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30930         b_conv.is_owned = false;
30931         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
30932         return ret_conv;
30933 }
30934
30935 void  __attribute__((export_name("TS_FundingCreated_free"))) TS_FundingCreated_free(uint64_t this_obj) {
30936         LDKFundingCreated this_obj_conv;
30937         this_obj_conv.inner = untag_ptr(this_obj);
30938         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30940         FundingCreated_free(this_obj_conv);
30941 }
30942
30943 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_temporary_channel_id"))) TS_FundingCreated_get_temporary_channel_id(uint64_t this_ptr) {
30944         LDKFundingCreated this_ptr_conv;
30945         this_ptr_conv.inner = untag_ptr(this_ptr);
30946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30948         this_ptr_conv.is_owned = false;
30949         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30950         memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
30951         return ret_arr;
30952 }
30953
30954 void  __attribute__((export_name("TS_FundingCreated_set_temporary_channel_id"))) TS_FundingCreated_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
30955         LDKFundingCreated this_ptr_conv;
30956         this_ptr_conv.inner = untag_ptr(this_ptr);
30957         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30959         this_ptr_conv.is_owned = false;
30960         LDKThirtyTwoBytes val_ref;
30961         CHECK(val->arr_len == 32);
30962         memcpy(val_ref.data, val->elems, 32); FREE(val);
30963         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
30964 }
30965
30966 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_funding_txid"))) TS_FundingCreated_get_funding_txid(uint64_t this_ptr) {
30967         LDKFundingCreated this_ptr_conv;
30968         this_ptr_conv.inner = untag_ptr(this_ptr);
30969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30971         this_ptr_conv.is_owned = false;
30972         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30973         memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
30974         return ret_arr;
30975 }
30976
30977 void  __attribute__((export_name("TS_FundingCreated_set_funding_txid"))) TS_FundingCreated_set_funding_txid(uint64_t this_ptr, int8_tArray val) {
30978         LDKFundingCreated this_ptr_conv;
30979         this_ptr_conv.inner = untag_ptr(this_ptr);
30980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30982         this_ptr_conv.is_owned = false;
30983         LDKThirtyTwoBytes val_ref;
30984         CHECK(val->arr_len == 32);
30985         memcpy(val_ref.data, val->elems, 32); FREE(val);
30986         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
30987 }
30988
30989 int16_t  __attribute__((export_name("TS_FundingCreated_get_funding_output_index"))) TS_FundingCreated_get_funding_output_index(uint64_t this_ptr) {
30990         LDKFundingCreated this_ptr_conv;
30991         this_ptr_conv.inner = untag_ptr(this_ptr);
30992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30994         this_ptr_conv.is_owned = false;
30995         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
30996         return ret_conv;
30997 }
30998
30999 void  __attribute__((export_name("TS_FundingCreated_set_funding_output_index"))) TS_FundingCreated_set_funding_output_index(uint64_t this_ptr, int16_t val) {
31000         LDKFundingCreated this_ptr_conv;
31001         this_ptr_conv.inner = untag_ptr(this_ptr);
31002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31004         this_ptr_conv.is_owned = false;
31005         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
31006 }
31007
31008 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_signature"))) TS_FundingCreated_get_signature(uint64_t this_ptr) {
31009         LDKFundingCreated this_ptr_conv;
31010         this_ptr_conv.inner = untag_ptr(this_ptr);
31011         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31013         this_ptr_conv.is_owned = false;
31014         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31015         memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
31016         return ret_arr;
31017 }
31018
31019 void  __attribute__((export_name("TS_FundingCreated_set_signature"))) TS_FundingCreated_set_signature(uint64_t this_ptr, int8_tArray val) {
31020         LDKFundingCreated this_ptr_conv;
31021         this_ptr_conv.inner = untag_ptr(this_ptr);
31022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31024         this_ptr_conv.is_owned = false;
31025         LDKSignature val_ref;
31026         CHECK(val->arr_len == 64);
31027         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31028         FundingCreated_set_signature(&this_ptr_conv, val_ref);
31029 }
31030
31031 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) {
31032         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
31033         CHECK(temporary_channel_id_arg->arr_len == 32);
31034         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
31035         LDKThirtyTwoBytes funding_txid_arg_ref;
31036         CHECK(funding_txid_arg->arr_len == 32);
31037         memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
31038         LDKSignature signature_arg_ref;
31039         CHECK(signature_arg->arr_len == 64);
31040         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
31041         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
31042         uint64_t ret_ref = 0;
31043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31045         return ret_ref;
31046 }
31047
31048 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
31049         LDKFundingCreated ret_var = FundingCreated_clone(arg);
31050         uint64_t ret_ref = 0;
31051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31053         return ret_ref;
31054 }
31055 int64_t  __attribute__((export_name("TS_FundingCreated_clone_ptr"))) TS_FundingCreated_clone_ptr(uint64_t arg) {
31056         LDKFundingCreated arg_conv;
31057         arg_conv.inner = untag_ptr(arg);
31058         arg_conv.is_owned = ptr_is_owned(arg);
31059         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31060         arg_conv.is_owned = false;
31061         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
31062         return ret_conv;
31063 }
31064
31065 uint64_t  __attribute__((export_name("TS_FundingCreated_clone"))) TS_FundingCreated_clone(uint64_t orig) {
31066         LDKFundingCreated orig_conv;
31067         orig_conv.inner = untag_ptr(orig);
31068         orig_conv.is_owned = ptr_is_owned(orig);
31069         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31070         orig_conv.is_owned = false;
31071         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
31072         uint64_t ret_ref = 0;
31073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31075         return ret_ref;
31076 }
31077
31078 jboolean  __attribute__((export_name("TS_FundingCreated_eq"))) TS_FundingCreated_eq(uint64_t a, uint64_t b) {
31079         LDKFundingCreated a_conv;
31080         a_conv.inner = untag_ptr(a);
31081         a_conv.is_owned = ptr_is_owned(a);
31082         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31083         a_conv.is_owned = false;
31084         LDKFundingCreated b_conv;
31085         b_conv.inner = untag_ptr(b);
31086         b_conv.is_owned = ptr_is_owned(b);
31087         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31088         b_conv.is_owned = false;
31089         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
31090         return ret_conv;
31091 }
31092
31093 void  __attribute__((export_name("TS_FundingSigned_free"))) TS_FundingSigned_free(uint64_t this_obj) {
31094         LDKFundingSigned this_obj_conv;
31095         this_obj_conv.inner = untag_ptr(this_obj);
31096         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31098         FundingSigned_free(this_obj_conv);
31099 }
31100
31101 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_channel_id"))) TS_FundingSigned_get_channel_id(uint64_t this_ptr) {
31102         LDKFundingSigned this_ptr_conv;
31103         this_ptr_conv.inner = untag_ptr(this_ptr);
31104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31106         this_ptr_conv.is_owned = false;
31107         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31108         memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
31109         return ret_arr;
31110 }
31111
31112 void  __attribute__((export_name("TS_FundingSigned_set_channel_id"))) TS_FundingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31113         LDKFundingSigned this_ptr_conv;
31114         this_ptr_conv.inner = untag_ptr(this_ptr);
31115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31117         this_ptr_conv.is_owned = false;
31118         LDKThirtyTwoBytes val_ref;
31119         CHECK(val->arr_len == 32);
31120         memcpy(val_ref.data, val->elems, 32); FREE(val);
31121         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
31122 }
31123
31124 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_signature"))) TS_FundingSigned_get_signature(uint64_t this_ptr) {
31125         LDKFundingSigned this_ptr_conv;
31126         this_ptr_conv.inner = untag_ptr(this_ptr);
31127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31129         this_ptr_conv.is_owned = false;
31130         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31131         memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
31132         return ret_arr;
31133 }
31134
31135 void  __attribute__((export_name("TS_FundingSigned_set_signature"))) TS_FundingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
31136         LDKFundingSigned this_ptr_conv;
31137         this_ptr_conv.inner = untag_ptr(this_ptr);
31138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31140         this_ptr_conv.is_owned = false;
31141         LDKSignature val_ref;
31142         CHECK(val->arr_len == 64);
31143         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31144         FundingSigned_set_signature(&this_ptr_conv, val_ref);
31145 }
31146
31147 uint64_t  __attribute__((export_name("TS_FundingSigned_new"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
31148         LDKThirtyTwoBytes channel_id_arg_ref;
31149         CHECK(channel_id_arg->arr_len == 32);
31150         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
31151         LDKSignature signature_arg_ref;
31152         CHECK(signature_arg->arr_len == 64);
31153         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
31154         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
31155         uint64_t ret_ref = 0;
31156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31158         return ret_ref;
31159 }
31160
31161 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
31162         LDKFundingSigned ret_var = FundingSigned_clone(arg);
31163         uint64_t ret_ref = 0;
31164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31166         return ret_ref;
31167 }
31168 int64_t  __attribute__((export_name("TS_FundingSigned_clone_ptr"))) TS_FundingSigned_clone_ptr(uint64_t arg) {
31169         LDKFundingSigned arg_conv;
31170         arg_conv.inner = untag_ptr(arg);
31171         arg_conv.is_owned = ptr_is_owned(arg);
31172         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31173         arg_conv.is_owned = false;
31174         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
31175         return ret_conv;
31176 }
31177
31178 uint64_t  __attribute__((export_name("TS_FundingSigned_clone"))) TS_FundingSigned_clone(uint64_t orig) {
31179         LDKFundingSigned orig_conv;
31180         orig_conv.inner = untag_ptr(orig);
31181         orig_conv.is_owned = ptr_is_owned(orig);
31182         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31183         orig_conv.is_owned = false;
31184         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
31185         uint64_t ret_ref = 0;
31186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31188         return ret_ref;
31189 }
31190
31191 jboolean  __attribute__((export_name("TS_FundingSigned_eq"))) TS_FundingSigned_eq(uint64_t a, uint64_t b) {
31192         LDKFundingSigned a_conv;
31193         a_conv.inner = untag_ptr(a);
31194         a_conv.is_owned = ptr_is_owned(a);
31195         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31196         a_conv.is_owned = false;
31197         LDKFundingSigned b_conv;
31198         b_conv.inner = untag_ptr(b);
31199         b_conv.is_owned = ptr_is_owned(b);
31200         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31201         b_conv.is_owned = false;
31202         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
31203         return ret_conv;
31204 }
31205
31206 void  __attribute__((export_name("TS_ChannelReady_free"))) TS_ChannelReady_free(uint64_t this_obj) {
31207         LDKChannelReady this_obj_conv;
31208         this_obj_conv.inner = untag_ptr(this_obj);
31209         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31211         ChannelReady_free(this_obj_conv);
31212 }
31213
31214 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_channel_id"))) TS_ChannelReady_get_channel_id(uint64_t this_ptr) {
31215         LDKChannelReady this_ptr_conv;
31216         this_ptr_conv.inner = untag_ptr(this_ptr);
31217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31219         this_ptr_conv.is_owned = false;
31220         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31221         memcpy(ret_arr->elems, *ChannelReady_get_channel_id(&this_ptr_conv), 32);
31222         return ret_arr;
31223 }
31224
31225 void  __attribute__((export_name("TS_ChannelReady_set_channel_id"))) TS_ChannelReady_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31226         LDKChannelReady this_ptr_conv;
31227         this_ptr_conv.inner = untag_ptr(this_ptr);
31228         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31230         this_ptr_conv.is_owned = false;
31231         LDKThirtyTwoBytes val_ref;
31232         CHECK(val->arr_len == 32);
31233         memcpy(val_ref.data, val->elems, 32); FREE(val);
31234         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
31235 }
31236
31237 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_next_per_commitment_point"))) TS_ChannelReady_get_next_per_commitment_point(uint64_t this_ptr) {
31238         LDKChannelReady this_ptr_conv;
31239         this_ptr_conv.inner = untag_ptr(this_ptr);
31240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31242         this_ptr_conv.is_owned = false;
31243         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31244         memcpy(ret_arr->elems, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
31245         return ret_arr;
31246 }
31247
31248 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) {
31249         LDKChannelReady this_ptr_conv;
31250         this_ptr_conv.inner = untag_ptr(this_ptr);
31251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31253         this_ptr_conv.is_owned = false;
31254         LDKPublicKey val_ref;
31255         CHECK(val->arr_len == 33);
31256         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31257         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
31258 }
31259
31260 uint64_t  __attribute__((export_name("TS_ChannelReady_get_short_channel_id_alias"))) TS_ChannelReady_get_short_channel_id_alias(uint64_t this_ptr) {
31261         LDKChannelReady this_ptr_conv;
31262         this_ptr_conv.inner = untag_ptr(this_ptr);
31263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31265         this_ptr_conv.is_owned = false;
31266         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31267         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
31268         uint64_t ret_ref = tag_ptr(ret_copy, true);
31269         return ret_ref;
31270 }
31271
31272 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) {
31273         LDKChannelReady this_ptr_conv;
31274         this_ptr_conv.inner = untag_ptr(this_ptr);
31275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31277         this_ptr_conv.is_owned = false;
31278         void* val_ptr = untag_ptr(val);
31279         CHECK_ACCESS(val_ptr);
31280         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31281         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
31282         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
31283 }
31284
31285 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) {
31286         LDKThirtyTwoBytes channel_id_arg_ref;
31287         CHECK(channel_id_arg->arr_len == 32);
31288         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
31289         LDKPublicKey next_per_commitment_point_arg_ref;
31290         CHECK(next_per_commitment_point_arg->arr_len == 33);
31291         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
31292         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
31293         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
31294         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
31295         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
31296         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
31297         uint64_t ret_ref = 0;
31298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31300         return ret_ref;
31301 }
31302
31303 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
31304         LDKChannelReady ret_var = ChannelReady_clone(arg);
31305         uint64_t ret_ref = 0;
31306         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31307         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31308         return ret_ref;
31309 }
31310 int64_t  __attribute__((export_name("TS_ChannelReady_clone_ptr"))) TS_ChannelReady_clone_ptr(uint64_t arg) {
31311         LDKChannelReady arg_conv;
31312         arg_conv.inner = untag_ptr(arg);
31313         arg_conv.is_owned = ptr_is_owned(arg);
31314         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31315         arg_conv.is_owned = false;
31316         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
31317         return ret_conv;
31318 }
31319
31320 uint64_t  __attribute__((export_name("TS_ChannelReady_clone"))) TS_ChannelReady_clone(uint64_t orig) {
31321         LDKChannelReady orig_conv;
31322         orig_conv.inner = untag_ptr(orig);
31323         orig_conv.is_owned = ptr_is_owned(orig);
31324         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31325         orig_conv.is_owned = false;
31326         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
31327         uint64_t ret_ref = 0;
31328         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31329         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31330         return ret_ref;
31331 }
31332
31333 jboolean  __attribute__((export_name("TS_ChannelReady_eq"))) TS_ChannelReady_eq(uint64_t a, uint64_t b) {
31334         LDKChannelReady a_conv;
31335         a_conv.inner = untag_ptr(a);
31336         a_conv.is_owned = ptr_is_owned(a);
31337         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31338         a_conv.is_owned = false;
31339         LDKChannelReady b_conv;
31340         b_conv.inner = untag_ptr(b);
31341         b_conv.is_owned = ptr_is_owned(b);
31342         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31343         b_conv.is_owned = false;
31344         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
31345         return ret_conv;
31346 }
31347
31348 void  __attribute__((export_name("TS_Shutdown_free"))) TS_Shutdown_free(uint64_t this_obj) {
31349         LDKShutdown this_obj_conv;
31350         this_obj_conv.inner = untag_ptr(this_obj);
31351         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31353         Shutdown_free(this_obj_conv);
31354 }
31355
31356 int8_tArray  __attribute__((export_name("TS_Shutdown_get_channel_id"))) TS_Shutdown_get_channel_id(uint64_t this_ptr) {
31357         LDKShutdown this_ptr_conv;
31358         this_ptr_conv.inner = untag_ptr(this_ptr);
31359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31361         this_ptr_conv.is_owned = false;
31362         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31363         memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
31364         return ret_arr;
31365 }
31366
31367 void  __attribute__((export_name("TS_Shutdown_set_channel_id"))) TS_Shutdown_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31368         LDKShutdown this_ptr_conv;
31369         this_ptr_conv.inner = untag_ptr(this_ptr);
31370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31372         this_ptr_conv.is_owned = false;
31373         LDKThirtyTwoBytes val_ref;
31374         CHECK(val->arr_len == 32);
31375         memcpy(val_ref.data, val->elems, 32); FREE(val);
31376         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
31377 }
31378
31379 int8_tArray  __attribute__((export_name("TS_Shutdown_get_scriptpubkey"))) TS_Shutdown_get_scriptpubkey(uint64_t this_ptr) {
31380         LDKShutdown this_ptr_conv;
31381         this_ptr_conv.inner = untag_ptr(this_ptr);
31382         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31384         this_ptr_conv.is_owned = false;
31385         LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
31386         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31387         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31388         return ret_arr;
31389 }
31390
31391 void  __attribute__((export_name("TS_Shutdown_set_scriptpubkey"))) TS_Shutdown_set_scriptpubkey(uint64_t this_ptr, int8_tArray val) {
31392         LDKShutdown this_ptr_conv;
31393         this_ptr_conv.inner = untag_ptr(this_ptr);
31394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31396         this_ptr_conv.is_owned = false;
31397         LDKCVec_u8Z val_ref;
31398         val_ref.datalen = val->arr_len;
31399         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
31400         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
31401         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
31402 }
31403
31404 uint64_t  __attribute__((export_name("TS_Shutdown_new"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
31405         LDKThirtyTwoBytes channel_id_arg_ref;
31406         CHECK(channel_id_arg->arr_len == 32);
31407         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
31408         LDKCVec_u8Z scriptpubkey_arg_ref;
31409         scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
31410         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
31411         memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
31412         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
31413         uint64_t ret_ref = 0;
31414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31416         return ret_ref;
31417 }
31418
31419 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
31420         LDKShutdown ret_var = Shutdown_clone(arg);
31421         uint64_t ret_ref = 0;
31422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31424         return ret_ref;
31425 }
31426 int64_t  __attribute__((export_name("TS_Shutdown_clone_ptr"))) TS_Shutdown_clone_ptr(uint64_t arg) {
31427         LDKShutdown arg_conv;
31428         arg_conv.inner = untag_ptr(arg);
31429         arg_conv.is_owned = ptr_is_owned(arg);
31430         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31431         arg_conv.is_owned = false;
31432         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
31433         return ret_conv;
31434 }
31435
31436 uint64_t  __attribute__((export_name("TS_Shutdown_clone"))) TS_Shutdown_clone(uint64_t orig) {
31437         LDKShutdown orig_conv;
31438         orig_conv.inner = untag_ptr(orig);
31439         orig_conv.is_owned = ptr_is_owned(orig);
31440         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31441         orig_conv.is_owned = false;
31442         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
31443         uint64_t ret_ref = 0;
31444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31446         return ret_ref;
31447 }
31448
31449 jboolean  __attribute__((export_name("TS_Shutdown_eq"))) TS_Shutdown_eq(uint64_t a, uint64_t b) {
31450         LDKShutdown a_conv;
31451         a_conv.inner = untag_ptr(a);
31452         a_conv.is_owned = ptr_is_owned(a);
31453         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31454         a_conv.is_owned = false;
31455         LDKShutdown b_conv;
31456         b_conv.inner = untag_ptr(b);
31457         b_conv.is_owned = ptr_is_owned(b);
31458         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31459         b_conv.is_owned = false;
31460         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
31461         return ret_conv;
31462 }
31463
31464 void  __attribute__((export_name("TS_ClosingSignedFeeRange_free"))) TS_ClosingSignedFeeRange_free(uint64_t this_obj) {
31465         LDKClosingSignedFeeRange this_obj_conv;
31466         this_obj_conv.inner = untag_ptr(this_obj);
31467         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31469         ClosingSignedFeeRange_free(this_obj_conv);
31470 }
31471
31472 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_min_fee_satoshis"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint64_t this_ptr) {
31473         LDKClosingSignedFeeRange this_ptr_conv;
31474         this_ptr_conv.inner = untag_ptr(this_ptr);
31475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31477         this_ptr_conv.is_owned = false;
31478         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
31479         return ret_conv;
31480 }
31481
31482 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_min_fee_satoshis"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint64_t this_ptr, int64_t val) {
31483         LDKClosingSignedFeeRange this_ptr_conv;
31484         this_ptr_conv.inner = untag_ptr(this_ptr);
31485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31487         this_ptr_conv.is_owned = false;
31488         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
31489 }
31490
31491 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_max_fee_satoshis"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint64_t this_ptr) {
31492         LDKClosingSignedFeeRange this_ptr_conv;
31493         this_ptr_conv.inner = untag_ptr(this_ptr);
31494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31496         this_ptr_conv.is_owned = false;
31497         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
31498         return ret_conv;
31499 }
31500
31501 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_max_fee_satoshis"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint64_t this_ptr, int64_t val) {
31502         LDKClosingSignedFeeRange this_ptr_conv;
31503         this_ptr_conv.inner = untag_ptr(this_ptr);
31504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31506         this_ptr_conv.is_owned = false;
31507         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
31508 }
31509
31510 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_new"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
31511         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
31512         uint64_t ret_ref = 0;
31513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31515         return ret_ref;
31516 }
31517
31518 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
31519         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
31520         uint64_t ret_ref = 0;
31521         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31522         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31523         return ret_ref;
31524 }
31525 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone_ptr"))) TS_ClosingSignedFeeRange_clone_ptr(uint64_t arg) {
31526         LDKClosingSignedFeeRange arg_conv;
31527         arg_conv.inner = untag_ptr(arg);
31528         arg_conv.is_owned = ptr_is_owned(arg);
31529         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31530         arg_conv.is_owned = false;
31531         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
31532         return ret_conv;
31533 }
31534
31535 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone"))) TS_ClosingSignedFeeRange_clone(uint64_t orig) {
31536         LDKClosingSignedFeeRange orig_conv;
31537         orig_conv.inner = untag_ptr(orig);
31538         orig_conv.is_owned = ptr_is_owned(orig);
31539         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31540         orig_conv.is_owned = false;
31541         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
31542         uint64_t ret_ref = 0;
31543         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31544         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31545         return ret_ref;
31546 }
31547
31548 jboolean  __attribute__((export_name("TS_ClosingSignedFeeRange_eq"))) TS_ClosingSignedFeeRange_eq(uint64_t a, uint64_t b) {
31549         LDKClosingSignedFeeRange a_conv;
31550         a_conv.inner = untag_ptr(a);
31551         a_conv.is_owned = ptr_is_owned(a);
31552         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31553         a_conv.is_owned = false;
31554         LDKClosingSignedFeeRange b_conv;
31555         b_conv.inner = untag_ptr(b);
31556         b_conv.is_owned = ptr_is_owned(b);
31557         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31558         b_conv.is_owned = false;
31559         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
31560         return ret_conv;
31561 }
31562
31563 void  __attribute__((export_name("TS_ClosingSigned_free"))) TS_ClosingSigned_free(uint64_t this_obj) {
31564         LDKClosingSigned this_obj_conv;
31565         this_obj_conv.inner = untag_ptr(this_obj);
31566         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31568         ClosingSigned_free(this_obj_conv);
31569 }
31570
31571 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_channel_id"))) TS_ClosingSigned_get_channel_id(uint64_t this_ptr) {
31572         LDKClosingSigned this_ptr_conv;
31573         this_ptr_conv.inner = untag_ptr(this_ptr);
31574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31576         this_ptr_conv.is_owned = false;
31577         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31578         memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
31579         return ret_arr;
31580 }
31581
31582 void  __attribute__((export_name("TS_ClosingSigned_set_channel_id"))) TS_ClosingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31583         LDKClosingSigned this_ptr_conv;
31584         this_ptr_conv.inner = untag_ptr(this_ptr);
31585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31587         this_ptr_conv.is_owned = false;
31588         LDKThirtyTwoBytes val_ref;
31589         CHECK(val->arr_len == 32);
31590         memcpy(val_ref.data, val->elems, 32); FREE(val);
31591         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
31592 }
31593
31594 int64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_satoshis"))) TS_ClosingSigned_get_fee_satoshis(uint64_t this_ptr) {
31595         LDKClosingSigned this_ptr_conv;
31596         this_ptr_conv.inner = untag_ptr(this_ptr);
31597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31599         this_ptr_conv.is_owned = false;
31600         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
31601         return ret_conv;
31602 }
31603
31604 void  __attribute__((export_name("TS_ClosingSigned_set_fee_satoshis"))) TS_ClosingSigned_set_fee_satoshis(uint64_t this_ptr, int64_t val) {
31605         LDKClosingSigned this_ptr_conv;
31606         this_ptr_conv.inner = untag_ptr(this_ptr);
31607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31609         this_ptr_conv.is_owned = false;
31610         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
31611 }
31612
31613 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_signature"))) TS_ClosingSigned_get_signature(uint64_t this_ptr) {
31614         LDKClosingSigned this_ptr_conv;
31615         this_ptr_conv.inner = untag_ptr(this_ptr);
31616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31618         this_ptr_conv.is_owned = false;
31619         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31620         memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
31621         return ret_arr;
31622 }
31623
31624 void  __attribute__((export_name("TS_ClosingSigned_set_signature"))) TS_ClosingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
31625         LDKClosingSigned this_ptr_conv;
31626         this_ptr_conv.inner = untag_ptr(this_ptr);
31627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31629         this_ptr_conv.is_owned = false;
31630         LDKSignature val_ref;
31631         CHECK(val->arr_len == 64);
31632         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31633         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
31634 }
31635
31636 uint64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_range"))) TS_ClosingSigned_get_fee_range(uint64_t this_ptr) {
31637         LDKClosingSigned this_ptr_conv;
31638         this_ptr_conv.inner = untag_ptr(this_ptr);
31639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31641         this_ptr_conv.is_owned = false;
31642         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
31643         uint64_t ret_ref = 0;
31644         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31645         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31646         return ret_ref;
31647 }
31648
31649 void  __attribute__((export_name("TS_ClosingSigned_set_fee_range"))) TS_ClosingSigned_set_fee_range(uint64_t this_ptr, uint64_t val) {
31650         LDKClosingSigned this_ptr_conv;
31651         this_ptr_conv.inner = untag_ptr(this_ptr);
31652         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31654         this_ptr_conv.is_owned = false;
31655         LDKClosingSignedFeeRange val_conv;
31656         val_conv.inner = untag_ptr(val);
31657         val_conv.is_owned = ptr_is_owned(val);
31658         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31659         val_conv = ClosingSignedFeeRange_clone(&val_conv);
31660         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
31661 }
31662
31663 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) {
31664         LDKThirtyTwoBytes channel_id_arg_ref;
31665         CHECK(channel_id_arg->arr_len == 32);
31666         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
31667         LDKSignature signature_arg_ref;
31668         CHECK(signature_arg->arr_len == 64);
31669         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
31670         LDKClosingSignedFeeRange fee_range_arg_conv;
31671         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
31672         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
31673         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
31674         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
31675         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
31676         uint64_t ret_ref = 0;
31677         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31678         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31679         return ret_ref;
31680 }
31681
31682 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
31683         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
31684         uint64_t ret_ref = 0;
31685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31687         return ret_ref;
31688 }
31689 int64_t  __attribute__((export_name("TS_ClosingSigned_clone_ptr"))) TS_ClosingSigned_clone_ptr(uint64_t arg) {
31690         LDKClosingSigned arg_conv;
31691         arg_conv.inner = untag_ptr(arg);
31692         arg_conv.is_owned = ptr_is_owned(arg);
31693         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31694         arg_conv.is_owned = false;
31695         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
31696         return ret_conv;
31697 }
31698
31699 uint64_t  __attribute__((export_name("TS_ClosingSigned_clone"))) TS_ClosingSigned_clone(uint64_t orig) {
31700         LDKClosingSigned orig_conv;
31701         orig_conv.inner = untag_ptr(orig);
31702         orig_conv.is_owned = ptr_is_owned(orig);
31703         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31704         orig_conv.is_owned = false;
31705         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
31706         uint64_t ret_ref = 0;
31707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31709         return ret_ref;
31710 }
31711
31712 jboolean  __attribute__((export_name("TS_ClosingSigned_eq"))) TS_ClosingSigned_eq(uint64_t a, uint64_t b) {
31713         LDKClosingSigned a_conv;
31714         a_conv.inner = untag_ptr(a);
31715         a_conv.is_owned = ptr_is_owned(a);
31716         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31717         a_conv.is_owned = false;
31718         LDKClosingSigned b_conv;
31719         b_conv.inner = untag_ptr(b);
31720         b_conv.is_owned = ptr_is_owned(b);
31721         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31722         b_conv.is_owned = false;
31723         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
31724         return ret_conv;
31725 }
31726
31727 void  __attribute__((export_name("TS_UpdateAddHTLC_free"))) TS_UpdateAddHTLC_free(uint64_t this_obj) {
31728         LDKUpdateAddHTLC this_obj_conv;
31729         this_obj_conv.inner = untag_ptr(this_obj);
31730         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31732         UpdateAddHTLC_free(this_obj_conv);
31733 }
31734
31735 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_channel_id"))) TS_UpdateAddHTLC_get_channel_id(uint64_t this_ptr) {
31736         LDKUpdateAddHTLC this_ptr_conv;
31737         this_ptr_conv.inner = untag_ptr(this_ptr);
31738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31740         this_ptr_conv.is_owned = false;
31741         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31742         memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
31743         return ret_arr;
31744 }
31745
31746 void  __attribute__((export_name("TS_UpdateAddHTLC_set_channel_id"))) TS_UpdateAddHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31747         LDKUpdateAddHTLC this_ptr_conv;
31748         this_ptr_conv.inner = untag_ptr(this_ptr);
31749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31751         this_ptr_conv.is_owned = false;
31752         LDKThirtyTwoBytes val_ref;
31753         CHECK(val->arr_len == 32);
31754         memcpy(val_ref.data, val->elems, 32); FREE(val);
31755         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
31756 }
31757
31758 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_htlc_id"))) TS_UpdateAddHTLC_get_htlc_id(uint64_t this_ptr) {
31759         LDKUpdateAddHTLC this_ptr_conv;
31760         this_ptr_conv.inner = untag_ptr(this_ptr);
31761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31763         this_ptr_conv.is_owned = false;
31764         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
31765         return ret_conv;
31766 }
31767
31768 void  __attribute__((export_name("TS_UpdateAddHTLC_set_htlc_id"))) TS_UpdateAddHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
31769         LDKUpdateAddHTLC this_ptr_conv;
31770         this_ptr_conv.inner = untag_ptr(this_ptr);
31771         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31773         this_ptr_conv.is_owned = false;
31774         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
31775 }
31776
31777 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_amount_msat"))) TS_UpdateAddHTLC_get_amount_msat(uint64_t this_ptr) {
31778         LDKUpdateAddHTLC this_ptr_conv;
31779         this_ptr_conv.inner = untag_ptr(this_ptr);
31780         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31782         this_ptr_conv.is_owned = false;
31783         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
31784         return ret_conv;
31785 }
31786
31787 void  __attribute__((export_name("TS_UpdateAddHTLC_set_amount_msat"))) TS_UpdateAddHTLC_set_amount_msat(uint64_t this_ptr, int64_t val) {
31788         LDKUpdateAddHTLC this_ptr_conv;
31789         this_ptr_conv.inner = untag_ptr(this_ptr);
31790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31792         this_ptr_conv.is_owned = false;
31793         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
31794 }
31795
31796 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_payment_hash"))) TS_UpdateAddHTLC_get_payment_hash(uint64_t this_ptr) {
31797         LDKUpdateAddHTLC this_ptr_conv;
31798         this_ptr_conv.inner = untag_ptr(this_ptr);
31799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31801         this_ptr_conv.is_owned = false;
31802         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31803         memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
31804         return ret_arr;
31805 }
31806
31807 void  __attribute__((export_name("TS_UpdateAddHTLC_set_payment_hash"))) TS_UpdateAddHTLC_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
31808         LDKUpdateAddHTLC this_ptr_conv;
31809         this_ptr_conv.inner = untag_ptr(this_ptr);
31810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31812         this_ptr_conv.is_owned = false;
31813         LDKThirtyTwoBytes val_ref;
31814         CHECK(val->arr_len == 32);
31815         memcpy(val_ref.data, val->elems, 32); FREE(val);
31816         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
31817 }
31818
31819 int32_t  __attribute__((export_name("TS_UpdateAddHTLC_get_cltv_expiry"))) TS_UpdateAddHTLC_get_cltv_expiry(uint64_t this_ptr) {
31820         LDKUpdateAddHTLC this_ptr_conv;
31821         this_ptr_conv.inner = untag_ptr(this_ptr);
31822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31824         this_ptr_conv.is_owned = false;
31825         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
31826         return ret_conv;
31827 }
31828
31829 void  __attribute__((export_name("TS_UpdateAddHTLC_set_cltv_expiry"))) TS_UpdateAddHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
31830         LDKUpdateAddHTLC this_ptr_conv;
31831         this_ptr_conv.inner = untag_ptr(this_ptr);
31832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31834         this_ptr_conv.is_owned = false;
31835         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
31836 }
31837
31838 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
31839         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
31840         uint64_t ret_ref = 0;
31841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31843         return ret_ref;
31844 }
31845 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone_ptr"))) TS_UpdateAddHTLC_clone_ptr(uint64_t arg) {
31846         LDKUpdateAddHTLC arg_conv;
31847         arg_conv.inner = untag_ptr(arg);
31848         arg_conv.is_owned = ptr_is_owned(arg);
31849         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31850         arg_conv.is_owned = false;
31851         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
31852         return ret_conv;
31853 }
31854
31855 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone"))) TS_UpdateAddHTLC_clone(uint64_t orig) {
31856         LDKUpdateAddHTLC orig_conv;
31857         orig_conv.inner = untag_ptr(orig);
31858         orig_conv.is_owned = ptr_is_owned(orig);
31859         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31860         orig_conv.is_owned = false;
31861         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
31862         uint64_t ret_ref = 0;
31863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31865         return ret_ref;
31866 }
31867
31868 jboolean  __attribute__((export_name("TS_UpdateAddHTLC_eq"))) TS_UpdateAddHTLC_eq(uint64_t a, uint64_t b) {
31869         LDKUpdateAddHTLC a_conv;
31870         a_conv.inner = untag_ptr(a);
31871         a_conv.is_owned = ptr_is_owned(a);
31872         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31873         a_conv.is_owned = false;
31874         LDKUpdateAddHTLC b_conv;
31875         b_conv.inner = untag_ptr(b);
31876         b_conv.is_owned = ptr_is_owned(b);
31877         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31878         b_conv.is_owned = false;
31879         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
31880         return ret_conv;
31881 }
31882
31883 void  __attribute__((export_name("TS_OnionMessage_free"))) TS_OnionMessage_free(uint64_t this_obj) {
31884         LDKOnionMessage this_obj_conv;
31885         this_obj_conv.inner = untag_ptr(this_obj);
31886         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31888         OnionMessage_free(this_obj_conv);
31889 }
31890
31891 int8_tArray  __attribute__((export_name("TS_OnionMessage_get_blinding_point"))) TS_OnionMessage_get_blinding_point(uint64_t this_ptr) {
31892         LDKOnionMessage this_ptr_conv;
31893         this_ptr_conv.inner = untag_ptr(this_ptr);
31894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31896         this_ptr_conv.is_owned = false;
31897         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31898         memcpy(ret_arr->elems, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form, 33);
31899         return ret_arr;
31900 }
31901
31902 void  __attribute__((export_name("TS_OnionMessage_set_blinding_point"))) TS_OnionMessage_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
31903         LDKOnionMessage this_ptr_conv;
31904         this_ptr_conv.inner = untag_ptr(this_ptr);
31905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31907         this_ptr_conv.is_owned = false;
31908         LDKPublicKey val_ref;
31909         CHECK(val->arr_len == 33);
31910         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31911         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
31912 }
31913
31914 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
31915         LDKOnionMessage ret_var = OnionMessage_clone(arg);
31916         uint64_t ret_ref = 0;
31917         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31918         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31919         return ret_ref;
31920 }
31921 int64_t  __attribute__((export_name("TS_OnionMessage_clone_ptr"))) TS_OnionMessage_clone_ptr(uint64_t arg) {
31922         LDKOnionMessage arg_conv;
31923         arg_conv.inner = untag_ptr(arg);
31924         arg_conv.is_owned = ptr_is_owned(arg);
31925         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31926         arg_conv.is_owned = false;
31927         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
31928         return ret_conv;
31929 }
31930
31931 uint64_t  __attribute__((export_name("TS_OnionMessage_clone"))) TS_OnionMessage_clone(uint64_t orig) {
31932         LDKOnionMessage orig_conv;
31933         orig_conv.inner = untag_ptr(orig);
31934         orig_conv.is_owned = ptr_is_owned(orig);
31935         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31936         orig_conv.is_owned = false;
31937         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
31938         uint64_t ret_ref = 0;
31939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31941         return ret_ref;
31942 }
31943
31944 jboolean  __attribute__((export_name("TS_OnionMessage_eq"))) TS_OnionMessage_eq(uint64_t a, uint64_t b) {
31945         LDKOnionMessage a_conv;
31946         a_conv.inner = untag_ptr(a);
31947         a_conv.is_owned = ptr_is_owned(a);
31948         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31949         a_conv.is_owned = false;
31950         LDKOnionMessage b_conv;
31951         b_conv.inner = untag_ptr(b);
31952         b_conv.is_owned = ptr_is_owned(b);
31953         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31954         b_conv.is_owned = false;
31955         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
31956         return ret_conv;
31957 }
31958
31959 void  __attribute__((export_name("TS_UpdateFulfillHTLC_free"))) TS_UpdateFulfillHTLC_free(uint64_t this_obj) {
31960         LDKUpdateFulfillHTLC this_obj_conv;
31961         this_obj_conv.inner = untag_ptr(this_obj);
31962         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31964         UpdateFulfillHTLC_free(this_obj_conv);
31965 }
31966
31967 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_channel_id"))) TS_UpdateFulfillHTLC_get_channel_id(uint64_t this_ptr) {
31968         LDKUpdateFulfillHTLC this_ptr_conv;
31969         this_ptr_conv.inner = untag_ptr(this_ptr);
31970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31972         this_ptr_conv.is_owned = false;
31973         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31974         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
31975         return ret_arr;
31976 }
31977
31978 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_channel_id"))) TS_UpdateFulfillHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31979         LDKUpdateFulfillHTLC this_ptr_conv;
31980         this_ptr_conv.inner = untag_ptr(this_ptr);
31981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31983         this_ptr_conv.is_owned = false;
31984         LDKThirtyTwoBytes val_ref;
31985         CHECK(val->arr_len == 32);
31986         memcpy(val_ref.data, val->elems, 32); FREE(val);
31987         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
31988 }
31989
31990 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_get_htlc_id"))) TS_UpdateFulfillHTLC_get_htlc_id(uint64_t this_ptr) {
31991         LDKUpdateFulfillHTLC this_ptr_conv;
31992         this_ptr_conv.inner = untag_ptr(this_ptr);
31993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31995         this_ptr_conv.is_owned = false;
31996         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
31997         return ret_conv;
31998 }
31999
32000 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_htlc_id"))) TS_UpdateFulfillHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
32001         LDKUpdateFulfillHTLC this_ptr_conv;
32002         this_ptr_conv.inner = untag_ptr(this_ptr);
32003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32005         this_ptr_conv.is_owned = false;
32006         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
32007 }
32008
32009 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_payment_preimage"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint64_t this_ptr) {
32010         LDKUpdateFulfillHTLC this_ptr_conv;
32011         this_ptr_conv.inner = untag_ptr(this_ptr);
32012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32014         this_ptr_conv.is_owned = false;
32015         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32016         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
32017         return ret_arr;
32018 }
32019
32020 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_payment_preimage"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint64_t this_ptr, int8_tArray val) {
32021         LDKUpdateFulfillHTLC this_ptr_conv;
32022         this_ptr_conv.inner = untag_ptr(this_ptr);
32023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32025         this_ptr_conv.is_owned = false;
32026         LDKThirtyTwoBytes val_ref;
32027         CHECK(val->arr_len == 32);
32028         memcpy(val_ref.data, val->elems, 32); FREE(val);
32029         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
32030 }
32031
32032 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) {
32033         LDKThirtyTwoBytes channel_id_arg_ref;
32034         CHECK(channel_id_arg->arr_len == 32);
32035         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
32036         LDKThirtyTwoBytes payment_preimage_arg_ref;
32037         CHECK(payment_preimage_arg->arr_len == 32);
32038         memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
32039         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
32040         uint64_t ret_ref = 0;
32041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32043         return ret_ref;
32044 }
32045
32046 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
32047         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
32048         uint64_t ret_ref = 0;
32049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32051         return ret_ref;
32052 }
32053 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone_ptr"))) TS_UpdateFulfillHTLC_clone_ptr(uint64_t arg) {
32054         LDKUpdateFulfillHTLC arg_conv;
32055         arg_conv.inner = untag_ptr(arg);
32056         arg_conv.is_owned = ptr_is_owned(arg);
32057         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32058         arg_conv.is_owned = false;
32059         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
32060         return ret_conv;
32061 }
32062
32063 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone"))) TS_UpdateFulfillHTLC_clone(uint64_t orig) {
32064         LDKUpdateFulfillHTLC orig_conv;
32065         orig_conv.inner = untag_ptr(orig);
32066         orig_conv.is_owned = ptr_is_owned(orig);
32067         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32068         orig_conv.is_owned = false;
32069         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
32070         uint64_t ret_ref = 0;
32071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32073         return ret_ref;
32074 }
32075
32076 jboolean  __attribute__((export_name("TS_UpdateFulfillHTLC_eq"))) TS_UpdateFulfillHTLC_eq(uint64_t a, uint64_t b) {
32077         LDKUpdateFulfillHTLC a_conv;
32078         a_conv.inner = untag_ptr(a);
32079         a_conv.is_owned = ptr_is_owned(a);
32080         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32081         a_conv.is_owned = false;
32082         LDKUpdateFulfillHTLC b_conv;
32083         b_conv.inner = untag_ptr(b);
32084         b_conv.is_owned = ptr_is_owned(b);
32085         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32086         b_conv.is_owned = false;
32087         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
32088         return ret_conv;
32089 }
32090
32091 void  __attribute__((export_name("TS_UpdateFailHTLC_free"))) TS_UpdateFailHTLC_free(uint64_t this_obj) {
32092         LDKUpdateFailHTLC this_obj_conv;
32093         this_obj_conv.inner = untag_ptr(this_obj);
32094         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32096         UpdateFailHTLC_free(this_obj_conv);
32097 }
32098
32099 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_get_channel_id"))) TS_UpdateFailHTLC_get_channel_id(uint64_t this_ptr) {
32100         LDKUpdateFailHTLC this_ptr_conv;
32101         this_ptr_conv.inner = untag_ptr(this_ptr);
32102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32104         this_ptr_conv.is_owned = false;
32105         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32106         memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
32107         return ret_arr;
32108 }
32109
32110 void  __attribute__((export_name("TS_UpdateFailHTLC_set_channel_id"))) TS_UpdateFailHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32111         LDKUpdateFailHTLC this_ptr_conv;
32112         this_ptr_conv.inner = untag_ptr(this_ptr);
32113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32115         this_ptr_conv.is_owned = false;
32116         LDKThirtyTwoBytes val_ref;
32117         CHECK(val->arr_len == 32);
32118         memcpy(val_ref.data, val->elems, 32); FREE(val);
32119         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
32120 }
32121
32122 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_get_htlc_id"))) TS_UpdateFailHTLC_get_htlc_id(uint64_t this_ptr) {
32123         LDKUpdateFailHTLC this_ptr_conv;
32124         this_ptr_conv.inner = untag_ptr(this_ptr);
32125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32127         this_ptr_conv.is_owned = false;
32128         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
32129         return ret_conv;
32130 }
32131
32132 void  __attribute__((export_name("TS_UpdateFailHTLC_set_htlc_id"))) TS_UpdateFailHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
32133         LDKUpdateFailHTLC this_ptr_conv;
32134         this_ptr_conv.inner = untag_ptr(this_ptr);
32135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32137         this_ptr_conv.is_owned = false;
32138         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
32139 }
32140
32141 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
32142         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
32143         uint64_t ret_ref = 0;
32144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32146         return ret_ref;
32147 }
32148 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone_ptr"))) TS_UpdateFailHTLC_clone_ptr(uint64_t arg) {
32149         LDKUpdateFailHTLC arg_conv;
32150         arg_conv.inner = untag_ptr(arg);
32151         arg_conv.is_owned = ptr_is_owned(arg);
32152         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32153         arg_conv.is_owned = false;
32154         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
32155         return ret_conv;
32156 }
32157
32158 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone"))) TS_UpdateFailHTLC_clone(uint64_t orig) {
32159         LDKUpdateFailHTLC orig_conv;
32160         orig_conv.inner = untag_ptr(orig);
32161         orig_conv.is_owned = ptr_is_owned(orig);
32162         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32163         orig_conv.is_owned = false;
32164         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
32165         uint64_t ret_ref = 0;
32166         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32167         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32168         return ret_ref;
32169 }
32170
32171 jboolean  __attribute__((export_name("TS_UpdateFailHTLC_eq"))) TS_UpdateFailHTLC_eq(uint64_t a, uint64_t b) {
32172         LDKUpdateFailHTLC a_conv;
32173         a_conv.inner = untag_ptr(a);
32174         a_conv.is_owned = ptr_is_owned(a);
32175         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32176         a_conv.is_owned = false;
32177         LDKUpdateFailHTLC b_conv;
32178         b_conv.inner = untag_ptr(b);
32179         b_conv.is_owned = ptr_is_owned(b);
32180         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32181         b_conv.is_owned = false;
32182         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
32183         return ret_conv;
32184 }
32185
32186 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_free"))) TS_UpdateFailMalformedHTLC_free(uint64_t this_obj) {
32187         LDKUpdateFailMalformedHTLC this_obj_conv;
32188         this_obj_conv.inner = untag_ptr(this_obj);
32189         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32191         UpdateFailMalformedHTLC_free(this_obj_conv);
32192 }
32193
32194 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_channel_id"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint64_t this_ptr) {
32195         LDKUpdateFailMalformedHTLC this_ptr_conv;
32196         this_ptr_conv.inner = untag_ptr(this_ptr);
32197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32199         this_ptr_conv.is_owned = false;
32200         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32201         memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
32202         return ret_arr;
32203 }
32204
32205 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_channel_id"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32206         LDKUpdateFailMalformedHTLC this_ptr_conv;
32207         this_ptr_conv.inner = untag_ptr(this_ptr);
32208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32210         this_ptr_conv.is_owned = false;
32211         LDKThirtyTwoBytes val_ref;
32212         CHECK(val->arr_len == 32);
32213         memcpy(val_ref.data, val->elems, 32); FREE(val);
32214         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
32215 }
32216
32217 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_htlc_id"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint64_t this_ptr) {
32218         LDKUpdateFailMalformedHTLC this_ptr_conv;
32219         this_ptr_conv.inner = untag_ptr(this_ptr);
32220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32222         this_ptr_conv.is_owned = false;
32223         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
32224         return ret_conv;
32225 }
32226
32227 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_htlc_id"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
32228         LDKUpdateFailMalformedHTLC this_ptr_conv;
32229         this_ptr_conv.inner = untag_ptr(this_ptr);
32230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32232         this_ptr_conv.is_owned = false;
32233         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
32234 }
32235
32236 int16_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_failure_code"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint64_t this_ptr) {
32237         LDKUpdateFailMalformedHTLC this_ptr_conv;
32238         this_ptr_conv.inner = untag_ptr(this_ptr);
32239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32241         this_ptr_conv.is_owned = false;
32242         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
32243         return ret_conv;
32244 }
32245
32246 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_failure_code"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint64_t this_ptr, int16_t val) {
32247         LDKUpdateFailMalformedHTLC this_ptr_conv;
32248         this_ptr_conv.inner = untag_ptr(this_ptr);
32249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32251         this_ptr_conv.is_owned = false;
32252         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
32253 }
32254
32255 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
32256         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
32257         uint64_t ret_ref = 0;
32258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32260         return ret_ref;
32261 }
32262 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone_ptr"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint64_t arg) {
32263         LDKUpdateFailMalformedHTLC arg_conv;
32264         arg_conv.inner = untag_ptr(arg);
32265         arg_conv.is_owned = ptr_is_owned(arg);
32266         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32267         arg_conv.is_owned = false;
32268         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
32269         return ret_conv;
32270 }
32271
32272 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone"))) TS_UpdateFailMalformedHTLC_clone(uint64_t orig) {
32273         LDKUpdateFailMalformedHTLC orig_conv;
32274         orig_conv.inner = untag_ptr(orig);
32275         orig_conv.is_owned = ptr_is_owned(orig);
32276         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32277         orig_conv.is_owned = false;
32278         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
32279         uint64_t ret_ref = 0;
32280         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32281         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32282         return ret_ref;
32283 }
32284
32285 jboolean  __attribute__((export_name("TS_UpdateFailMalformedHTLC_eq"))) TS_UpdateFailMalformedHTLC_eq(uint64_t a, uint64_t b) {
32286         LDKUpdateFailMalformedHTLC a_conv;
32287         a_conv.inner = untag_ptr(a);
32288         a_conv.is_owned = ptr_is_owned(a);
32289         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32290         a_conv.is_owned = false;
32291         LDKUpdateFailMalformedHTLC b_conv;
32292         b_conv.inner = untag_ptr(b);
32293         b_conv.is_owned = ptr_is_owned(b);
32294         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32295         b_conv.is_owned = false;
32296         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
32297         return ret_conv;
32298 }
32299
32300 void  __attribute__((export_name("TS_CommitmentSigned_free"))) TS_CommitmentSigned_free(uint64_t this_obj) {
32301         LDKCommitmentSigned this_obj_conv;
32302         this_obj_conv.inner = untag_ptr(this_obj);
32303         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32305         CommitmentSigned_free(this_obj_conv);
32306 }
32307
32308 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_channel_id"))) TS_CommitmentSigned_get_channel_id(uint64_t this_ptr) {
32309         LDKCommitmentSigned this_ptr_conv;
32310         this_ptr_conv.inner = untag_ptr(this_ptr);
32311         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32313         this_ptr_conv.is_owned = false;
32314         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32315         memcpy(ret_arr->elems, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
32316         return ret_arr;
32317 }
32318
32319 void  __attribute__((export_name("TS_CommitmentSigned_set_channel_id"))) TS_CommitmentSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32320         LDKCommitmentSigned this_ptr_conv;
32321         this_ptr_conv.inner = untag_ptr(this_ptr);
32322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32324         this_ptr_conv.is_owned = false;
32325         LDKThirtyTwoBytes val_ref;
32326         CHECK(val->arr_len == 32);
32327         memcpy(val_ref.data, val->elems, 32); FREE(val);
32328         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
32329 }
32330
32331 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_signature"))) TS_CommitmentSigned_get_signature(uint64_t this_ptr) {
32332         LDKCommitmentSigned this_ptr_conv;
32333         this_ptr_conv.inner = untag_ptr(this_ptr);
32334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32336         this_ptr_conv.is_owned = false;
32337         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32338         memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
32339         return ret_arr;
32340 }
32341
32342 void  __attribute__((export_name("TS_CommitmentSigned_set_signature"))) TS_CommitmentSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
32343         LDKCommitmentSigned this_ptr_conv;
32344         this_ptr_conv.inner = untag_ptr(this_ptr);
32345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32347         this_ptr_conv.is_owned = false;
32348         LDKSignature val_ref;
32349         CHECK(val->arr_len == 64);
32350         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32351         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
32352 }
32353
32354 ptrArray  __attribute__((export_name("TS_CommitmentSigned_get_htlc_signatures"))) TS_CommitmentSigned_get_htlc_signatures(uint64_t this_ptr) {
32355         LDKCommitmentSigned this_ptr_conv;
32356         this_ptr_conv.inner = untag_ptr(this_ptr);
32357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32359         this_ptr_conv.is_owned = false;
32360         LDKCVec_SignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
32361         ptrArray ret_arr = NULL;
32362         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
32363         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
32364         for (size_t m = 0; m < ret_var.datalen; m++) {
32365                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
32366                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
32367                 ret_arr_ptr[m] = ret_conv_12_arr;
32368         }
32369         
32370         FREE(ret_var.data);
32371         return ret_arr;
32372 }
32373
32374 void  __attribute__((export_name("TS_CommitmentSigned_set_htlc_signatures"))) TS_CommitmentSigned_set_htlc_signatures(uint64_t this_ptr, ptrArray val) {
32375         LDKCommitmentSigned this_ptr_conv;
32376         this_ptr_conv.inner = untag_ptr(this_ptr);
32377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32379         this_ptr_conv.is_owned = false;
32380         LDKCVec_SignatureZ val_constr;
32381         val_constr.datalen = val->arr_len;
32382         if (val_constr.datalen > 0)
32383                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
32384         else
32385                 val_constr.data = NULL;
32386         int8_tArray* val_vals = (void*) val->elems;
32387         for (size_t m = 0; m < val_constr.datalen; m++) {
32388                 int8_tArray val_conv_12 = val_vals[m];
32389                 LDKSignature val_conv_12_ref;
32390                 CHECK(val_conv_12->arr_len == 64);
32391                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
32392                 val_constr.data[m] = val_conv_12_ref;
32393         }
32394         FREE(val);
32395         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
32396 }
32397
32398 uint64_t  __attribute__((export_name("TS_CommitmentSigned_new"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
32399         LDKThirtyTwoBytes channel_id_arg_ref;
32400         CHECK(channel_id_arg->arr_len == 32);
32401         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
32402         LDKSignature signature_arg_ref;
32403         CHECK(signature_arg->arr_len == 64);
32404         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
32405         LDKCVec_SignatureZ htlc_signatures_arg_constr;
32406         htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
32407         if (htlc_signatures_arg_constr.datalen > 0)
32408                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
32409         else
32410                 htlc_signatures_arg_constr.data = NULL;
32411         int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
32412         for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
32413                 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
32414                 LDKSignature htlc_signatures_arg_conv_12_ref;
32415                 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
32416                 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64); FREE(htlc_signatures_arg_conv_12);
32417                 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
32418         }
32419         FREE(htlc_signatures_arg);
32420         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
32421         uint64_t ret_ref = 0;
32422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32424         return ret_ref;
32425 }
32426
32427 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
32428         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
32429         uint64_t ret_ref = 0;
32430         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32431         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32432         return ret_ref;
32433 }
32434 int64_t  __attribute__((export_name("TS_CommitmentSigned_clone_ptr"))) TS_CommitmentSigned_clone_ptr(uint64_t arg) {
32435         LDKCommitmentSigned arg_conv;
32436         arg_conv.inner = untag_ptr(arg);
32437         arg_conv.is_owned = ptr_is_owned(arg);
32438         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32439         arg_conv.is_owned = false;
32440         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
32441         return ret_conv;
32442 }
32443
32444 uint64_t  __attribute__((export_name("TS_CommitmentSigned_clone"))) TS_CommitmentSigned_clone(uint64_t orig) {
32445         LDKCommitmentSigned orig_conv;
32446         orig_conv.inner = untag_ptr(orig);
32447         orig_conv.is_owned = ptr_is_owned(orig);
32448         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32449         orig_conv.is_owned = false;
32450         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
32451         uint64_t ret_ref = 0;
32452         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32453         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32454         return ret_ref;
32455 }
32456
32457 jboolean  __attribute__((export_name("TS_CommitmentSigned_eq"))) TS_CommitmentSigned_eq(uint64_t a, uint64_t b) {
32458         LDKCommitmentSigned a_conv;
32459         a_conv.inner = untag_ptr(a);
32460         a_conv.is_owned = ptr_is_owned(a);
32461         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32462         a_conv.is_owned = false;
32463         LDKCommitmentSigned b_conv;
32464         b_conv.inner = untag_ptr(b);
32465         b_conv.is_owned = ptr_is_owned(b);
32466         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32467         b_conv.is_owned = false;
32468         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
32469         return ret_conv;
32470 }
32471
32472 void  __attribute__((export_name("TS_RevokeAndACK_free"))) TS_RevokeAndACK_free(uint64_t this_obj) {
32473         LDKRevokeAndACK this_obj_conv;
32474         this_obj_conv.inner = untag_ptr(this_obj);
32475         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32477         RevokeAndACK_free(this_obj_conv);
32478 }
32479
32480 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_channel_id"))) TS_RevokeAndACK_get_channel_id(uint64_t this_ptr) {
32481         LDKRevokeAndACK this_ptr_conv;
32482         this_ptr_conv.inner = untag_ptr(this_ptr);
32483         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32485         this_ptr_conv.is_owned = false;
32486         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32487         memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
32488         return ret_arr;
32489 }
32490
32491 void  __attribute__((export_name("TS_RevokeAndACK_set_channel_id"))) TS_RevokeAndACK_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32492         LDKRevokeAndACK this_ptr_conv;
32493         this_ptr_conv.inner = untag_ptr(this_ptr);
32494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32496         this_ptr_conv.is_owned = false;
32497         LDKThirtyTwoBytes val_ref;
32498         CHECK(val->arr_len == 32);
32499         memcpy(val_ref.data, val->elems, 32); FREE(val);
32500         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
32501 }
32502
32503 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_per_commitment_secret"))) TS_RevokeAndACK_get_per_commitment_secret(uint64_t this_ptr) {
32504         LDKRevokeAndACK this_ptr_conv;
32505         this_ptr_conv.inner = untag_ptr(this_ptr);
32506         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32508         this_ptr_conv.is_owned = false;
32509         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32510         memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
32511         return ret_arr;
32512 }
32513
32514 void  __attribute__((export_name("TS_RevokeAndACK_set_per_commitment_secret"))) TS_RevokeAndACK_set_per_commitment_secret(uint64_t this_ptr, int8_tArray val) {
32515         LDKRevokeAndACK this_ptr_conv;
32516         this_ptr_conv.inner = untag_ptr(this_ptr);
32517         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32519         this_ptr_conv.is_owned = false;
32520         LDKThirtyTwoBytes val_ref;
32521         CHECK(val->arr_len == 32);
32522         memcpy(val_ref.data, val->elems, 32); FREE(val);
32523         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
32524 }
32525
32526 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_next_per_commitment_point"))) TS_RevokeAndACK_get_next_per_commitment_point(uint64_t this_ptr) {
32527         LDKRevokeAndACK this_ptr_conv;
32528         this_ptr_conv.inner = untag_ptr(this_ptr);
32529         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32531         this_ptr_conv.is_owned = false;
32532         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32533         memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
32534         return ret_arr;
32535 }
32536
32537 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) {
32538         LDKRevokeAndACK this_ptr_conv;
32539         this_ptr_conv.inner = untag_ptr(this_ptr);
32540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32542         this_ptr_conv.is_owned = false;
32543         LDKPublicKey val_ref;
32544         CHECK(val->arr_len == 33);
32545         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32546         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
32547 }
32548
32549 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) {
32550         LDKThirtyTwoBytes channel_id_arg_ref;
32551         CHECK(channel_id_arg->arr_len == 32);
32552         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
32553         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
32554         CHECK(per_commitment_secret_arg->arr_len == 32);
32555         memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
32556         LDKPublicKey next_per_commitment_point_arg_ref;
32557         CHECK(next_per_commitment_point_arg->arr_len == 33);
32558         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
32559         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
32560         uint64_t ret_ref = 0;
32561         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32562         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32563         return ret_ref;
32564 }
32565
32566 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
32567         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
32568         uint64_t ret_ref = 0;
32569         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32570         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32571         return ret_ref;
32572 }
32573 int64_t  __attribute__((export_name("TS_RevokeAndACK_clone_ptr"))) TS_RevokeAndACK_clone_ptr(uint64_t arg) {
32574         LDKRevokeAndACK arg_conv;
32575         arg_conv.inner = untag_ptr(arg);
32576         arg_conv.is_owned = ptr_is_owned(arg);
32577         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32578         arg_conv.is_owned = false;
32579         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
32580         return ret_conv;
32581 }
32582
32583 uint64_t  __attribute__((export_name("TS_RevokeAndACK_clone"))) TS_RevokeAndACK_clone(uint64_t orig) {
32584         LDKRevokeAndACK orig_conv;
32585         orig_conv.inner = untag_ptr(orig);
32586         orig_conv.is_owned = ptr_is_owned(orig);
32587         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32588         orig_conv.is_owned = false;
32589         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
32590         uint64_t ret_ref = 0;
32591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32593         return ret_ref;
32594 }
32595
32596 jboolean  __attribute__((export_name("TS_RevokeAndACK_eq"))) TS_RevokeAndACK_eq(uint64_t a, uint64_t b) {
32597         LDKRevokeAndACK a_conv;
32598         a_conv.inner = untag_ptr(a);
32599         a_conv.is_owned = ptr_is_owned(a);
32600         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32601         a_conv.is_owned = false;
32602         LDKRevokeAndACK b_conv;
32603         b_conv.inner = untag_ptr(b);
32604         b_conv.is_owned = ptr_is_owned(b);
32605         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32606         b_conv.is_owned = false;
32607         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
32608         return ret_conv;
32609 }
32610
32611 void  __attribute__((export_name("TS_UpdateFee_free"))) TS_UpdateFee_free(uint64_t this_obj) {
32612         LDKUpdateFee this_obj_conv;
32613         this_obj_conv.inner = untag_ptr(this_obj);
32614         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32616         UpdateFee_free(this_obj_conv);
32617 }
32618
32619 int8_tArray  __attribute__((export_name("TS_UpdateFee_get_channel_id"))) TS_UpdateFee_get_channel_id(uint64_t this_ptr) {
32620         LDKUpdateFee this_ptr_conv;
32621         this_ptr_conv.inner = untag_ptr(this_ptr);
32622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32624         this_ptr_conv.is_owned = false;
32625         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32626         memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
32627         return ret_arr;
32628 }
32629
32630 void  __attribute__((export_name("TS_UpdateFee_set_channel_id"))) TS_UpdateFee_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32631         LDKUpdateFee this_ptr_conv;
32632         this_ptr_conv.inner = untag_ptr(this_ptr);
32633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32635         this_ptr_conv.is_owned = false;
32636         LDKThirtyTwoBytes val_ref;
32637         CHECK(val->arr_len == 32);
32638         memcpy(val_ref.data, val->elems, 32); FREE(val);
32639         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
32640 }
32641
32642 int32_t  __attribute__((export_name("TS_UpdateFee_get_feerate_per_kw"))) TS_UpdateFee_get_feerate_per_kw(uint64_t this_ptr) {
32643         LDKUpdateFee this_ptr_conv;
32644         this_ptr_conv.inner = untag_ptr(this_ptr);
32645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32647         this_ptr_conv.is_owned = false;
32648         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
32649         return ret_conv;
32650 }
32651
32652 void  __attribute__((export_name("TS_UpdateFee_set_feerate_per_kw"))) TS_UpdateFee_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
32653         LDKUpdateFee this_ptr_conv;
32654         this_ptr_conv.inner = untag_ptr(this_ptr);
32655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32657         this_ptr_conv.is_owned = false;
32658         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
32659 }
32660
32661 uint64_t  __attribute__((export_name("TS_UpdateFee_new"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
32662         LDKThirtyTwoBytes channel_id_arg_ref;
32663         CHECK(channel_id_arg->arr_len == 32);
32664         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
32665         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
32666         uint64_t ret_ref = 0;
32667         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32668         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32669         return ret_ref;
32670 }
32671
32672 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
32673         LDKUpdateFee ret_var = UpdateFee_clone(arg);
32674         uint64_t ret_ref = 0;
32675         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32676         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32677         return ret_ref;
32678 }
32679 int64_t  __attribute__((export_name("TS_UpdateFee_clone_ptr"))) TS_UpdateFee_clone_ptr(uint64_t arg) {
32680         LDKUpdateFee arg_conv;
32681         arg_conv.inner = untag_ptr(arg);
32682         arg_conv.is_owned = ptr_is_owned(arg);
32683         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32684         arg_conv.is_owned = false;
32685         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
32686         return ret_conv;
32687 }
32688
32689 uint64_t  __attribute__((export_name("TS_UpdateFee_clone"))) TS_UpdateFee_clone(uint64_t orig) {
32690         LDKUpdateFee orig_conv;
32691         orig_conv.inner = untag_ptr(orig);
32692         orig_conv.is_owned = ptr_is_owned(orig);
32693         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32694         orig_conv.is_owned = false;
32695         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
32696         uint64_t ret_ref = 0;
32697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32699         return ret_ref;
32700 }
32701
32702 jboolean  __attribute__((export_name("TS_UpdateFee_eq"))) TS_UpdateFee_eq(uint64_t a, uint64_t b) {
32703         LDKUpdateFee a_conv;
32704         a_conv.inner = untag_ptr(a);
32705         a_conv.is_owned = ptr_is_owned(a);
32706         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32707         a_conv.is_owned = false;
32708         LDKUpdateFee b_conv;
32709         b_conv.inner = untag_ptr(b);
32710         b_conv.is_owned = ptr_is_owned(b);
32711         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32712         b_conv.is_owned = false;
32713         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
32714         return ret_conv;
32715 }
32716
32717 void  __attribute__((export_name("TS_DataLossProtect_free"))) TS_DataLossProtect_free(uint64_t this_obj) {
32718         LDKDataLossProtect this_obj_conv;
32719         this_obj_conv.inner = untag_ptr(this_obj);
32720         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32722         DataLossProtect_free(this_obj_conv);
32723 }
32724
32725 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) {
32726         LDKDataLossProtect this_ptr_conv;
32727         this_ptr_conv.inner = untag_ptr(this_ptr);
32728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32730         this_ptr_conv.is_owned = false;
32731         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32732         memcpy(ret_arr->elems, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
32733         return ret_arr;
32734 }
32735
32736 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) {
32737         LDKDataLossProtect this_ptr_conv;
32738         this_ptr_conv.inner = untag_ptr(this_ptr);
32739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32741         this_ptr_conv.is_owned = false;
32742         LDKThirtyTwoBytes val_ref;
32743         CHECK(val->arr_len == 32);
32744         memcpy(val_ref.data, val->elems, 32); FREE(val);
32745         DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
32746 }
32747
32748 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) {
32749         LDKDataLossProtect this_ptr_conv;
32750         this_ptr_conv.inner = untag_ptr(this_ptr);
32751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32753         this_ptr_conv.is_owned = false;
32754         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32755         memcpy(ret_arr->elems, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
32756         return ret_arr;
32757 }
32758
32759 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) {
32760         LDKDataLossProtect this_ptr_conv;
32761         this_ptr_conv.inner = untag_ptr(this_ptr);
32762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32764         this_ptr_conv.is_owned = false;
32765         LDKPublicKey val_ref;
32766         CHECK(val->arr_len == 33);
32767         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32768         DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
32769 }
32770
32771 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) {
32772         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
32773         CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
32774         memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
32775         LDKPublicKey my_current_per_commitment_point_arg_ref;
32776         CHECK(my_current_per_commitment_point_arg->arr_len == 33);
32777         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);
32778         LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
32779         uint64_t ret_ref = 0;
32780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32782         return ret_ref;
32783 }
32784
32785 static inline uint64_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
32786         LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
32787         uint64_t ret_ref = 0;
32788         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32789         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32790         return ret_ref;
32791 }
32792 int64_t  __attribute__((export_name("TS_DataLossProtect_clone_ptr"))) TS_DataLossProtect_clone_ptr(uint64_t arg) {
32793         LDKDataLossProtect arg_conv;
32794         arg_conv.inner = untag_ptr(arg);
32795         arg_conv.is_owned = ptr_is_owned(arg);
32796         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32797         arg_conv.is_owned = false;
32798         int64_t ret_conv = DataLossProtect_clone_ptr(&arg_conv);
32799         return ret_conv;
32800 }
32801
32802 uint64_t  __attribute__((export_name("TS_DataLossProtect_clone"))) TS_DataLossProtect_clone(uint64_t orig) {
32803         LDKDataLossProtect orig_conv;
32804         orig_conv.inner = untag_ptr(orig);
32805         orig_conv.is_owned = ptr_is_owned(orig);
32806         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32807         orig_conv.is_owned = false;
32808         LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
32809         uint64_t ret_ref = 0;
32810         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32811         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32812         return ret_ref;
32813 }
32814
32815 jboolean  __attribute__((export_name("TS_DataLossProtect_eq"))) TS_DataLossProtect_eq(uint64_t a, uint64_t b) {
32816         LDKDataLossProtect a_conv;
32817         a_conv.inner = untag_ptr(a);
32818         a_conv.is_owned = ptr_is_owned(a);
32819         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32820         a_conv.is_owned = false;
32821         LDKDataLossProtect b_conv;
32822         b_conv.inner = untag_ptr(b);
32823         b_conv.is_owned = ptr_is_owned(b);
32824         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32825         b_conv.is_owned = false;
32826         jboolean ret_conv = DataLossProtect_eq(&a_conv, &b_conv);
32827         return ret_conv;
32828 }
32829
32830 void  __attribute__((export_name("TS_ChannelReestablish_free"))) TS_ChannelReestablish_free(uint64_t this_obj) {
32831         LDKChannelReestablish this_obj_conv;
32832         this_obj_conv.inner = untag_ptr(this_obj);
32833         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32835         ChannelReestablish_free(this_obj_conv);
32836 }
32837
32838 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_get_channel_id"))) TS_ChannelReestablish_get_channel_id(uint64_t this_ptr) {
32839         LDKChannelReestablish this_ptr_conv;
32840         this_ptr_conv.inner = untag_ptr(this_ptr);
32841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32843         this_ptr_conv.is_owned = false;
32844         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32845         memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
32846         return ret_arr;
32847 }
32848
32849 void  __attribute__((export_name("TS_ChannelReestablish_set_channel_id"))) TS_ChannelReestablish_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32850         LDKChannelReestablish this_ptr_conv;
32851         this_ptr_conv.inner = untag_ptr(this_ptr);
32852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32854         this_ptr_conv.is_owned = false;
32855         LDKThirtyTwoBytes val_ref;
32856         CHECK(val->arr_len == 32);
32857         memcpy(val_ref.data, val->elems, 32); FREE(val);
32858         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
32859 }
32860
32861 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_local_commitment_number"))) TS_ChannelReestablish_get_next_local_commitment_number(uint64_t this_ptr) {
32862         LDKChannelReestablish this_ptr_conv;
32863         this_ptr_conv.inner = untag_ptr(this_ptr);
32864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32866         this_ptr_conv.is_owned = false;
32867         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
32868         return ret_conv;
32869 }
32870
32871 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) {
32872         LDKChannelReestablish this_ptr_conv;
32873         this_ptr_conv.inner = untag_ptr(this_ptr);
32874         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32876         this_ptr_conv.is_owned = false;
32877         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
32878 }
32879
32880 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_remote_commitment_number"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint64_t this_ptr) {
32881         LDKChannelReestablish this_ptr_conv;
32882         this_ptr_conv.inner = untag_ptr(this_ptr);
32883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32885         this_ptr_conv.is_owned = false;
32886         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
32887         return ret_conv;
32888 }
32889
32890 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) {
32891         LDKChannelReestablish this_ptr_conv;
32892         this_ptr_conv.inner = untag_ptr(this_ptr);
32893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32895         this_ptr_conv.is_owned = false;
32896         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
32897 }
32898
32899 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
32900         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
32901         uint64_t ret_ref = 0;
32902         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32903         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32904         return ret_ref;
32905 }
32906 int64_t  __attribute__((export_name("TS_ChannelReestablish_clone_ptr"))) TS_ChannelReestablish_clone_ptr(uint64_t arg) {
32907         LDKChannelReestablish arg_conv;
32908         arg_conv.inner = untag_ptr(arg);
32909         arg_conv.is_owned = ptr_is_owned(arg);
32910         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32911         arg_conv.is_owned = false;
32912         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
32913         return ret_conv;
32914 }
32915
32916 uint64_t  __attribute__((export_name("TS_ChannelReestablish_clone"))) TS_ChannelReestablish_clone(uint64_t orig) {
32917         LDKChannelReestablish orig_conv;
32918         orig_conv.inner = untag_ptr(orig);
32919         orig_conv.is_owned = ptr_is_owned(orig);
32920         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32921         orig_conv.is_owned = false;
32922         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
32923         uint64_t ret_ref = 0;
32924         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32925         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32926         return ret_ref;
32927 }
32928
32929 jboolean  __attribute__((export_name("TS_ChannelReestablish_eq"))) TS_ChannelReestablish_eq(uint64_t a, uint64_t b) {
32930         LDKChannelReestablish a_conv;
32931         a_conv.inner = untag_ptr(a);
32932         a_conv.is_owned = ptr_is_owned(a);
32933         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
32934         a_conv.is_owned = false;
32935         LDKChannelReestablish b_conv;
32936         b_conv.inner = untag_ptr(b);
32937         b_conv.is_owned = ptr_is_owned(b);
32938         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
32939         b_conv.is_owned = false;
32940         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
32941         return ret_conv;
32942 }
32943
32944 void  __attribute__((export_name("TS_AnnouncementSignatures_free"))) TS_AnnouncementSignatures_free(uint64_t this_obj) {
32945         LDKAnnouncementSignatures this_obj_conv;
32946         this_obj_conv.inner = untag_ptr(this_obj);
32947         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32949         AnnouncementSignatures_free(this_obj_conv);
32950 }
32951
32952 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_channel_id"))) TS_AnnouncementSignatures_get_channel_id(uint64_t this_ptr) {
32953         LDKAnnouncementSignatures this_ptr_conv;
32954         this_ptr_conv.inner = untag_ptr(this_ptr);
32955         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32957         this_ptr_conv.is_owned = false;
32958         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32959         memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
32960         return ret_arr;
32961 }
32962
32963 void  __attribute__((export_name("TS_AnnouncementSignatures_set_channel_id"))) TS_AnnouncementSignatures_set_channel_id(uint64_t this_ptr, int8_tArray val) {
32964         LDKAnnouncementSignatures this_ptr_conv;
32965         this_ptr_conv.inner = untag_ptr(this_ptr);
32966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32968         this_ptr_conv.is_owned = false;
32969         LDKThirtyTwoBytes val_ref;
32970         CHECK(val->arr_len == 32);
32971         memcpy(val_ref.data, val->elems, 32); FREE(val);
32972         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
32973 }
32974
32975 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_get_short_channel_id"))) TS_AnnouncementSignatures_get_short_channel_id(uint64_t this_ptr) {
32976         LDKAnnouncementSignatures this_ptr_conv;
32977         this_ptr_conv.inner = untag_ptr(this_ptr);
32978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32980         this_ptr_conv.is_owned = false;
32981         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
32982         return ret_conv;
32983 }
32984
32985 void  __attribute__((export_name("TS_AnnouncementSignatures_set_short_channel_id"))) TS_AnnouncementSignatures_set_short_channel_id(uint64_t this_ptr, int64_t val) {
32986         LDKAnnouncementSignatures this_ptr_conv;
32987         this_ptr_conv.inner = untag_ptr(this_ptr);
32988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32990         this_ptr_conv.is_owned = false;
32991         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
32992 }
32993
32994 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_node_signature"))) TS_AnnouncementSignatures_get_node_signature(uint64_t this_ptr) {
32995         LDKAnnouncementSignatures this_ptr_conv;
32996         this_ptr_conv.inner = untag_ptr(this_ptr);
32997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32999         this_ptr_conv.is_owned = false;
33000         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
33001         memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
33002         return ret_arr;
33003 }
33004
33005 void  __attribute__((export_name("TS_AnnouncementSignatures_set_node_signature"))) TS_AnnouncementSignatures_set_node_signature(uint64_t this_ptr, int8_tArray val) {
33006         LDKAnnouncementSignatures this_ptr_conv;
33007         this_ptr_conv.inner = untag_ptr(this_ptr);
33008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33010         this_ptr_conv.is_owned = false;
33011         LDKSignature val_ref;
33012         CHECK(val->arr_len == 64);
33013         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
33014         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
33015 }
33016
33017 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_bitcoin_signature"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint64_t this_ptr) {
33018         LDKAnnouncementSignatures this_ptr_conv;
33019         this_ptr_conv.inner = untag_ptr(this_ptr);
33020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33022         this_ptr_conv.is_owned = false;
33023         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
33024         memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
33025         return ret_arr;
33026 }
33027
33028 void  __attribute__((export_name("TS_AnnouncementSignatures_set_bitcoin_signature"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint64_t this_ptr, int8_tArray val) {
33029         LDKAnnouncementSignatures this_ptr_conv;
33030         this_ptr_conv.inner = untag_ptr(this_ptr);
33031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33033         this_ptr_conv.is_owned = false;
33034         LDKSignature val_ref;
33035         CHECK(val->arr_len == 64);
33036         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
33037         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
33038 }
33039
33040 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) {
33041         LDKThirtyTwoBytes channel_id_arg_ref;
33042         CHECK(channel_id_arg->arr_len == 32);
33043         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
33044         LDKSignature node_signature_arg_ref;
33045         CHECK(node_signature_arg->arr_len == 64);
33046         memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
33047         LDKSignature bitcoin_signature_arg_ref;
33048         CHECK(bitcoin_signature_arg->arr_len == 64);
33049         memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
33050         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
33051         uint64_t ret_ref = 0;
33052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33054         return ret_ref;
33055 }
33056
33057 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
33058         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
33059         uint64_t ret_ref = 0;
33060         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33061         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33062         return ret_ref;
33063 }
33064 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone_ptr"))) TS_AnnouncementSignatures_clone_ptr(uint64_t arg) {
33065         LDKAnnouncementSignatures arg_conv;
33066         arg_conv.inner = untag_ptr(arg);
33067         arg_conv.is_owned = ptr_is_owned(arg);
33068         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33069         arg_conv.is_owned = false;
33070         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
33071         return ret_conv;
33072 }
33073
33074 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone"))) TS_AnnouncementSignatures_clone(uint64_t orig) {
33075         LDKAnnouncementSignatures orig_conv;
33076         orig_conv.inner = untag_ptr(orig);
33077         orig_conv.is_owned = ptr_is_owned(orig);
33078         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33079         orig_conv.is_owned = false;
33080         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
33081         uint64_t ret_ref = 0;
33082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33084         return ret_ref;
33085 }
33086
33087 jboolean  __attribute__((export_name("TS_AnnouncementSignatures_eq"))) TS_AnnouncementSignatures_eq(uint64_t a, uint64_t b) {
33088         LDKAnnouncementSignatures a_conv;
33089         a_conv.inner = untag_ptr(a);
33090         a_conv.is_owned = ptr_is_owned(a);
33091         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33092         a_conv.is_owned = false;
33093         LDKAnnouncementSignatures b_conv;
33094         b_conv.inner = untag_ptr(b);
33095         b_conv.is_owned = ptr_is_owned(b);
33096         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33097         b_conv.is_owned = false;
33098         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
33099         return ret_conv;
33100 }
33101
33102 void  __attribute__((export_name("TS_NetAddress_free"))) TS_NetAddress_free(uint64_t this_ptr) {
33103         if (!ptr_is_owned(this_ptr)) return;
33104         void* this_ptr_ptr = untag_ptr(this_ptr);
33105         CHECK_ACCESS(this_ptr_ptr);
33106         LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
33107         FREE(untag_ptr(this_ptr));
33108         NetAddress_free(this_ptr_conv);
33109 }
33110
33111 static inline uint64_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
33112         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33113         *ret_copy = NetAddress_clone(arg);
33114         uint64_t ret_ref = tag_ptr(ret_copy, true);
33115         return ret_ref;
33116 }
33117 int64_t  __attribute__((export_name("TS_NetAddress_clone_ptr"))) TS_NetAddress_clone_ptr(uint64_t arg) {
33118         LDKNetAddress* arg_conv = (LDKNetAddress*)untag_ptr(arg);
33119         int64_t ret_conv = NetAddress_clone_ptr(arg_conv);
33120         return ret_conv;
33121 }
33122
33123 uint64_t  __attribute__((export_name("TS_NetAddress_clone"))) TS_NetAddress_clone(uint64_t orig) {
33124         LDKNetAddress* orig_conv = (LDKNetAddress*)untag_ptr(orig);
33125         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33126         *ret_copy = NetAddress_clone(orig_conv);
33127         uint64_t ret_ref = tag_ptr(ret_copy, true);
33128         return ret_ref;
33129 }
33130
33131 uint64_t  __attribute__((export_name("TS_NetAddress_ipv4"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
33132         LDKFourBytes addr_ref;
33133         CHECK(addr->arr_len == 4);
33134         memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
33135         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33136         *ret_copy = NetAddress_ipv4(addr_ref, port);
33137         uint64_t ret_ref = tag_ptr(ret_copy, true);
33138         return ret_ref;
33139 }
33140
33141 uint64_t  __attribute__((export_name("TS_NetAddress_ipv6"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
33142         LDKSixteenBytes addr_ref;
33143         CHECK(addr->arr_len == 16);
33144         memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
33145         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33146         *ret_copy = NetAddress_ipv6(addr_ref, port);
33147         uint64_t ret_ref = tag_ptr(ret_copy, true);
33148         return ret_ref;
33149 }
33150
33151 uint64_t  __attribute__((export_name("TS_NetAddress_onion_v2"))) TS_NetAddress_onion_v2(int8_tArray a) {
33152         LDKTwelveBytes a_ref;
33153         CHECK(a->arr_len == 12);
33154         memcpy(a_ref.data, a->elems, 12); FREE(a);
33155         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33156         *ret_copy = NetAddress_onion_v2(a_ref);
33157         uint64_t ret_ref = tag_ptr(ret_copy, true);
33158         return ret_ref;
33159 }
33160
33161 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) {
33162         LDKThirtyTwoBytes ed25519_pubkey_ref;
33163         CHECK(ed25519_pubkey->arr_len == 32);
33164         memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
33165         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33166         *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
33167         uint64_t ret_ref = tag_ptr(ret_copy, true);
33168         return ret_ref;
33169 }
33170
33171 uint64_t  __attribute__((export_name("TS_NetAddress_hostname"))) TS_NetAddress_hostname(uint64_t hostname, int16_t port) {
33172         LDKHostname hostname_conv;
33173         hostname_conv.inner = untag_ptr(hostname);
33174         hostname_conv.is_owned = ptr_is_owned(hostname);
33175         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
33176         hostname_conv = Hostname_clone(&hostname_conv);
33177         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33178         *ret_copy = NetAddress_hostname(hostname_conv, port);
33179         uint64_t ret_ref = tag_ptr(ret_copy, true);
33180         return ret_ref;
33181 }
33182
33183 jboolean  __attribute__((export_name("TS_NetAddress_eq"))) TS_NetAddress_eq(uint64_t a, uint64_t b) {
33184         LDKNetAddress* a_conv = (LDKNetAddress*)untag_ptr(a);
33185         LDKNetAddress* b_conv = (LDKNetAddress*)untag_ptr(b);
33186         jboolean ret_conv = NetAddress_eq(a_conv, b_conv);
33187         return ret_conv;
33188 }
33189
33190 int8_tArray  __attribute__((export_name("TS_NetAddress_write"))) TS_NetAddress_write(uint64_t obj) {
33191         LDKNetAddress* obj_conv = (LDKNetAddress*)untag_ptr(obj);
33192         LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
33193         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33194         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33195         CVec_u8Z_free(ret_var);
33196         return ret_arr;
33197 }
33198
33199 uint64_t  __attribute__((export_name("TS_NetAddress_read"))) TS_NetAddress_read(int8_tArray ser) {
33200         LDKu8slice ser_ref;
33201         ser_ref.datalen = ser->arr_len;
33202         ser_ref.data = ser->elems;
33203         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
33204         *ret_conv = NetAddress_read(ser_ref);
33205         FREE(ser);
33206         return tag_ptr(ret_conv, true);
33207 }
33208
33209 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint64_t this_obj) {
33210         LDKUnsignedNodeAnnouncement this_obj_conv;
33211         this_obj_conv.inner = untag_ptr(this_obj);
33212         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33214         UnsignedNodeAnnouncement_free(this_obj_conv);
33215 }
33216
33217 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_features"))) TS_UnsignedNodeAnnouncement_get_features(uint64_t this_ptr) {
33218         LDKUnsignedNodeAnnouncement this_ptr_conv;
33219         this_ptr_conv.inner = untag_ptr(this_ptr);
33220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33222         this_ptr_conv.is_owned = false;
33223         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
33224         uint64_t ret_ref = 0;
33225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33227         return ret_ref;
33228 }
33229
33230 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_features"))) TS_UnsignedNodeAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
33231         LDKUnsignedNodeAnnouncement this_ptr_conv;
33232         this_ptr_conv.inner = untag_ptr(this_ptr);
33233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33235         this_ptr_conv.is_owned = false;
33236         LDKNodeFeatures val_conv;
33237         val_conv.inner = untag_ptr(val);
33238         val_conv.is_owned = ptr_is_owned(val);
33239         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33240         val_conv = NodeFeatures_clone(&val_conv);
33241         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
33242 }
33243
33244 int32_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_timestamp"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint64_t this_ptr) {
33245         LDKUnsignedNodeAnnouncement this_ptr_conv;
33246         this_ptr_conv.inner = untag_ptr(this_ptr);
33247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33249         this_ptr_conv.is_owned = false;
33250         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
33251         return ret_conv;
33252 }
33253
33254 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint64_t this_ptr, int32_t val) {
33255         LDKUnsignedNodeAnnouncement this_ptr_conv;
33256         this_ptr_conv.inner = untag_ptr(this_ptr);
33257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33259         this_ptr_conv.is_owned = false;
33260         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
33261 }
33262
33263 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint64_t this_ptr) {
33264         LDKUnsignedNodeAnnouncement this_ptr_conv;
33265         this_ptr_conv.inner = untag_ptr(this_ptr);
33266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33268         this_ptr_conv.is_owned = false;
33269         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33270         memcpy(ret_arr->elems, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
33271         return ret_arr;
33272 }
33273
33274 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint64_t this_ptr, int8_tArray val) {
33275         LDKUnsignedNodeAnnouncement this_ptr_conv;
33276         this_ptr_conv.inner = untag_ptr(this_ptr);
33277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33279         this_ptr_conv.is_owned = false;
33280         LDKPublicKey val_ref;
33281         CHECK(val->arr_len == 33);
33282         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33283         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
33284 }
33285
33286 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint64_t this_ptr) {
33287         LDKUnsignedNodeAnnouncement this_ptr_conv;
33288         this_ptr_conv.inner = untag_ptr(this_ptr);
33289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33291         this_ptr_conv.is_owned = false;
33292         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
33293         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
33294         return ret_arr;
33295 }
33296
33297 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_rgb"))) TS_UnsignedNodeAnnouncement_set_rgb(uint64_t this_ptr, int8_tArray val) {
33298         LDKUnsignedNodeAnnouncement this_ptr_conv;
33299         this_ptr_conv.inner = untag_ptr(this_ptr);
33300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33302         this_ptr_conv.is_owned = false;
33303         LDKThreeBytes val_ref;
33304         CHECK(val->arr_len == 3);
33305         memcpy(val_ref.data, val->elems, 3); FREE(val);
33306         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
33307 }
33308
33309 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_alias"))) TS_UnsignedNodeAnnouncement_get_alias(uint64_t this_ptr) {
33310         LDKUnsignedNodeAnnouncement this_ptr_conv;
33311         this_ptr_conv.inner = untag_ptr(this_ptr);
33312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33314         this_ptr_conv.is_owned = false;
33315         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33316         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
33317         return ret_arr;
33318 }
33319
33320 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_alias"))) TS_UnsignedNodeAnnouncement_set_alias(uint64_t this_ptr, int8_tArray val) {
33321         LDKUnsignedNodeAnnouncement this_ptr_conv;
33322         this_ptr_conv.inner = untag_ptr(this_ptr);
33323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33325         this_ptr_conv.is_owned = false;
33326         LDKThirtyTwoBytes val_ref;
33327         CHECK(val->arr_len == 32);
33328         memcpy(val_ref.data, val->elems, 32); FREE(val);
33329         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
33330 }
33331
33332 uint64_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_addresses"))) TS_UnsignedNodeAnnouncement_get_addresses(uint64_t this_ptr) {
33333         LDKUnsignedNodeAnnouncement this_ptr_conv;
33334         this_ptr_conv.inner = untag_ptr(this_ptr);
33335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33337         this_ptr_conv.is_owned = false;
33338         LDKCVec_NetAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
33339         uint64_tArray ret_arr = NULL;
33340         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
33341         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
33342         for (size_t m = 0; m < ret_var.datalen; m++) {
33343                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
33344                 *ret_conv_12_copy = ret_var.data[m];
33345                 uint64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
33346                 ret_arr_ptr[m] = ret_conv_12_ref;
33347         }
33348         
33349         FREE(ret_var.data);
33350         return ret_arr;
33351 }
33352
33353 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_addresses"))) TS_UnsignedNodeAnnouncement_set_addresses(uint64_t this_ptr, uint64_tArray val) {
33354         LDKUnsignedNodeAnnouncement this_ptr_conv;
33355         this_ptr_conv.inner = untag_ptr(this_ptr);
33356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33358         this_ptr_conv.is_owned = false;
33359         LDKCVec_NetAddressZ val_constr;
33360         val_constr.datalen = val->arr_len;
33361         if (val_constr.datalen > 0)
33362                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
33363         else
33364                 val_constr.data = NULL;
33365         uint64_t* val_vals = val->elems;
33366         for (size_t m = 0; m < val_constr.datalen; m++) {
33367                 uint64_t val_conv_12 = val_vals[m];
33368                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
33369                 CHECK_ACCESS(val_conv_12_ptr);
33370                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
33371                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
33372                 val_constr.data[m] = val_conv_12_conv;
33373         }
33374         FREE(val);
33375         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
33376 }
33377
33378 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
33379         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
33380         uint64_t ret_ref = 0;
33381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33383         return ret_ref;
33384 }
33385 int64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone_ptr"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint64_t arg) {
33386         LDKUnsignedNodeAnnouncement arg_conv;
33387         arg_conv.inner = untag_ptr(arg);
33388         arg_conv.is_owned = ptr_is_owned(arg);
33389         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33390         arg_conv.is_owned = false;
33391         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
33392         return ret_conv;
33393 }
33394
33395 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone"))) TS_UnsignedNodeAnnouncement_clone(uint64_t orig) {
33396         LDKUnsignedNodeAnnouncement orig_conv;
33397         orig_conv.inner = untag_ptr(orig);
33398         orig_conv.is_owned = ptr_is_owned(orig);
33399         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33400         orig_conv.is_owned = false;
33401         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
33402         uint64_t ret_ref = 0;
33403         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33404         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33405         return ret_ref;
33406 }
33407
33408 jboolean  __attribute__((export_name("TS_UnsignedNodeAnnouncement_eq"))) TS_UnsignedNodeAnnouncement_eq(uint64_t a, uint64_t b) {
33409         LDKUnsignedNodeAnnouncement a_conv;
33410         a_conv.inner = untag_ptr(a);
33411         a_conv.is_owned = ptr_is_owned(a);
33412         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33413         a_conv.is_owned = false;
33414         LDKUnsignedNodeAnnouncement b_conv;
33415         b_conv.inner = untag_ptr(b);
33416         b_conv.is_owned = ptr_is_owned(b);
33417         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33418         b_conv.is_owned = false;
33419         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
33420         return ret_conv;
33421 }
33422
33423 void  __attribute__((export_name("TS_NodeAnnouncement_free"))) TS_NodeAnnouncement_free(uint64_t this_obj) {
33424         LDKNodeAnnouncement this_obj_conv;
33425         this_obj_conv.inner = untag_ptr(this_obj);
33426         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33428         NodeAnnouncement_free(this_obj_conv);
33429 }
33430
33431 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_get_signature"))) TS_NodeAnnouncement_get_signature(uint64_t this_ptr) {
33432         LDKNodeAnnouncement this_ptr_conv;
33433         this_ptr_conv.inner = untag_ptr(this_ptr);
33434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33436         this_ptr_conv.is_owned = false;
33437         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
33438         memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
33439         return ret_arr;
33440 }
33441
33442 void  __attribute__((export_name("TS_NodeAnnouncement_set_signature"))) TS_NodeAnnouncement_set_signature(uint64_t this_ptr, int8_tArray val) {
33443         LDKNodeAnnouncement this_ptr_conv;
33444         this_ptr_conv.inner = untag_ptr(this_ptr);
33445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33447         this_ptr_conv.is_owned = false;
33448         LDKSignature val_ref;
33449         CHECK(val->arr_len == 64);
33450         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
33451         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
33452 }
33453
33454 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_get_contents"))) TS_NodeAnnouncement_get_contents(uint64_t this_ptr) {
33455         LDKNodeAnnouncement this_ptr_conv;
33456         this_ptr_conv.inner = untag_ptr(this_ptr);
33457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33459         this_ptr_conv.is_owned = false;
33460         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
33461         uint64_t ret_ref = 0;
33462         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33463         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33464         return ret_ref;
33465 }
33466
33467 void  __attribute__((export_name("TS_NodeAnnouncement_set_contents"))) TS_NodeAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
33468         LDKNodeAnnouncement this_ptr_conv;
33469         this_ptr_conv.inner = untag_ptr(this_ptr);
33470         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33472         this_ptr_conv.is_owned = false;
33473         LDKUnsignedNodeAnnouncement val_conv;
33474         val_conv.inner = untag_ptr(val);
33475         val_conv.is_owned = ptr_is_owned(val);
33476         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33477         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
33478         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
33479 }
33480
33481 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_new"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint64_t contents_arg) {
33482         LDKSignature signature_arg_ref;
33483         CHECK(signature_arg->arr_len == 64);
33484         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
33485         LDKUnsignedNodeAnnouncement contents_arg_conv;
33486         contents_arg_conv.inner = untag_ptr(contents_arg);
33487         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
33488         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
33489         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
33490         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
33491         uint64_t ret_ref = 0;
33492         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33493         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33494         return ret_ref;
33495 }
33496
33497 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
33498         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
33499         uint64_t ret_ref = 0;
33500         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33501         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33502         return ret_ref;
33503 }
33504 int64_t  __attribute__((export_name("TS_NodeAnnouncement_clone_ptr"))) TS_NodeAnnouncement_clone_ptr(uint64_t arg) {
33505         LDKNodeAnnouncement arg_conv;
33506         arg_conv.inner = untag_ptr(arg);
33507         arg_conv.is_owned = ptr_is_owned(arg);
33508         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33509         arg_conv.is_owned = false;
33510         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
33511         return ret_conv;
33512 }
33513
33514 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_clone"))) TS_NodeAnnouncement_clone(uint64_t orig) {
33515         LDKNodeAnnouncement orig_conv;
33516         orig_conv.inner = untag_ptr(orig);
33517         orig_conv.is_owned = ptr_is_owned(orig);
33518         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33519         orig_conv.is_owned = false;
33520         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
33521         uint64_t ret_ref = 0;
33522         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33523         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33524         return ret_ref;
33525 }
33526
33527 jboolean  __attribute__((export_name("TS_NodeAnnouncement_eq"))) TS_NodeAnnouncement_eq(uint64_t a, uint64_t b) {
33528         LDKNodeAnnouncement a_conv;
33529         a_conv.inner = untag_ptr(a);
33530         a_conv.is_owned = ptr_is_owned(a);
33531         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33532         a_conv.is_owned = false;
33533         LDKNodeAnnouncement b_conv;
33534         b_conv.inner = untag_ptr(b);
33535         b_conv.is_owned = ptr_is_owned(b);
33536         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33537         b_conv.is_owned = false;
33538         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
33539         return ret_conv;
33540 }
33541
33542 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_free"))) TS_UnsignedChannelAnnouncement_free(uint64_t this_obj) {
33543         LDKUnsignedChannelAnnouncement this_obj_conv;
33544         this_obj_conv.inner = untag_ptr(this_obj);
33545         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33547         UnsignedChannelAnnouncement_free(this_obj_conv);
33548 }
33549
33550 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_features"))) TS_UnsignedChannelAnnouncement_get_features(uint64_t this_ptr) {
33551         LDKUnsignedChannelAnnouncement this_ptr_conv;
33552         this_ptr_conv.inner = untag_ptr(this_ptr);
33553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33555         this_ptr_conv.is_owned = false;
33556         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
33557         uint64_t ret_ref = 0;
33558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33560         return ret_ref;
33561 }
33562
33563 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_features"))) TS_UnsignedChannelAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
33564         LDKUnsignedChannelAnnouncement this_ptr_conv;
33565         this_ptr_conv.inner = untag_ptr(this_ptr);
33566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33568         this_ptr_conv.is_owned = false;
33569         LDKChannelFeatures val_conv;
33570         val_conv.inner = untag_ptr(val);
33571         val_conv.is_owned = ptr_is_owned(val);
33572         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33573         val_conv = ChannelFeatures_clone(&val_conv);
33574         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
33575 }
33576
33577 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_chain_hash"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint64_t this_ptr) {
33578         LDKUnsignedChannelAnnouncement this_ptr_conv;
33579         this_ptr_conv.inner = untag_ptr(this_ptr);
33580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33582         this_ptr_conv.is_owned = false;
33583         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33584         memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
33585         return ret_arr;
33586 }
33587
33588 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_chain_hash"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
33589         LDKUnsignedChannelAnnouncement this_ptr_conv;
33590         this_ptr_conv.inner = untag_ptr(this_ptr);
33591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33593         this_ptr_conv.is_owned = false;
33594         LDKThirtyTwoBytes val_ref;
33595         CHECK(val->arr_len == 32);
33596         memcpy(val_ref.data, val->elems, 32); FREE(val);
33597         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
33598 }
33599
33600 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_short_channel_id"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint64_t this_ptr) {
33601         LDKUnsignedChannelAnnouncement this_ptr_conv;
33602         this_ptr_conv.inner = untag_ptr(this_ptr);
33603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33605         this_ptr_conv.is_owned = false;
33606         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
33607         return ret_conv;
33608 }
33609
33610 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_channel_id"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint64_t this_ptr, int64_t val) {
33611         LDKUnsignedChannelAnnouncement this_ptr_conv;
33612         this_ptr_conv.inner = untag_ptr(this_ptr);
33613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33615         this_ptr_conv.is_owned = false;
33616         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
33617 }
33618
33619 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint64_t this_ptr) {
33620         LDKUnsignedChannelAnnouncement this_ptr_conv;
33621         this_ptr_conv.inner = untag_ptr(this_ptr);
33622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33624         this_ptr_conv.is_owned = false;
33625         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33626         memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
33627         return ret_arr;
33628 }
33629
33630 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint64_t this_ptr, int8_tArray val) {
33631         LDKUnsignedChannelAnnouncement this_ptr_conv;
33632         this_ptr_conv.inner = untag_ptr(this_ptr);
33633         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33635         this_ptr_conv.is_owned = false;
33636         LDKPublicKey val_ref;
33637         CHECK(val->arr_len == 33);
33638         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33639         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
33640 }
33641
33642 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint64_t this_ptr) {
33643         LDKUnsignedChannelAnnouncement this_ptr_conv;
33644         this_ptr_conv.inner = untag_ptr(this_ptr);
33645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33647         this_ptr_conv.is_owned = false;
33648         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33649         memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
33650         return ret_arr;
33651 }
33652
33653 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint64_t this_ptr, int8_tArray val) {
33654         LDKUnsignedChannelAnnouncement this_ptr_conv;
33655         this_ptr_conv.inner = untag_ptr(this_ptr);
33656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33658         this_ptr_conv.is_owned = false;
33659         LDKPublicKey val_ref;
33660         CHECK(val->arr_len == 33);
33661         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33662         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
33663 }
33664
33665 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint64_t this_ptr) {
33666         LDKUnsignedChannelAnnouncement this_ptr_conv;
33667         this_ptr_conv.inner = untag_ptr(this_ptr);
33668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33670         this_ptr_conv.is_owned = false;
33671         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33672         memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
33673         return ret_arr;
33674 }
33675
33676 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint64_t this_ptr, int8_tArray val) {
33677         LDKUnsignedChannelAnnouncement this_ptr_conv;
33678         this_ptr_conv.inner = untag_ptr(this_ptr);
33679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33681         this_ptr_conv.is_owned = false;
33682         LDKPublicKey val_ref;
33683         CHECK(val->arr_len == 33);
33684         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33685         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
33686 }
33687
33688 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint64_t this_ptr) {
33689         LDKUnsignedChannelAnnouncement this_ptr_conv;
33690         this_ptr_conv.inner = untag_ptr(this_ptr);
33691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33693         this_ptr_conv.is_owned = false;
33694         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33695         memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
33696         return ret_arr;
33697 }
33698
33699 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint64_t this_ptr, int8_tArray val) {
33700         LDKUnsignedChannelAnnouncement this_ptr_conv;
33701         this_ptr_conv.inner = untag_ptr(this_ptr);
33702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33704         this_ptr_conv.is_owned = false;
33705         LDKPublicKey val_ref;
33706         CHECK(val->arr_len == 33);
33707         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
33708         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
33709 }
33710
33711 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
33712         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
33713         uint64_t ret_ref = 0;
33714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33716         return ret_ref;
33717 }
33718 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone_ptr"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint64_t arg) {
33719         LDKUnsignedChannelAnnouncement arg_conv;
33720         arg_conv.inner = untag_ptr(arg);
33721         arg_conv.is_owned = ptr_is_owned(arg);
33722         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33723         arg_conv.is_owned = false;
33724         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
33725         return ret_conv;
33726 }
33727
33728 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone"))) TS_UnsignedChannelAnnouncement_clone(uint64_t orig) {
33729         LDKUnsignedChannelAnnouncement orig_conv;
33730         orig_conv.inner = untag_ptr(orig);
33731         orig_conv.is_owned = ptr_is_owned(orig);
33732         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33733         orig_conv.is_owned = false;
33734         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
33735         uint64_t ret_ref = 0;
33736         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33737         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33738         return ret_ref;
33739 }
33740
33741 jboolean  __attribute__((export_name("TS_UnsignedChannelAnnouncement_eq"))) TS_UnsignedChannelAnnouncement_eq(uint64_t a, uint64_t b) {
33742         LDKUnsignedChannelAnnouncement a_conv;
33743         a_conv.inner = untag_ptr(a);
33744         a_conv.is_owned = ptr_is_owned(a);
33745         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33746         a_conv.is_owned = false;
33747         LDKUnsignedChannelAnnouncement b_conv;
33748         b_conv.inner = untag_ptr(b);
33749         b_conv.is_owned = ptr_is_owned(b);
33750         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33751         b_conv.is_owned = false;
33752         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
33753         return ret_conv;
33754 }
33755
33756 void  __attribute__((export_name("TS_ChannelAnnouncement_free"))) TS_ChannelAnnouncement_free(uint64_t this_obj) {
33757         LDKChannelAnnouncement this_obj_conv;
33758         this_obj_conv.inner = untag_ptr(this_obj);
33759         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33761         ChannelAnnouncement_free(this_obj_conv);
33762 }
33763
33764 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_1"))) TS_ChannelAnnouncement_get_node_signature_1(uint64_t this_ptr) {
33765         LDKChannelAnnouncement this_ptr_conv;
33766         this_ptr_conv.inner = untag_ptr(this_ptr);
33767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33769         this_ptr_conv.is_owned = false;
33770         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
33771         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
33772         return ret_arr;
33773 }
33774
33775 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_1"))) TS_ChannelAnnouncement_set_node_signature_1(uint64_t this_ptr, int8_tArray val) {
33776         LDKChannelAnnouncement this_ptr_conv;
33777         this_ptr_conv.inner = untag_ptr(this_ptr);
33778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33780         this_ptr_conv.is_owned = false;
33781         LDKSignature val_ref;
33782         CHECK(val->arr_len == 64);
33783         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
33784         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
33785 }
33786
33787 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_2"))) TS_ChannelAnnouncement_get_node_signature_2(uint64_t this_ptr) {
33788         LDKChannelAnnouncement this_ptr_conv;
33789         this_ptr_conv.inner = untag_ptr(this_ptr);
33790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33792         this_ptr_conv.is_owned = false;
33793         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
33794         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
33795         return ret_arr;
33796 }
33797
33798 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_2"))) TS_ChannelAnnouncement_set_node_signature_2(uint64_t this_ptr, int8_tArray val) {
33799         LDKChannelAnnouncement this_ptr_conv;
33800         this_ptr_conv.inner = untag_ptr(this_ptr);
33801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33803         this_ptr_conv.is_owned = false;
33804         LDKSignature val_ref;
33805         CHECK(val->arr_len == 64);
33806         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
33807         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
33808 }
33809
33810 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_1"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint64_t this_ptr) {
33811         LDKChannelAnnouncement this_ptr_conv;
33812         this_ptr_conv.inner = untag_ptr(this_ptr);
33813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33815         this_ptr_conv.is_owned = false;
33816         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
33817         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
33818         return ret_arr;
33819 }
33820
33821 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_1"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint64_t this_ptr, int8_tArray val) {
33822         LDKChannelAnnouncement this_ptr_conv;
33823         this_ptr_conv.inner = untag_ptr(this_ptr);
33824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33826         this_ptr_conv.is_owned = false;
33827         LDKSignature val_ref;
33828         CHECK(val->arr_len == 64);
33829         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
33830         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
33831 }
33832
33833 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_2"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint64_t this_ptr) {
33834         LDKChannelAnnouncement this_ptr_conv;
33835         this_ptr_conv.inner = untag_ptr(this_ptr);
33836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33838         this_ptr_conv.is_owned = false;
33839         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
33840         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
33841         return ret_arr;
33842 }
33843
33844 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_2"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint64_t this_ptr, int8_tArray val) {
33845         LDKChannelAnnouncement this_ptr_conv;
33846         this_ptr_conv.inner = untag_ptr(this_ptr);
33847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33849         this_ptr_conv.is_owned = false;
33850         LDKSignature val_ref;
33851         CHECK(val->arr_len == 64);
33852         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
33853         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
33854 }
33855
33856 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_get_contents"))) TS_ChannelAnnouncement_get_contents(uint64_t this_ptr) {
33857         LDKChannelAnnouncement this_ptr_conv;
33858         this_ptr_conv.inner = untag_ptr(this_ptr);
33859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33861         this_ptr_conv.is_owned = false;
33862         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
33863         uint64_t ret_ref = 0;
33864         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33865         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33866         return ret_ref;
33867 }
33868
33869 void  __attribute__((export_name("TS_ChannelAnnouncement_set_contents"))) TS_ChannelAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
33870         LDKChannelAnnouncement this_ptr_conv;
33871         this_ptr_conv.inner = untag_ptr(this_ptr);
33872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33874         this_ptr_conv.is_owned = false;
33875         LDKUnsignedChannelAnnouncement val_conv;
33876         val_conv.inner = untag_ptr(val);
33877         val_conv.is_owned = ptr_is_owned(val);
33878         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33879         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
33880         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
33881 }
33882
33883 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) {
33884         LDKSignature node_signature_1_arg_ref;
33885         CHECK(node_signature_1_arg->arr_len == 64);
33886         memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
33887         LDKSignature node_signature_2_arg_ref;
33888         CHECK(node_signature_2_arg->arr_len == 64);
33889         memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
33890         LDKSignature bitcoin_signature_1_arg_ref;
33891         CHECK(bitcoin_signature_1_arg->arr_len == 64);
33892         memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
33893         LDKSignature bitcoin_signature_2_arg_ref;
33894         CHECK(bitcoin_signature_2_arg->arr_len == 64);
33895         memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
33896         LDKUnsignedChannelAnnouncement contents_arg_conv;
33897         contents_arg_conv.inner = untag_ptr(contents_arg);
33898         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
33899         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
33900         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
33901         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);
33902         uint64_t ret_ref = 0;
33903         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33904         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33905         return ret_ref;
33906 }
33907
33908 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
33909         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
33910         uint64_t ret_ref = 0;
33911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33913         return ret_ref;
33914 }
33915 int64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone_ptr"))) TS_ChannelAnnouncement_clone_ptr(uint64_t arg) {
33916         LDKChannelAnnouncement arg_conv;
33917         arg_conv.inner = untag_ptr(arg);
33918         arg_conv.is_owned = ptr_is_owned(arg);
33919         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33920         arg_conv.is_owned = false;
33921         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
33922         return ret_conv;
33923 }
33924
33925 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone"))) TS_ChannelAnnouncement_clone(uint64_t orig) {
33926         LDKChannelAnnouncement orig_conv;
33927         orig_conv.inner = untag_ptr(orig);
33928         orig_conv.is_owned = ptr_is_owned(orig);
33929         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33930         orig_conv.is_owned = false;
33931         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
33932         uint64_t ret_ref = 0;
33933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33935         return ret_ref;
33936 }
33937
33938 jboolean  __attribute__((export_name("TS_ChannelAnnouncement_eq"))) TS_ChannelAnnouncement_eq(uint64_t a, uint64_t b) {
33939         LDKChannelAnnouncement a_conv;
33940         a_conv.inner = untag_ptr(a);
33941         a_conv.is_owned = ptr_is_owned(a);
33942         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
33943         a_conv.is_owned = false;
33944         LDKChannelAnnouncement b_conv;
33945         b_conv.inner = untag_ptr(b);
33946         b_conv.is_owned = ptr_is_owned(b);
33947         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
33948         b_conv.is_owned = false;
33949         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
33950         return ret_conv;
33951 }
33952
33953 void  __attribute__((export_name("TS_UnsignedChannelUpdate_free"))) TS_UnsignedChannelUpdate_free(uint64_t this_obj) {
33954         LDKUnsignedChannelUpdate this_obj_conv;
33955         this_obj_conv.inner = untag_ptr(this_obj);
33956         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33958         UnsignedChannelUpdate_free(this_obj_conv);
33959 }
33960
33961 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_chain_hash"))) TS_UnsignedChannelUpdate_get_chain_hash(uint64_t this_ptr) {
33962         LDKUnsignedChannelUpdate this_ptr_conv;
33963         this_ptr_conv.inner = untag_ptr(this_ptr);
33964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33966         this_ptr_conv.is_owned = false;
33967         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33968         memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
33969         return ret_arr;
33970 }
33971
33972 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_chain_hash"))) TS_UnsignedChannelUpdate_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
33973         LDKUnsignedChannelUpdate this_ptr_conv;
33974         this_ptr_conv.inner = untag_ptr(this_ptr);
33975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33977         this_ptr_conv.is_owned = false;
33978         LDKThirtyTwoBytes val_ref;
33979         CHECK(val->arr_len == 32);
33980         memcpy(val_ref.data, val->elems, 32); FREE(val);
33981         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
33982 }
33983
33984 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_short_channel_id"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint64_t this_ptr) {
33985         LDKUnsignedChannelUpdate this_ptr_conv;
33986         this_ptr_conv.inner = untag_ptr(this_ptr);
33987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33989         this_ptr_conv.is_owned = false;
33990         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
33991         return ret_conv;
33992 }
33993
33994 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_short_channel_id"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint64_t this_ptr, int64_t val) {
33995         LDKUnsignedChannelUpdate this_ptr_conv;
33996         this_ptr_conv.inner = untag_ptr(this_ptr);
33997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33999         this_ptr_conv.is_owned = false;
34000         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
34001 }
34002
34003 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_timestamp"))) TS_UnsignedChannelUpdate_get_timestamp(uint64_t this_ptr) {
34004         LDKUnsignedChannelUpdate this_ptr_conv;
34005         this_ptr_conv.inner = untag_ptr(this_ptr);
34006         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34008         this_ptr_conv.is_owned = false;
34009         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
34010         return ret_conv;
34011 }
34012
34013 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_timestamp"))) TS_UnsignedChannelUpdate_set_timestamp(uint64_t this_ptr, int32_t val) {
34014         LDKUnsignedChannelUpdate this_ptr_conv;
34015         this_ptr_conv.inner = untag_ptr(this_ptr);
34016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34018         this_ptr_conv.is_owned = false;
34019         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
34020 }
34021
34022 int8_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_flags"))) TS_UnsignedChannelUpdate_get_flags(uint64_t this_ptr) {
34023         LDKUnsignedChannelUpdate this_ptr_conv;
34024         this_ptr_conv.inner = untag_ptr(this_ptr);
34025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34027         this_ptr_conv.is_owned = false;
34028         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
34029         return ret_conv;
34030 }
34031
34032 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_flags"))) TS_UnsignedChannelUpdate_set_flags(uint64_t this_ptr, int8_t val) {
34033         LDKUnsignedChannelUpdate this_ptr_conv;
34034         this_ptr_conv.inner = untag_ptr(this_ptr);
34035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34037         this_ptr_conv.is_owned = false;
34038         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
34039 }
34040
34041 int16_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
34042         LDKUnsignedChannelUpdate this_ptr_conv;
34043         this_ptr_conv.inner = untag_ptr(this_ptr);
34044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34046         this_ptr_conv.is_owned = false;
34047         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
34048         return ret_conv;
34049 }
34050
34051 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
34052         LDKUnsignedChannelUpdate this_ptr_conv;
34053         this_ptr_conv.inner = untag_ptr(this_ptr);
34054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34056         this_ptr_conv.is_owned = false;
34057         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
34058 }
34059
34060 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint64_t this_ptr) {
34061         LDKUnsignedChannelUpdate this_ptr_conv;
34062         this_ptr_conv.inner = untag_ptr(this_ptr);
34063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34065         this_ptr_conv.is_owned = false;
34066         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
34067         return ret_conv;
34068 }
34069
34070 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
34071         LDKUnsignedChannelUpdate this_ptr_conv;
34072         this_ptr_conv.inner = untag_ptr(this_ptr);
34073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34075         this_ptr_conv.is_owned = false;
34076         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
34077 }
34078
34079 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_get_htlc_maximum_msat(uint64_t this_ptr) {
34080         LDKUnsignedChannelUpdate this_ptr_conv;
34081         this_ptr_conv.inner = untag_ptr(this_ptr);
34082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34084         this_ptr_conv.is_owned = false;
34085         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
34086         return ret_conv;
34087 }
34088
34089 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
34090         LDKUnsignedChannelUpdate this_ptr_conv;
34091         this_ptr_conv.inner = untag_ptr(this_ptr);
34092         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34094         this_ptr_conv.is_owned = false;
34095         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
34096 }
34097
34098 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_base_msat"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint64_t this_ptr) {
34099         LDKUnsignedChannelUpdate this_ptr_conv;
34100         this_ptr_conv.inner = untag_ptr(this_ptr);
34101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34103         this_ptr_conv.is_owned = false;
34104         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
34105         return ret_conv;
34106 }
34107
34108 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_base_msat"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
34109         LDKUnsignedChannelUpdate this_ptr_conv;
34110         this_ptr_conv.inner = untag_ptr(this_ptr);
34111         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34113         this_ptr_conv.is_owned = false;
34114         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
34115 }
34116
34117 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint64_t this_ptr) {
34118         LDKUnsignedChannelUpdate this_ptr_conv;
34119         this_ptr_conv.inner = untag_ptr(this_ptr);
34120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34122         this_ptr_conv.is_owned = false;
34123         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
34124         return ret_conv;
34125 }
34126
34127 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
34128         LDKUnsignedChannelUpdate this_ptr_conv;
34129         this_ptr_conv.inner = untag_ptr(this_ptr);
34130         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34132         this_ptr_conv.is_owned = false;
34133         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
34134 }
34135
34136 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_excess_data"))) TS_UnsignedChannelUpdate_get_excess_data(uint64_t this_ptr) {
34137         LDKUnsignedChannelUpdate this_ptr_conv;
34138         this_ptr_conv.inner = untag_ptr(this_ptr);
34139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34141         this_ptr_conv.is_owned = false;
34142         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
34143         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34144         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34145         CVec_u8Z_free(ret_var);
34146         return ret_arr;
34147 }
34148
34149 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_excess_data"))) TS_UnsignedChannelUpdate_set_excess_data(uint64_t this_ptr, int8_tArray val) {
34150         LDKUnsignedChannelUpdate this_ptr_conv;
34151         this_ptr_conv.inner = untag_ptr(this_ptr);
34152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34154         this_ptr_conv.is_owned = false;
34155         LDKCVec_u8Z val_ref;
34156         val_ref.datalen = val->arr_len;
34157         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
34158         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
34159         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
34160 }
34161
34162 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) {
34163         LDKThirtyTwoBytes chain_hash_arg_ref;
34164         CHECK(chain_hash_arg->arr_len == 32);
34165         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
34166         LDKCVec_u8Z excess_data_arg_ref;
34167         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
34168         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
34169         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
34170         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);
34171         uint64_t ret_ref = 0;
34172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34174         return ret_ref;
34175 }
34176
34177 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
34178         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
34179         uint64_t ret_ref = 0;
34180         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34181         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34182         return ret_ref;
34183 }
34184 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone_ptr"))) TS_UnsignedChannelUpdate_clone_ptr(uint64_t arg) {
34185         LDKUnsignedChannelUpdate arg_conv;
34186         arg_conv.inner = untag_ptr(arg);
34187         arg_conv.is_owned = ptr_is_owned(arg);
34188         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34189         arg_conv.is_owned = false;
34190         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
34191         return ret_conv;
34192 }
34193
34194 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone"))) TS_UnsignedChannelUpdate_clone(uint64_t orig) {
34195         LDKUnsignedChannelUpdate orig_conv;
34196         orig_conv.inner = untag_ptr(orig);
34197         orig_conv.is_owned = ptr_is_owned(orig);
34198         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34199         orig_conv.is_owned = false;
34200         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
34201         uint64_t ret_ref = 0;
34202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34204         return ret_ref;
34205 }
34206
34207 jboolean  __attribute__((export_name("TS_UnsignedChannelUpdate_eq"))) TS_UnsignedChannelUpdate_eq(uint64_t a, uint64_t b) {
34208         LDKUnsignedChannelUpdate a_conv;
34209         a_conv.inner = untag_ptr(a);
34210         a_conv.is_owned = ptr_is_owned(a);
34211         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34212         a_conv.is_owned = false;
34213         LDKUnsignedChannelUpdate b_conv;
34214         b_conv.inner = untag_ptr(b);
34215         b_conv.is_owned = ptr_is_owned(b);
34216         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34217         b_conv.is_owned = false;
34218         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
34219         return ret_conv;
34220 }
34221
34222 void  __attribute__((export_name("TS_ChannelUpdate_free"))) TS_ChannelUpdate_free(uint64_t this_obj) {
34223         LDKChannelUpdate this_obj_conv;
34224         this_obj_conv.inner = untag_ptr(this_obj);
34225         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34227         ChannelUpdate_free(this_obj_conv);
34228 }
34229
34230 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_get_signature"))) TS_ChannelUpdate_get_signature(uint64_t this_ptr) {
34231         LDKChannelUpdate this_ptr_conv;
34232         this_ptr_conv.inner = untag_ptr(this_ptr);
34233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34235         this_ptr_conv.is_owned = false;
34236         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
34237         memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
34238         return ret_arr;
34239 }
34240
34241 void  __attribute__((export_name("TS_ChannelUpdate_set_signature"))) TS_ChannelUpdate_set_signature(uint64_t this_ptr, int8_tArray val) {
34242         LDKChannelUpdate this_ptr_conv;
34243         this_ptr_conv.inner = untag_ptr(this_ptr);
34244         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34246         this_ptr_conv.is_owned = false;
34247         LDKSignature val_ref;
34248         CHECK(val->arr_len == 64);
34249         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
34250         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
34251 }
34252
34253 uint64_t  __attribute__((export_name("TS_ChannelUpdate_get_contents"))) TS_ChannelUpdate_get_contents(uint64_t this_ptr) {
34254         LDKChannelUpdate this_ptr_conv;
34255         this_ptr_conv.inner = untag_ptr(this_ptr);
34256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34258         this_ptr_conv.is_owned = false;
34259         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
34260         uint64_t ret_ref = 0;
34261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34262         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34263         return ret_ref;
34264 }
34265
34266 void  __attribute__((export_name("TS_ChannelUpdate_set_contents"))) TS_ChannelUpdate_set_contents(uint64_t this_ptr, uint64_t val) {
34267         LDKChannelUpdate this_ptr_conv;
34268         this_ptr_conv.inner = untag_ptr(this_ptr);
34269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34271         this_ptr_conv.is_owned = false;
34272         LDKUnsignedChannelUpdate val_conv;
34273         val_conv.inner = untag_ptr(val);
34274         val_conv.is_owned = ptr_is_owned(val);
34275         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34276         val_conv = UnsignedChannelUpdate_clone(&val_conv);
34277         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
34278 }
34279
34280 uint64_t  __attribute__((export_name("TS_ChannelUpdate_new"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint64_t contents_arg) {
34281         LDKSignature signature_arg_ref;
34282         CHECK(signature_arg->arr_len == 64);
34283         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
34284         LDKUnsignedChannelUpdate contents_arg_conv;
34285         contents_arg_conv.inner = untag_ptr(contents_arg);
34286         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
34287         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
34288         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
34289         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
34290         uint64_t ret_ref = 0;
34291         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34292         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34293         return ret_ref;
34294 }
34295
34296 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
34297         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
34298         uint64_t ret_ref = 0;
34299         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34300         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34301         return ret_ref;
34302 }
34303 int64_t  __attribute__((export_name("TS_ChannelUpdate_clone_ptr"))) TS_ChannelUpdate_clone_ptr(uint64_t arg) {
34304         LDKChannelUpdate arg_conv;
34305         arg_conv.inner = untag_ptr(arg);
34306         arg_conv.is_owned = ptr_is_owned(arg);
34307         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34308         arg_conv.is_owned = false;
34309         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
34310         return ret_conv;
34311 }
34312
34313 uint64_t  __attribute__((export_name("TS_ChannelUpdate_clone"))) TS_ChannelUpdate_clone(uint64_t orig) {
34314         LDKChannelUpdate orig_conv;
34315         orig_conv.inner = untag_ptr(orig);
34316         orig_conv.is_owned = ptr_is_owned(orig);
34317         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34318         orig_conv.is_owned = false;
34319         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
34320         uint64_t ret_ref = 0;
34321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34323         return ret_ref;
34324 }
34325
34326 jboolean  __attribute__((export_name("TS_ChannelUpdate_eq"))) TS_ChannelUpdate_eq(uint64_t a, uint64_t b) {
34327         LDKChannelUpdate a_conv;
34328         a_conv.inner = untag_ptr(a);
34329         a_conv.is_owned = ptr_is_owned(a);
34330         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34331         a_conv.is_owned = false;
34332         LDKChannelUpdate b_conv;
34333         b_conv.inner = untag_ptr(b);
34334         b_conv.is_owned = ptr_is_owned(b);
34335         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34336         b_conv.is_owned = false;
34337         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
34338         return ret_conv;
34339 }
34340
34341 void  __attribute__((export_name("TS_QueryChannelRange_free"))) TS_QueryChannelRange_free(uint64_t this_obj) {
34342         LDKQueryChannelRange this_obj_conv;
34343         this_obj_conv.inner = untag_ptr(this_obj);
34344         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34346         QueryChannelRange_free(this_obj_conv);
34347 }
34348
34349 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_get_chain_hash"))) TS_QueryChannelRange_get_chain_hash(uint64_t this_ptr) {
34350         LDKQueryChannelRange this_ptr_conv;
34351         this_ptr_conv.inner = untag_ptr(this_ptr);
34352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34354         this_ptr_conv.is_owned = false;
34355         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34356         memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
34357         return ret_arr;
34358 }
34359
34360 void  __attribute__((export_name("TS_QueryChannelRange_set_chain_hash"))) TS_QueryChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
34361         LDKQueryChannelRange this_ptr_conv;
34362         this_ptr_conv.inner = untag_ptr(this_ptr);
34363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34365         this_ptr_conv.is_owned = false;
34366         LDKThirtyTwoBytes val_ref;
34367         CHECK(val->arr_len == 32);
34368         memcpy(val_ref.data, val->elems, 32); FREE(val);
34369         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
34370 }
34371
34372 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_first_blocknum"))) TS_QueryChannelRange_get_first_blocknum(uint64_t this_ptr) {
34373         LDKQueryChannelRange this_ptr_conv;
34374         this_ptr_conv.inner = untag_ptr(this_ptr);
34375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34377         this_ptr_conv.is_owned = false;
34378         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
34379         return ret_conv;
34380 }
34381
34382 void  __attribute__((export_name("TS_QueryChannelRange_set_first_blocknum"))) TS_QueryChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
34383         LDKQueryChannelRange this_ptr_conv;
34384         this_ptr_conv.inner = untag_ptr(this_ptr);
34385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34387         this_ptr_conv.is_owned = false;
34388         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
34389 }
34390
34391 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_number_of_blocks"))) TS_QueryChannelRange_get_number_of_blocks(uint64_t this_ptr) {
34392         LDKQueryChannelRange this_ptr_conv;
34393         this_ptr_conv.inner = untag_ptr(this_ptr);
34394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34396         this_ptr_conv.is_owned = false;
34397         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
34398         return ret_conv;
34399 }
34400
34401 void  __attribute__((export_name("TS_QueryChannelRange_set_number_of_blocks"))) TS_QueryChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
34402         LDKQueryChannelRange this_ptr_conv;
34403         this_ptr_conv.inner = untag_ptr(this_ptr);
34404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34406         this_ptr_conv.is_owned = false;
34407         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
34408 }
34409
34410 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) {
34411         LDKThirtyTwoBytes chain_hash_arg_ref;
34412         CHECK(chain_hash_arg->arr_len == 32);
34413         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
34414         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
34415         uint64_t ret_ref = 0;
34416         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34417         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34418         return ret_ref;
34419 }
34420
34421 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
34422         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
34423         uint64_t ret_ref = 0;
34424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34426         return ret_ref;
34427 }
34428 int64_t  __attribute__((export_name("TS_QueryChannelRange_clone_ptr"))) TS_QueryChannelRange_clone_ptr(uint64_t arg) {
34429         LDKQueryChannelRange arg_conv;
34430         arg_conv.inner = untag_ptr(arg);
34431         arg_conv.is_owned = ptr_is_owned(arg);
34432         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34433         arg_conv.is_owned = false;
34434         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
34435         return ret_conv;
34436 }
34437
34438 uint64_t  __attribute__((export_name("TS_QueryChannelRange_clone"))) TS_QueryChannelRange_clone(uint64_t orig) {
34439         LDKQueryChannelRange orig_conv;
34440         orig_conv.inner = untag_ptr(orig);
34441         orig_conv.is_owned = ptr_is_owned(orig);
34442         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34443         orig_conv.is_owned = false;
34444         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
34445         uint64_t ret_ref = 0;
34446         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34447         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34448         return ret_ref;
34449 }
34450
34451 jboolean  __attribute__((export_name("TS_QueryChannelRange_eq"))) TS_QueryChannelRange_eq(uint64_t a, uint64_t b) {
34452         LDKQueryChannelRange a_conv;
34453         a_conv.inner = untag_ptr(a);
34454         a_conv.is_owned = ptr_is_owned(a);
34455         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34456         a_conv.is_owned = false;
34457         LDKQueryChannelRange b_conv;
34458         b_conv.inner = untag_ptr(b);
34459         b_conv.is_owned = ptr_is_owned(b);
34460         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34461         b_conv.is_owned = false;
34462         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
34463         return ret_conv;
34464 }
34465
34466 void  __attribute__((export_name("TS_ReplyChannelRange_free"))) TS_ReplyChannelRange_free(uint64_t this_obj) {
34467         LDKReplyChannelRange this_obj_conv;
34468         this_obj_conv.inner = untag_ptr(this_obj);
34469         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34471         ReplyChannelRange_free(this_obj_conv);
34472 }
34473
34474 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_chain_hash"))) TS_ReplyChannelRange_get_chain_hash(uint64_t this_ptr) {
34475         LDKReplyChannelRange this_ptr_conv;
34476         this_ptr_conv.inner = untag_ptr(this_ptr);
34477         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34478         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34479         this_ptr_conv.is_owned = false;
34480         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34481         memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
34482         return ret_arr;
34483 }
34484
34485 void  __attribute__((export_name("TS_ReplyChannelRange_set_chain_hash"))) TS_ReplyChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
34486         LDKReplyChannelRange this_ptr_conv;
34487         this_ptr_conv.inner = untag_ptr(this_ptr);
34488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34490         this_ptr_conv.is_owned = false;
34491         LDKThirtyTwoBytes val_ref;
34492         CHECK(val->arr_len == 32);
34493         memcpy(val_ref.data, val->elems, 32); FREE(val);
34494         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
34495 }
34496
34497 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_first_blocknum"))) TS_ReplyChannelRange_get_first_blocknum(uint64_t this_ptr) {
34498         LDKReplyChannelRange this_ptr_conv;
34499         this_ptr_conv.inner = untag_ptr(this_ptr);
34500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34502         this_ptr_conv.is_owned = false;
34503         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
34504         return ret_conv;
34505 }
34506
34507 void  __attribute__((export_name("TS_ReplyChannelRange_set_first_blocknum"))) TS_ReplyChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
34508         LDKReplyChannelRange this_ptr_conv;
34509         this_ptr_conv.inner = untag_ptr(this_ptr);
34510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34512         this_ptr_conv.is_owned = false;
34513         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
34514 }
34515
34516 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_number_of_blocks"))) TS_ReplyChannelRange_get_number_of_blocks(uint64_t this_ptr) {
34517         LDKReplyChannelRange this_ptr_conv;
34518         this_ptr_conv.inner = untag_ptr(this_ptr);
34519         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34521         this_ptr_conv.is_owned = false;
34522         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
34523         return ret_conv;
34524 }
34525
34526 void  __attribute__((export_name("TS_ReplyChannelRange_set_number_of_blocks"))) TS_ReplyChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
34527         LDKReplyChannelRange this_ptr_conv;
34528         this_ptr_conv.inner = untag_ptr(this_ptr);
34529         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34531         this_ptr_conv.is_owned = false;
34532         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
34533 }
34534
34535 jboolean  __attribute__((export_name("TS_ReplyChannelRange_get_sync_complete"))) TS_ReplyChannelRange_get_sync_complete(uint64_t this_ptr) {
34536         LDKReplyChannelRange this_ptr_conv;
34537         this_ptr_conv.inner = untag_ptr(this_ptr);
34538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34540         this_ptr_conv.is_owned = false;
34541         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
34542         return ret_conv;
34543 }
34544
34545 void  __attribute__((export_name("TS_ReplyChannelRange_set_sync_complete"))) TS_ReplyChannelRange_set_sync_complete(uint64_t this_ptr, jboolean val) {
34546         LDKReplyChannelRange this_ptr_conv;
34547         this_ptr_conv.inner = untag_ptr(this_ptr);
34548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34550         this_ptr_conv.is_owned = false;
34551         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
34552 }
34553
34554 int64_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_short_channel_ids"))) TS_ReplyChannelRange_get_short_channel_ids(uint64_t this_ptr) {
34555         LDKReplyChannelRange this_ptr_conv;
34556         this_ptr_conv.inner = untag_ptr(this_ptr);
34557         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34559         this_ptr_conv.is_owned = false;
34560         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
34561         int64_tArray ret_arr = NULL;
34562         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
34563         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
34564         for (size_t i = 0; i < ret_var.datalen; i++) {
34565                 int64_t ret_conv_8_conv = ret_var.data[i];
34566                 ret_arr_ptr[i] = ret_conv_8_conv;
34567         }
34568         
34569         FREE(ret_var.data);
34570         return ret_arr;
34571 }
34572
34573 void  __attribute__((export_name("TS_ReplyChannelRange_set_short_channel_ids"))) TS_ReplyChannelRange_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
34574         LDKReplyChannelRange this_ptr_conv;
34575         this_ptr_conv.inner = untag_ptr(this_ptr);
34576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34578         this_ptr_conv.is_owned = false;
34579         LDKCVec_u64Z val_constr;
34580         val_constr.datalen = val->arr_len;
34581         if (val_constr.datalen > 0)
34582                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
34583         else
34584                 val_constr.data = NULL;
34585         int64_t* val_vals = val->elems;
34586         for (size_t i = 0; i < val_constr.datalen; i++) {
34587                 int64_t val_conv_8 = val_vals[i];
34588                 val_constr.data[i] = val_conv_8;
34589         }
34590         FREE(val);
34591         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
34592 }
34593
34594 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) {
34595         LDKThirtyTwoBytes chain_hash_arg_ref;
34596         CHECK(chain_hash_arg->arr_len == 32);
34597         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
34598         LDKCVec_u64Z short_channel_ids_arg_constr;
34599         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
34600         if (short_channel_ids_arg_constr.datalen > 0)
34601                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
34602         else
34603                 short_channel_ids_arg_constr.data = NULL;
34604         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
34605         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
34606                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
34607                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
34608         }
34609         FREE(short_channel_ids_arg);
34610         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
34611         uint64_t ret_ref = 0;
34612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34613         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34614         return ret_ref;
34615 }
34616
34617 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
34618         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
34619         uint64_t ret_ref = 0;
34620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34622         return ret_ref;
34623 }
34624 int64_t  __attribute__((export_name("TS_ReplyChannelRange_clone_ptr"))) TS_ReplyChannelRange_clone_ptr(uint64_t arg) {
34625         LDKReplyChannelRange arg_conv;
34626         arg_conv.inner = untag_ptr(arg);
34627         arg_conv.is_owned = ptr_is_owned(arg);
34628         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34629         arg_conv.is_owned = false;
34630         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
34631         return ret_conv;
34632 }
34633
34634 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_clone"))) TS_ReplyChannelRange_clone(uint64_t orig) {
34635         LDKReplyChannelRange orig_conv;
34636         orig_conv.inner = untag_ptr(orig);
34637         orig_conv.is_owned = ptr_is_owned(orig);
34638         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34639         orig_conv.is_owned = false;
34640         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
34641         uint64_t ret_ref = 0;
34642         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34643         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34644         return ret_ref;
34645 }
34646
34647 jboolean  __attribute__((export_name("TS_ReplyChannelRange_eq"))) TS_ReplyChannelRange_eq(uint64_t a, uint64_t b) {
34648         LDKReplyChannelRange a_conv;
34649         a_conv.inner = untag_ptr(a);
34650         a_conv.is_owned = ptr_is_owned(a);
34651         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34652         a_conv.is_owned = false;
34653         LDKReplyChannelRange b_conv;
34654         b_conv.inner = untag_ptr(b);
34655         b_conv.is_owned = ptr_is_owned(b);
34656         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34657         b_conv.is_owned = false;
34658         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
34659         return ret_conv;
34660 }
34661
34662 void  __attribute__((export_name("TS_QueryShortChannelIds_free"))) TS_QueryShortChannelIds_free(uint64_t this_obj) {
34663         LDKQueryShortChannelIds this_obj_conv;
34664         this_obj_conv.inner = untag_ptr(this_obj);
34665         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34667         QueryShortChannelIds_free(this_obj_conv);
34668 }
34669
34670 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_chain_hash"))) TS_QueryShortChannelIds_get_chain_hash(uint64_t this_ptr) {
34671         LDKQueryShortChannelIds this_ptr_conv;
34672         this_ptr_conv.inner = untag_ptr(this_ptr);
34673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34675         this_ptr_conv.is_owned = false;
34676         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34677         memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
34678         return ret_arr;
34679 }
34680
34681 void  __attribute__((export_name("TS_QueryShortChannelIds_set_chain_hash"))) TS_QueryShortChannelIds_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
34682         LDKQueryShortChannelIds this_ptr_conv;
34683         this_ptr_conv.inner = untag_ptr(this_ptr);
34684         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34686         this_ptr_conv.is_owned = false;
34687         LDKThirtyTwoBytes val_ref;
34688         CHECK(val->arr_len == 32);
34689         memcpy(val_ref.data, val->elems, 32); FREE(val);
34690         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
34691 }
34692
34693 int64_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_short_channel_ids"))) TS_QueryShortChannelIds_get_short_channel_ids(uint64_t this_ptr) {
34694         LDKQueryShortChannelIds this_ptr_conv;
34695         this_ptr_conv.inner = untag_ptr(this_ptr);
34696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34698         this_ptr_conv.is_owned = false;
34699         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
34700         int64_tArray ret_arr = NULL;
34701         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
34702         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
34703         for (size_t i = 0; i < ret_var.datalen; i++) {
34704                 int64_t ret_conv_8_conv = ret_var.data[i];
34705                 ret_arr_ptr[i] = ret_conv_8_conv;
34706         }
34707         
34708         FREE(ret_var.data);
34709         return ret_arr;
34710 }
34711
34712 void  __attribute__((export_name("TS_QueryShortChannelIds_set_short_channel_ids"))) TS_QueryShortChannelIds_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
34713         LDKQueryShortChannelIds this_ptr_conv;
34714         this_ptr_conv.inner = untag_ptr(this_ptr);
34715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34717         this_ptr_conv.is_owned = false;
34718         LDKCVec_u64Z val_constr;
34719         val_constr.datalen = val->arr_len;
34720         if (val_constr.datalen > 0)
34721                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
34722         else
34723                 val_constr.data = NULL;
34724         int64_t* val_vals = val->elems;
34725         for (size_t i = 0; i < val_constr.datalen; i++) {
34726                 int64_t val_conv_8 = val_vals[i];
34727                 val_constr.data[i] = val_conv_8;
34728         }
34729         FREE(val);
34730         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
34731 }
34732
34733 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_new"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
34734         LDKThirtyTwoBytes chain_hash_arg_ref;
34735         CHECK(chain_hash_arg->arr_len == 32);
34736         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
34737         LDKCVec_u64Z short_channel_ids_arg_constr;
34738         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
34739         if (short_channel_ids_arg_constr.datalen > 0)
34740                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
34741         else
34742                 short_channel_ids_arg_constr.data = NULL;
34743         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
34744         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
34745                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
34746                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
34747         }
34748         FREE(short_channel_ids_arg);
34749         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
34750         uint64_t ret_ref = 0;
34751         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34752         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34753         return ret_ref;
34754 }
34755
34756 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
34757         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
34758         uint64_t ret_ref = 0;
34759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34761         return ret_ref;
34762 }
34763 int64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone_ptr"))) TS_QueryShortChannelIds_clone_ptr(uint64_t arg) {
34764         LDKQueryShortChannelIds arg_conv;
34765         arg_conv.inner = untag_ptr(arg);
34766         arg_conv.is_owned = ptr_is_owned(arg);
34767         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34768         arg_conv.is_owned = false;
34769         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
34770         return ret_conv;
34771 }
34772
34773 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone"))) TS_QueryShortChannelIds_clone(uint64_t orig) {
34774         LDKQueryShortChannelIds orig_conv;
34775         orig_conv.inner = untag_ptr(orig);
34776         orig_conv.is_owned = ptr_is_owned(orig);
34777         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34778         orig_conv.is_owned = false;
34779         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
34780         uint64_t ret_ref = 0;
34781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34783         return ret_ref;
34784 }
34785
34786 jboolean  __attribute__((export_name("TS_QueryShortChannelIds_eq"))) TS_QueryShortChannelIds_eq(uint64_t a, uint64_t b) {
34787         LDKQueryShortChannelIds a_conv;
34788         a_conv.inner = untag_ptr(a);
34789         a_conv.is_owned = ptr_is_owned(a);
34790         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34791         a_conv.is_owned = false;
34792         LDKQueryShortChannelIds b_conv;
34793         b_conv.inner = untag_ptr(b);
34794         b_conv.is_owned = ptr_is_owned(b);
34795         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34796         b_conv.is_owned = false;
34797         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
34798         return ret_conv;
34799 }
34800
34801 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_free"))) TS_ReplyShortChannelIdsEnd_free(uint64_t this_obj) {
34802         LDKReplyShortChannelIdsEnd this_obj_conv;
34803         this_obj_conv.inner = untag_ptr(this_obj);
34804         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34806         ReplyShortChannelIdsEnd_free(this_obj_conv);
34807 }
34808
34809 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_chain_hash"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint64_t this_ptr) {
34810         LDKReplyShortChannelIdsEnd this_ptr_conv;
34811         this_ptr_conv.inner = untag_ptr(this_ptr);
34812         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34814         this_ptr_conv.is_owned = false;
34815         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34816         memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
34817         return ret_arr;
34818 }
34819
34820 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_chain_hash"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
34821         LDKReplyShortChannelIdsEnd this_ptr_conv;
34822         this_ptr_conv.inner = untag_ptr(this_ptr);
34823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34825         this_ptr_conv.is_owned = false;
34826         LDKThirtyTwoBytes val_ref;
34827         CHECK(val->arr_len == 32);
34828         memcpy(val_ref.data, val->elems, 32); FREE(val);
34829         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
34830 }
34831
34832 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_full_information"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint64_t this_ptr) {
34833         LDKReplyShortChannelIdsEnd this_ptr_conv;
34834         this_ptr_conv.inner = untag_ptr(this_ptr);
34835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34837         this_ptr_conv.is_owned = false;
34838         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
34839         return ret_conv;
34840 }
34841
34842 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_full_information"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint64_t this_ptr, jboolean val) {
34843         LDKReplyShortChannelIdsEnd this_ptr_conv;
34844         this_ptr_conv.inner = untag_ptr(this_ptr);
34845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34847         this_ptr_conv.is_owned = false;
34848         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
34849 }
34850
34851 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_new"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
34852         LDKThirtyTwoBytes chain_hash_arg_ref;
34853         CHECK(chain_hash_arg->arr_len == 32);
34854         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
34855         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
34856         uint64_t ret_ref = 0;
34857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34859         return ret_ref;
34860 }
34861
34862 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
34863         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
34864         uint64_t ret_ref = 0;
34865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34867         return ret_ref;
34868 }
34869 int64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone_ptr"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint64_t arg) {
34870         LDKReplyShortChannelIdsEnd arg_conv;
34871         arg_conv.inner = untag_ptr(arg);
34872         arg_conv.is_owned = ptr_is_owned(arg);
34873         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34874         arg_conv.is_owned = false;
34875         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
34876         return ret_conv;
34877 }
34878
34879 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone"))) TS_ReplyShortChannelIdsEnd_clone(uint64_t orig) {
34880         LDKReplyShortChannelIdsEnd orig_conv;
34881         orig_conv.inner = untag_ptr(orig);
34882         orig_conv.is_owned = ptr_is_owned(orig);
34883         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34884         orig_conv.is_owned = false;
34885         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
34886         uint64_t ret_ref = 0;
34887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34889         return ret_ref;
34890 }
34891
34892 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_eq"))) TS_ReplyShortChannelIdsEnd_eq(uint64_t a, uint64_t b) {
34893         LDKReplyShortChannelIdsEnd a_conv;
34894         a_conv.inner = untag_ptr(a);
34895         a_conv.is_owned = ptr_is_owned(a);
34896         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34897         a_conv.is_owned = false;
34898         LDKReplyShortChannelIdsEnd b_conv;
34899         b_conv.inner = untag_ptr(b);
34900         b_conv.is_owned = ptr_is_owned(b);
34901         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34902         b_conv.is_owned = false;
34903         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
34904         return ret_conv;
34905 }
34906
34907 void  __attribute__((export_name("TS_GossipTimestampFilter_free"))) TS_GossipTimestampFilter_free(uint64_t this_obj) {
34908         LDKGossipTimestampFilter this_obj_conv;
34909         this_obj_conv.inner = untag_ptr(this_obj);
34910         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34912         GossipTimestampFilter_free(this_obj_conv);
34913 }
34914
34915 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_get_chain_hash"))) TS_GossipTimestampFilter_get_chain_hash(uint64_t this_ptr) {
34916         LDKGossipTimestampFilter this_ptr_conv;
34917         this_ptr_conv.inner = untag_ptr(this_ptr);
34918         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34920         this_ptr_conv.is_owned = false;
34921         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34922         memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
34923         return ret_arr;
34924 }
34925
34926 void  __attribute__((export_name("TS_GossipTimestampFilter_set_chain_hash"))) TS_GossipTimestampFilter_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
34927         LDKGossipTimestampFilter this_ptr_conv;
34928         this_ptr_conv.inner = untag_ptr(this_ptr);
34929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34931         this_ptr_conv.is_owned = false;
34932         LDKThirtyTwoBytes val_ref;
34933         CHECK(val->arr_len == 32);
34934         memcpy(val_ref.data, val->elems, 32); FREE(val);
34935         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
34936 }
34937
34938 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_first_timestamp"))) TS_GossipTimestampFilter_get_first_timestamp(uint64_t this_ptr) {
34939         LDKGossipTimestampFilter this_ptr_conv;
34940         this_ptr_conv.inner = untag_ptr(this_ptr);
34941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34943         this_ptr_conv.is_owned = false;
34944         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
34945         return ret_conv;
34946 }
34947
34948 void  __attribute__((export_name("TS_GossipTimestampFilter_set_first_timestamp"))) TS_GossipTimestampFilter_set_first_timestamp(uint64_t this_ptr, int32_t val) {
34949         LDKGossipTimestampFilter this_ptr_conv;
34950         this_ptr_conv.inner = untag_ptr(this_ptr);
34951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34953         this_ptr_conv.is_owned = false;
34954         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
34955 }
34956
34957 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_timestamp_range"))) TS_GossipTimestampFilter_get_timestamp_range(uint64_t this_ptr) {
34958         LDKGossipTimestampFilter this_ptr_conv;
34959         this_ptr_conv.inner = untag_ptr(this_ptr);
34960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34962         this_ptr_conv.is_owned = false;
34963         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
34964         return ret_conv;
34965 }
34966
34967 void  __attribute__((export_name("TS_GossipTimestampFilter_set_timestamp_range"))) TS_GossipTimestampFilter_set_timestamp_range(uint64_t this_ptr, int32_t val) {
34968         LDKGossipTimestampFilter this_ptr_conv;
34969         this_ptr_conv.inner = untag_ptr(this_ptr);
34970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34972         this_ptr_conv.is_owned = false;
34973         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
34974 }
34975
34976 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) {
34977         LDKThirtyTwoBytes chain_hash_arg_ref;
34978         CHECK(chain_hash_arg->arr_len == 32);
34979         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
34980         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
34981         uint64_t ret_ref = 0;
34982         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34983         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34984         return ret_ref;
34985 }
34986
34987 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
34988         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
34989         uint64_t ret_ref = 0;
34990         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34991         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34992         return ret_ref;
34993 }
34994 int64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone_ptr"))) TS_GossipTimestampFilter_clone_ptr(uint64_t arg) {
34995         LDKGossipTimestampFilter arg_conv;
34996         arg_conv.inner = untag_ptr(arg);
34997         arg_conv.is_owned = ptr_is_owned(arg);
34998         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34999         arg_conv.is_owned = false;
35000         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
35001         return ret_conv;
35002 }
35003
35004 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone"))) TS_GossipTimestampFilter_clone(uint64_t orig) {
35005         LDKGossipTimestampFilter orig_conv;
35006         orig_conv.inner = untag_ptr(orig);
35007         orig_conv.is_owned = ptr_is_owned(orig);
35008         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35009         orig_conv.is_owned = false;
35010         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
35011         uint64_t ret_ref = 0;
35012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35014         return ret_ref;
35015 }
35016
35017 jboolean  __attribute__((export_name("TS_GossipTimestampFilter_eq"))) TS_GossipTimestampFilter_eq(uint64_t a, uint64_t b) {
35018         LDKGossipTimestampFilter a_conv;
35019         a_conv.inner = untag_ptr(a);
35020         a_conv.is_owned = ptr_is_owned(a);
35021         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35022         a_conv.is_owned = false;
35023         LDKGossipTimestampFilter b_conv;
35024         b_conv.inner = untag_ptr(b);
35025         b_conv.is_owned = ptr_is_owned(b);
35026         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35027         b_conv.is_owned = false;
35028         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
35029         return ret_conv;
35030 }
35031
35032 void  __attribute__((export_name("TS_ErrorAction_free"))) TS_ErrorAction_free(uint64_t this_ptr) {
35033         if (!ptr_is_owned(this_ptr)) return;
35034         void* this_ptr_ptr = untag_ptr(this_ptr);
35035         CHECK_ACCESS(this_ptr_ptr);
35036         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
35037         FREE(untag_ptr(this_ptr));
35038         ErrorAction_free(this_ptr_conv);
35039 }
35040
35041 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
35042         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35043         *ret_copy = ErrorAction_clone(arg);
35044         uint64_t ret_ref = tag_ptr(ret_copy, true);
35045         return ret_ref;
35046 }
35047 int64_t  __attribute__((export_name("TS_ErrorAction_clone_ptr"))) TS_ErrorAction_clone_ptr(uint64_t arg) {
35048         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
35049         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
35050         return ret_conv;
35051 }
35052
35053 uint64_t  __attribute__((export_name("TS_ErrorAction_clone"))) TS_ErrorAction_clone(uint64_t orig) {
35054         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
35055         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35056         *ret_copy = ErrorAction_clone(orig_conv);
35057         uint64_t ret_ref = tag_ptr(ret_copy, true);
35058         return ret_ref;
35059 }
35060
35061 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer"))) TS_ErrorAction_disconnect_peer(uint64_t msg) {
35062         LDKErrorMessage msg_conv;
35063         msg_conv.inner = untag_ptr(msg);
35064         msg_conv.is_owned = ptr_is_owned(msg);
35065         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35066         msg_conv = ErrorMessage_clone(&msg_conv);
35067         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35068         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
35069         uint64_t ret_ref = tag_ptr(ret_copy, true);
35070         return ret_ref;
35071 }
35072
35073 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_error"))) TS_ErrorAction_ignore_error() {
35074         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35075         *ret_copy = ErrorAction_ignore_error();
35076         uint64_t ret_ref = tag_ptr(ret_copy, true);
35077         return ret_ref;
35078 }
35079
35080 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_and_log"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
35081         LDKLevel a_conv = LDKLevel_from_js(a);
35082         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35083         *ret_copy = ErrorAction_ignore_and_log(a_conv);
35084         uint64_t ret_ref = tag_ptr(ret_copy, true);
35085         return ret_ref;
35086 }
35087
35088 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_duplicate_gossip"))) TS_ErrorAction_ignore_duplicate_gossip() {
35089         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35090         *ret_copy = ErrorAction_ignore_duplicate_gossip();
35091         uint64_t ret_ref = tag_ptr(ret_copy, true);
35092         return ret_ref;
35093 }
35094
35095 uint64_t  __attribute__((export_name("TS_ErrorAction_send_error_message"))) TS_ErrorAction_send_error_message(uint64_t msg) {
35096         LDKErrorMessage msg_conv;
35097         msg_conv.inner = untag_ptr(msg);
35098         msg_conv.is_owned = ptr_is_owned(msg);
35099         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35100         msg_conv = ErrorMessage_clone(&msg_conv);
35101         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35102         *ret_copy = ErrorAction_send_error_message(msg_conv);
35103         uint64_t ret_ref = tag_ptr(ret_copy, true);
35104         return ret_ref;
35105 }
35106
35107 uint64_t  __attribute__((export_name("TS_ErrorAction_send_warning_message"))) TS_ErrorAction_send_warning_message(uint64_t msg, uint32_t log_level) {
35108         LDKWarningMessage msg_conv;
35109         msg_conv.inner = untag_ptr(msg);
35110         msg_conv.is_owned = ptr_is_owned(msg);
35111         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
35112         msg_conv = WarningMessage_clone(&msg_conv);
35113         LDKLevel log_level_conv = LDKLevel_from_js(log_level);
35114         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35115         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
35116         uint64_t ret_ref = tag_ptr(ret_copy, true);
35117         return ret_ref;
35118 }
35119
35120 void  __attribute__((export_name("TS_LightningError_free"))) TS_LightningError_free(uint64_t this_obj) {
35121         LDKLightningError this_obj_conv;
35122         this_obj_conv.inner = untag_ptr(this_obj);
35123         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35125         LightningError_free(this_obj_conv);
35126 }
35127
35128 jstring  __attribute__((export_name("TS_LightningError_get_err"))) TS_LightningError_get_err(uint64_t this_ptr) {
35129         LDKLightningError this_ptr_conv;
35130         this_ptr_conv.inner = untag_ptr(this_ptr);
35131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35133         this_ptr_conv.is_owned = false;
35134         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
35135         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
35136         Str_free(ret_str);
35137         return ret_conv;
35138 }
35139
35140 void  __attribute__((export_name("TS_LightningError_set_err"))) TS_LightningError_set_err(uint64_t this_ptr, jstring val) {
35141         LDKLightningError this_ptr_conv;
35142         this_ptr_conv.inner = untag_ptr(this_ptr);
35143         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35145         this_ptr_conv.is_owned = false;
35146         LDKStr val_conv = str_ref_to_owned_c(val);
35147         LightningError_set_err(&this_ptr_conv, val_conv);
35148 }
35149
35150 uint64_t  __attribute__((export_name("TS_LightningError_get_action"))) TS_LightningError_get_action(uint64_t this_ptr) {
35151         LDKLightningError this_ptr_conv;
35152         this_ptr_conv.inner = untag_ptr(this_ptr);
35153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35155         this_ptr_conv.is_owned = false;
35156         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
35157         *ret_copy = LightningError_get_action(&this_ptr_conv);
35158         uint64_t ret_ref = tag_ptr(ret_copy, true);
35159         return ret_ref;
35160 }
35161
35162 void  __attribute__((export_name("TS_LightningError_set_action"))) TS_LightningError_set_action(uint64_t this_ptr, uint64_t val) {
35163         LDKLightningError this_ptr_conv;
35164         this_ptr_conv.inner = untag_ptr(this_ptr);
35165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35167         this_ptr_conv.is_owned = false;
35168         void* val_ptr = untag_ptr(val);
35169         CHECK_ACCESS(val_ptr);
35170         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
35171         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
35172         LightningError_set_action(&this_ptr_conv, val_conv);
35173 }
35174
35175 uint64_t  __attribute__((export_name("TS_LightningError_new"))) TS_LightningError_new(jstring err_arg, uint64_t action_arg) {
35176         LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
35177         void* action_arg_ptr = untag_ptr(action_arg);
35178         CHECK_ACCESS(action_arg_ptr);
35179         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
35180         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
35181         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
35182         uint64_t ret_ref = 0;
35183         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35184         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35185         return ret_ref;
35186 }
35187
35188 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
35189         LDKLightningError ret_var = LightningError_clone(arg);
35190         uint64_t ret_ref = 0;
35191         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35192         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35193         return ret_ref;
35194 }
35195 int64_t  __attribute__((export_name("TS_LightningError_clone_ptr"))) TS_LightningError_clone_ptr(uint64_t arg) {
35196         LDKLightningError arg_conv;
35197         arg_conv.inner = untag_ptr(arg);
35198         arg_conv.is_owned = ptr_is_owned(arg);
35199         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35200         arg_conv.is_owned = false;
35201         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
35202         return ret_conv;
35203 }
35204
35205 uint64_t  __attribute__((export_name("TS_LightningError_clone"))) TS_LightningError_clone(uint64_t orig) {
35206         LDKLightningError orig_conv;
35207         orig_conv.inner = untag_ptr(orig);
35208         orig_conv.is_owned = ptr_is_owned(orig);
35209         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35210         orig_conv.is_owned = false;
35211         LDKLightningError ret_var = LightningError_clone(&orig_conv);
35212         uint64_t ret_ref = 0;
35213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35215         return ret_ref;
35216 }
35217
35218 void  __attribute__((export_name("TS_CommitmentUpdate_free"))) TS_CommitmentUpdate_free(uint64_t this_obj) {
35219         LDKCommitmentUpdate this_obj_conv;
35220         this_obj_conv.inner = untag_ptr(this_obj);
35221         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35223         CommitmentUpdate_free(this_obj_conv);
35224 }
35225
35226 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_add_htlcs"))) TS_CommitmentUpdate_get_update_add_htlcs(uint64_t this_ptr) {
35227         LDKCommitmentUpdate this_ptr_conv;
35228         this_ptr_conv.inner = untag_ptr(this_ptr);
35229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35231         this_ptr_conv.is_owned = false;
35232         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
35233         uint64_tArray ret_arr = NULL;
35234         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35235         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35236         for (size_t p = 0; p < ret_var.datalen; p++) {
35237                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
35238                 uint64_t ret_conv_15_ref = 0;
35239                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
35240                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
35241                 ret_arr_ptr[p] = ret_conv_15_ref;
35242         }
35243         
35244         FREE(ret_var.data);
35245         return ret_arr;
35246 }
35247
35248 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_add_htlcs"))) TS_CommitmentUpdate_set_update_add_htlcs(uint64_t this_ptr, uint64_tArray val) {
35249         LDKCommitmentUpdate this_ptr_conv;
35250         this_ptr_conv.inner = untag_ptr(this_ptr);
35251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35253         this_ptr_conv.is_owned = false;
35254         LDKCVec_UpdateAddHTLCZ val_constr;
35255         val_constr.datalen = val->arr_len;
35256         if (val_constr.datalen > 0)
35257                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
35258         else
35259                 val_constr.data = NULL;
35260         uint64_t* val_vals = val->elems;
35261         for (size_t p = 0; p < val_constr.datalen; p++) {
35262                 uint64_t val_conv_15 = val_vals[p];
35263                 LDKUpdateAddHTLC val_conv_15_conv;
35264                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
35265                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
35266                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
35267                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
35268                 val_constr.data[p] = val_conv_15_conv;
35269         }
35270         FREE(val);
35271         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
35272 }
35273
35274 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fulfill_htlcs"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint64_t this_ptr) {
35275         LDKCommitmentUpdate this_ptr_conv;
35276         this_ptr_conv.inner = untag_ptr(this_ptr);
35277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35279         this_ptr_conv.is_owned = false;
35280         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
35281         uint64_tArray ret_arr = NULL;
35282         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35283         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35284         for (size_t t = 0; t < ret_var.datalen; t++) {
35285                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
35286                 uint64_t ret_conv_19_ref = 0;
35287                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
35288                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
35289                 ret_arr_ptr[t] = ret_conv_19_ref;
35290         }
35291         
35292         FREE(ret_var.data);
35293         return ret_arr;
35294 }
35295
35296 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fulfill_htlcs"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint64_t this_ptr, uint64_tArray val) {
35297         LDKCommitmentUpdate this_ptr_conv;
35298         this_ptr_conv.inner = untag_ptr(this_ptr);
35299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35301         this_ptr_conv.is_owned = false;
35302         LDKCVec_UpdateFulfillHTLCZ val_constr;
35303         val_constr.datalen = val->arr_len;
35304         if (val_constr.datalen > 0)
35305                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
35306         else
35307                 val_constr.data = NULL;
35308         uint64_t* val_vals = val->elems;
35309         for (size_t t = 0; t < val_constr.datalen; t++) {
35310                 uint64_t val_conv_19 = val_vals[t];
35311                 LDKUpdateFulfillHTLC val_conv_19_conv;
35312                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
35313                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
35314                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
35315                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
35316                 val_constr.data[t] = val_conv_19_conv;
35317         }
35318         FREE(val);
35319         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
35320 }
35321
35322 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_htlcs"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint64_t this_ptr) {
35323         LDKCommitmentUpdate this_ptr_conv;
35324         this_ptr_conv.inner = untag_ptr(this_ptr);
35325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35327         this_ptr_conv.is_owned = false;
35328         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
35329         uint64_tArray ret_arr = NULL;
35330         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35331         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35332         for (size_t q = 0; q < ret_var.datalen; q++) {
35333                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
35334                 uint64_t ret_conv_16_ref = 0;
35335                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
35336                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
35337                 ret_arr_ptr[q] = ret_conv_16_ref;
35338         }
35339         
35340         FREE(ret_var.data);
35341         return ret_arr;
35342 }
35343
35344 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_htlcs"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint64_t this_ptr, uint64_tArray val) {
35345         LDKCommitmentUpdate this_ptr_conv;
35346         this_ptr_conv.inner = untag_ptr(this_ptr);
35347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35349         this_ptr_conv.is_owned = false;
35350         LDKCVec_UpdateFailHTLCZ val_constr;
35351         val_constr.datalen = val->arr_len;
35352         if (val_constr.datalen > 0)
35353                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
35354         else
35355                 val_constr.data = NULL;
35356         uint64_t* val_vals = val->elems;
35357         for (size_t q = 0; q < val_constr.datalen; q++) {
35358                 uint64_t val_conv_16 = val_vals[q];
35359                 LDKUpdateFailHTLC val_conv_16_conv;
35360                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
35361                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
35362                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
35363                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
35364                 val_constr.data[q] = val_conv_16_conv;
35365         }
35366         FREE(val);
35367         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
35368 }
35369
35370 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint64_t this_ptr) {
35371         LDKCommitmentUpdate this_ptr_conv;
35372         this_ptr_conv.inner = untag_ptr(this_ptr);
35373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35375         this_ptr_conv.is_owned = false;
35376         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
35377         uint64_tArray ret_arr = NULL;
35378         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
35379         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
35380         for (size_t z = 0; z < ret_var.datalen; z++) {
35381                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
35382                 uint64_t ret_conv_25_ref = 0;
35383                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
35384                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
35385                 ret_arr_ptr[z] = ret_conv_25_ref;
35386         }
35387         
35388         FREE(ret_var.data);
35389         return ret_arr;
35390 }
35391
35392 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) {
35393         LDKCommitmentUpdate this_ptr_conv;
35394         this_ptr_conv.inner = untag_ptr(this_ptr);
35395         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35397         this_ptr_conv.is_owned = false;
35398         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
35399         val_constr.datalen = val->arr_len;
35400         if (val_constr.datalen > 0)
35401                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
35402         else
35403                 val_constr.data = NULL;
35404         uint64_t* val_vals = val->elems;
35405         for (size_t z = 0; z < val_constr.datalen; z++) {
35406                 uint64_t val_conv_25 = val_vals[z];
35407                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
35408                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
35409                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
35410                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
35411                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
35412                 val_constr.data[z] = val_conv_25_conv;
35413         }
35414         FREE(val);
35415         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
35416 }
35417
35418 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_update_fee"))) TS_CommitmentUpdate_get_update_fee(uint64_t this_ptr) {
35419         LDKCommitmentUpdate this_ptr_conv;
35420         this_ptr_conv.inner = untag_ptr(this_ptr);
35421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35423         this_ptr_conv.is_owned = false;
35424         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
35425         uint64_t ret_ref = 0;
35426         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35427         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35428         return ret_ref;
35429 }
35430
35431 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fee"))) TS_CommitmentUpdate_set_update_fee(uint64_t this_ptr, uint64_t val) {
35432         LDKCommitmentUpdate this_ptr_conv;
35433         this_ptr_conv.inner = untag_ptr(this_ptr);
35434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35436         this_ptr_conv.is_owned = false;
35437         LDKUpdateFee val_conv;
35438         val_conv.inner = untag_ptr(val);
35439         val_conv.is_owned = ptr_is_owned(val);
35440         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35441         val_conv = UpdateFee_clone(&val_conv);
35442         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
35443 }
35444
35445 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_commitment_signed"))) TS_CommitmentUpdate_get_commitment_signed(uint64_t this_ptr) {
35446         LDKCommitmentUpdate this_ptr_conv;
35447         this_ptr_conv.inner = untag_ptr(this_ptr);
35448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35450         this_ptr_conv.is_owned = false;
35451         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
35452         uint64_t ret_ref = 0;
35453         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35454         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35455         return ret_ref;
35456 }
35457
35458 void  __attribute__((export_name("TS_CommitmentUpdate_set_commitment_signed"))) TS_CommitmentUpdate_set_commitment_signed(uint64_t this_ptr, uint64_t val) {
35459         LDKCommitmentUpdate this_ptr_conv;
35460         this_ptr_conv.inner = untag_ptr(this_ptr);
35461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35463         this_ptr_conv.is_owned = false;
35464         LDKCommitmentSigned val_conv;
35465         val_conv.inner = untag_ptr(val);
35466         val_conv.is_owned = ptr_is_owned(val);
35467         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35468         val_conv = CommitmentSigned_clone(&val_conv);
35469         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
35470 }
35471
35472 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) {
35473         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
35474         update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
35475         if (update_add_htlcs_arg_constr.datalen > 0)
35476                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
35477         else
35478                 update_add_htlcs_arg_constr.data = NULL;
35479         uint64_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
35480         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
35481                 uint64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
35482                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
35483                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
35484                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
35485                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
35486                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
35487                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
35488         }
35489         FREE(update_add_htlcs_arg);
35490         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
35491         update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
35492         if (update_fulfill_htlcs_arg_constr.datalen > 0)
35493                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
35494         else
35495                 update_fulfill_htlcs_arg_constr.data = NULL;
35496         uint64_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
35497         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
35498                 uint64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
35499                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
35500                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
35501                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
35502                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
35503                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
35504                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
35505         }
35506         FREE(update_fulfill_htlcs_arg);
35507         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
35508         update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
35509         if (update_fail_htlcs_arg_constr.datalen > 0)
35510                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
35511         else
35512                 update_fail_htlcs_arg_constr.data = NULL;
35513         uint64_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
35514         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
35515                 uint64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
35516                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
35517                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
35518                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
35519                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
35520                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
35521                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
35522         }
35523         FREE(update_fail_htlcs_arg);
35524         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
35525         update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
35526         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
35527                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
35528         else
35529                 update_fail_malformed_htlcs_arg_constr.data = NULL;
35530         uint64_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
35531         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
35532                 uint64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
35533                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
35534                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
35535                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
35536                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
35537                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
35538                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
35539         }
35540         FREE(update_fail_malformed_htlcs_arg);
35541         LDKUpdateFee update_fee_arg_conv;
35542         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
35543         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
35544         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
35545         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
35546         LDKCommitmentSigned commitment_signed_arg_conv;
35547         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
35548         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
35549         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
35550         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
35551         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);
35552         uint64_t ret_ref = 0;
35553         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35554         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35555         return ret_ref;
35556 }
35557
35558 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
35559         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
35560         uint64_t ret_ref = 0;
35561         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35562         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35563         return ret_ref;
35564 }
35565 int64_t  __attribute__((export_name("TS_CommitmentUpdate_clone_ptr"))) TS_CommitmentUpdate_clone_ptr(uint64_t arg) {
35566         LDKCommitmentUpdate arg_conv;
35567         arg_conv.inner = untag_ptr(arg);
35568         arg_conv.is_owned = ptr_is_owned(arg);
35569         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35570         arg_conv.is_owned = false;
35571         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
35572         return ret_conv;
35573 }
35574
35575 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_clone"))) TS_CommitmentUpdate_clone(uint64_t orig) {
35576         LDKCommitmentUpdate orig_conv;
35577         orig_conv.inner = untag_ptr(orig);
35578         orig_conv.is_owned = ptr_is_owned(orig);
35579         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35580         orig_conv.is_owned = false;
35581         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
35582         uint64_t ret_ref = 0;
35583         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35584         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35585         return ret_ref;
35586 }
35587
35588 jboolean  __attribute__((export_name("TS_CommitmentUpdate_eq"))) TS_CommitmentUpdate_eq(uint64_t a, uint64_t b) {
35589         LDKCommitmentUpdate a_conv;
35590         a_conv.inner = untag_ptr(a);
35591         a_conv.is_owned = ptr_is_owned(a);
35592         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35593         a_conv.is_owned = false;
35594         LDKCommitmentUpdate b_conv;
35595         b_conv.inner = untag_ptr(b);
35596         b_conv.is_owned = ptr_is_owned(b);
35597         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35598         b_conv.is_owned = false;
35599         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
35600         return ret_conv;
35601 }
35602
35603 void  __attribute__((export_name("TS_ChannelMessageHandler_free"))) TS_ChannelMessageHandler_free(uint64_t this_ptr) {
35604         if (!ptr_is_owned(this_ptr)) return;
35605         void* this_ptr_ptr = untag_ptr(this_ptr);
35606         CHECK_ACCESS(this_ptr_ptr);
35607         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
35608         FREE(untag_ptr(this_ptr));
35609         ChannelMessageHandler_free(this_ptr_conv);
35610 }
35611
35612 void  __attribute__((export_name("TS_RoutingMessageHandler_free"))) TS_RoutingMessageHandler_free(uint64_t this_ptr) {
35613         if (!ptr_is_owned(this_ptr)) return;
35614         void* this_ptr_ptr = untag_ptr(this_ptr);
35615         CHECK_ACCESS(this_ptr_ptr);
35616         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
35617         FREE(untag_ptr(this_ptr));
35618         RoutingMessageHandler_free(this_ptr_conv);
35619 }
35620
35621 void  __attribute__((export_name("TS_OnionMessageHandler_free"))) TS_OnionMessageHandler_free(uint64_t this_ptr) {
35622         if (!ptr_is_owned(this_ptr)) return;
35623         void* this_ptr_ptr = untag_ptr(this_ptr);
35624         CHECK_ACCESS(this_ptr_ptr);
35625         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
35626         FREE(untag_ptr(this_ptr));
35627         OnionMessageHandler_free(this_ptr_conv);
35628 }
35629
35630 int8_tArray  __attribute__((export_name("TS_AcceptChannel_write"))) TS_AcceptChannel_write(uint64_t obj) {
35631         LDKAcceptChannel obj_conv;
35632         obj_conv.inner = untag_ptr(obj);
35633         obj_conv.is_owned = ptr_is_owned(obj);
35634         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35635         obj_conv.is_owned = false;
35636         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
35637         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35638         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35639         CVec_u8Z_free(ret_var);
35640         return ret_arr;
35641 }
35642
35643 uint64_t  __attribute__((export_name("TS_AcceptChannel_read"))) TS_AcceptChannel_read(int8_tArray ser) {
35644         LDKu8slice ser_ref;
35645         ser_ref.datalen = ser->arr_len;
35646         ser_ref.data = ser->elems;
35647         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
35648         *ret_conv = AcceptChannel_read(ser_ref);
35649         FREE(ser);
35650         return tag_ptr(ret_conv, true);
35651 }
35652
35653 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_write"))) TS_AnnouncementSignatures_write(uint64_t obj) {
35654         LDKAnnouncementSignatures obj_conv;
35655         obj_conv.inner = untag_ptr(obj);
35656         obj_conv.is_owned = ptr_is_owned(obj);
35657         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35658         obj_conv.is_owned = false;
35659         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
35660         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35661         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35662         CVec_u8Z_free(ret_var);
35663         return ret_arr;
35664 }
35665
35666 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_read"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
35667         LDKu8slice ser_ref;
35668         ser_ref.datalen = ser->arr_len;
35669         ser_ref.data = ser->elems;
35670         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
35671         *ret_conv = AnnouncementSignatures_read(ser_ref);
35672         FREE(ser);
35673         return tag_ptr(ret_conv, true);
35674 }
35675
35676 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_write"))) TS_ChannelReestablish_write(uint64_t obj) {
35677         LDKChannelReestablish obj_conv;
35678         obj_conv.inner = untag_ptr(obj);
35679         obj_conv.is_owned = ptr_is_owned(obj);
35680         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35681         obj_conv.is_owned = false;
35682         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
35683         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35684         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35685         CVec_u8Z_free(ret_var);
35686         return ret_arr;
35687 }
35688
35689 uint64_t  __attribute__((export_name("TS_ChannelReestablish_read"))) TS_ChannelReestablish_read(int8_tArray ser) {
35690         LDKu8slice ser_ref;
35691         ser_ref.datalen = ser->arr_len;
35692         ser_ref.data = ser->elems;
35693         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
35694         *ret_conv = ChannelReestablish_read(ser_ref);
35695         FREE(ser);
35696         return tag_ptr(ret_conv, true);
35697 }
35698
35699 int8_tArray  __attribute__((export_name("TS_ClosingSigned_write"))) TS_ClosingSigned_write(uint64_t obj) {
35700         LDKClosingSigned obj_conv;
35701         obj_conv.inner = untag_ptr(obj);
35702         obj_conv.is_owned = ptr_is_owned(obj);
35703         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35704         obj_conv.is_owned = false;
35705         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
35706         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35707         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35708         CVec_u8Z_free(ret_var);
35709         return ret_arr;
35710 }
35711
35712 uint64_t  __attribute__((export_name("TS_ClosingSigned_read"))) TS_ClosingSigned_read(int8_tArray ser) {
35713         LDKu8slice ser_ref;
35714         ser_ref.datalen = ser->arr_len;
35715         ser_ref.data = ser->elems;
35716         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
35717         *ret_conv = ClosingSigned_read(ser_ref);
35718         FREE(ser);
35719         return tag_ptr(ret_conv, true);
35720 }
35721
35722 int8_tArray  __attribute__((export_name("TS_ClosingSignedFeeRange_write"))) TS_ClosingSignedFeeRange_write(uint64_t obj) {
35723         LDKClosingSignedFeeRange obj_conv;
35724         obj_conv.inner = untag_ptr(obj);
35725         obj_conv.is_owned = ptr_is_owned(obj);
35726         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35727         obj_conv.is_owned = false;
35728         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
35729         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35730         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35731         CVec_u8Z_free(ret_var);
35732         return ret_arr;
35733 }
35734
35735 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_read"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
35736         LDKu8slice ser_ref;
35737         ser_ref.datalen = ser->arr_len;
35738         ser_ref.data = ser->elems;
35739         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
35740         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
35741         FREE(ser);
35742         return tag_ptr(ret_conv, true);
35743 }
35744
35745 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_write"))) TS_CommitmentSigned_write(uint64_t obj) {
35746         LDKCommitmentSigned obj_conv;
35747         obj_conv.inner = untag_ptr(obj);
35748         obj_conv.is_owned = ptr_is_owned(obj);
35749         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35750         obj_conv.is_owned = false;
35751         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
35752         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35753         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35754         CVec_u8Z_free(ret_var);
35755         return ret_arr;
35756 }
35757
35758 uint64_t  __attribute__((export_name("TS_CommitmentSigned_read"))) TS_CommitmentSigned_read(int8_tArray ser) {
35759         LDKu8slice ser_ref;
35760         ser_ref.datalen = ser->arr_len;
35761         ser_ref.data = ser->elems;
35762         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
35763         *ret_conv = CommitmentSigned_read(ser_ref);
35764         FREE(ser);
35765         return tag_ptr(ret_conv, true);
35766 }
35767
35768 int8_tArray  __attribute__((export_name("TS_FundingCreated_write"))) TS_FundingCreated_write(uint64_t obj) {
35769         LDKFundingCreated obj_conv;
35770         obj_conv.inner = untag_ptr(obj);
35771         obj_conv.is_owned = ptr_is_owned(obj);
35772         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35773         obj_conv.is_owned = false;
35774         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
35775         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35776         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35777         CVec_u8Z_free(ret_var);
35778         return ret_arr;
35779 }
35780
35781 uint64_t  __attribute__((export_name("TS_FundingCreated_read"))) TS_FundingCreated_read(int8_tArray ser) {
35782         LDKu8slice ser_ref;
35783         ser_ref.datalen = ser->arr_len;
35784         ser_ref.data = ser->elems;
35785         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
35786         *ret_conv = FundingCreated_read(ser_ref);
35787         FREE(ser);
35788         return tag_ptr(ret_conv, true);
35789 }
35790
35791 int8_tArray  __attribute__((export_name("TS_FundingSigned_write"))) TS_FundingSigned_write(uint64_t obj) {
35792         LDKFundingSigned obj_conv;
35793         obj_conv.inner = untag_ptr(obj);
35794         obj_conv.is_owned = ptr_is_owned(obj);
35795         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35796         obj_conv.is_owned = false;
35797         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
35798         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35799         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35800         CVec_u8Z_free(ret_var);
35801         return ret_arr;
35802 }
35803
35804 uint64_t  __attribute__((export_name("TS_FundingSigned_read"))) TS_FundingSigned_read(int8_tArray ser) {
35805         LDKu8slice ser_ref;
35806         ser_ref.datalen = ser->arr_len;
35807         ser_ref.data = ser->elems;
35808         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
35809         *ret_conv = FundingSigned_read(ser_ref);
35810         FREE(ser);
35811         return tag_ptr(ret_conv, true);
35812 }
35813
35814 int8_tArray  __attribute__((export_name("TS_ChannelReady_write"))) TS_ChannelReady_write(uint64_t obj) {
35815         LDKChannelReady obj_conv;
35816         obj_conv.inner = untag_ptr(obj);
35817         obj_conv.is_owned = ptr_is_owned(obj);
35818         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35819         obj_conv.is_owned = false;
35820         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
35821         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35822         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35823         CVec_u8Z_free(ret_var);
35824         return ret_arr;
35825 }
35826
35827 uint64_t  __attribute__((export_name("TS_ChannelReady_read"))) TS_ChannelReady_read(int8_tArray ser) {
35828         LDKu8slice ser_ref;
35829         ser_ref.datalen = ser->arr_len;
35830         ser_ref.data = ser->elems;
35831         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
35832         *ret_conv = ChannelReady_read(ser_ref);
35833         FREE(ser);
35834         return tag_ptr(ret_conv, true);
35835 }
35836
35837 int8_tArray  __attribute__((export_name("TS_Init_write"))) TS_Init_write(uint64_t obj) {
35838         LDKInit obj_conv;
35839         obj_conv.inner = untag_ptr(obj);
35840         obj_conv.is_owned = ptr_is_owned(obj);
35841         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35842         obj_conv.is_owned = false;
35843         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
35844         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35845         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35846         CVec_u8Z_free(ret_var);
35847         return ret_arr;
35848 }
35849
35850 uint64_t  __attribute__((export_name("TS_Init_read"))) TS_Init_read(int8_tArray ser) {
35851         LDKu8slice ser_ref;
35852         ser_ref.datalen = ser->arr_len;
35853         ser_ref.data = ser->elems;
35854         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
35855         *ret_conv = Init_read(ser_ref);
35856         FREE(ser);
35857         return tag_ptr(ret_conv, true);
35858 }
35859
35860 int8_tArray  __attribute__((export_name("TS_OpenChannel_write"))) TS_OpenChannel_write(uint64_t obj) {
35861         LDKOpenChannel obj_conv;
35862         obj_conv.inner = untag_ptr(obj);
35863         obj_conv.is_owned = ptr_is_owned(obj);
35864         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35865         obj_conv.is_owned = false;
35866         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
35867         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35868         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35869         CVec_u8Z_free(ret_var);
35870         return ret_arr;
35871 }
35872
35873 uint64_t  __attribute__((export_name("TS_OpenChannel_read"))) TS_OpenChannel_read(int8_tArray ser) {
35874         LDKu8slice ser_ref;
35875         ser_ref.datalen = ser->arr_len;
35876         ser_ref.data = ser->elems;
35877         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
35878         *ret_conv = OpenChannel_read(ser_ref);
35879         FREE(ser);
35880         return tag_ptr(ret_conv, true);
35881 }
35882
35883 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_write"))) TS_RevokeAndACK_write(uint64_t obj) {
35884         LDKRevokeAndACK obj_conv;
35885         obj_conv.inner = untag_ptr(obj);
35886         obj_conv.is_owned = ptr_is_owned(obj);
35887         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35888         obj_conv.is_owned = false;
35889         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
35890         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35891         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35892         CVec_u8Z_free(ret_var);
35893         return ret_arr;
35894 }
35895
35896 uint64_t  __attribute__((export_name("TS_RevokeAndACK_read"))) TS_RevokeAndACK_read(int8_tArray ser) {
35897         LDKu8slice ser_ref;
35898         ser_ref.datalen = ser->arr_len;
35899         ser_ref.data = ser->elems;
35900         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
35901         *ret_conv = RevokeAndACK_read(ser_ref);
35902         FREE(ser);
35903         return tag_ptr(ret_conv, true);
35904 }
35905
35906 int8_tArray  __attribute__((export_name("TS_Shutdown_write"))) TS_Shutdown_write(uint64_t obj) {
35907         LDKShutdown obj_conv;
35908         obj_conv.inner = untag_ptr(obj);
35909         obj_conv.is_owned = ptr_is_owned(obj);
35910         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35911         obj_conv.is_owned = false;
35912         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
35913         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35914         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35915         CVec_u8Z_free(ret_var);
35916         return ret_arr;
35917 }
35918
35919 uint64_t  __attribute__((export_name("TS_Shutdown_read"))) TS_Shutdown_read(int8_tArray ser) {
35920         LDKu8slice ser_ref;
35921         ser_ref.datalen = ser->arr_len;
35922         ser_ref.data = ser->elems;
35923         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
35924         *ret_conv = Shutdown_read(ser_ref);
35925         FREE(ser);
35926         return tag_ptr(ret_conv, true);
35927 }
35928
35929 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_write"))) TS_UpdateFailHTLC_write(uint64_t obj) {
35930         LDKUpdateFailHTLC obj_conv;
35931         obj_conv.inner = untag_ptr(obj);
35932         obj_conv.is_owned = ptr_is_owned(obj);
35933         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35934         obj_conv.is_owned = false;
35935         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
35936         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35937         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35938         CVec_u8Z_free(ret_var);
35939         return ret_arr;
35940 }
35941
35942 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_read"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
35943         LDKu8slice ser_ref;
35944         ser_ref.datalen = ser->arr_len;
35945         ser_ref.data = ser->elems;
35946         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
35947         *ret_conv = UpdateFailHTLC_read(ser_ref);
35948         FREE(ser);
35949         return tag_ptr(ret_conv, true);
35950 }
35951
35952 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_write"))) TS_UpdateFailMalformedHTLC_write(uint64_t obj) {
35953         LDKUpdateFailMalformedHTLC obj_conv;
35954         obj_conv.inner = untag_ptr(obj);
35955         obj_conv.is_owned = ptr_is_owned(obj);
35956         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35957         obj_conv.is_owned = false;
35958         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
35959         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35960         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35961         CVec_u8Z_free(ret_var);
35962         return ret_arr;
35963 }
35964
35965 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_read"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
35966         LDKu8slice ser_ref;
35967         ser_ref.datalen = ser->arr_len;
35968         ser_ref.data = ser->elems;
35969         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
35970         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
35971         FREE(ser);
35972         return tag_ptr(ret_conv, true);
35973 }
35974
35975 int8_tArray  __attribute__((export_name("TS_UpdateFee_write"))) TS_UpdateFee_write(uint64_t obj) {
35976         LDKUpdateFee obj_conv;
35977         obj_conv.inner = untag_ptr(obj);
35978         obj_conv.is_owned = ptr_is_owned(obj);
35979         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35980         obj_conv.is_owned = false;
35981         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
35982         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35983         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35984         CVec_u8Z_free(ret_var);
35985         return ret_arr;
35986 }
35987
35988 uint64_t  __attribute__((export_name("TS_UpdateFee_read"))) TS_UpdateFee_read(int8_tArray ser) {
35989         LDKu8slice ser_ref;
35990         ser_ref.datalen = ser->arr_len;
35991         ser_ref.data = ser->elems;
35992         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
35993         *ret_conv = UpdateFee_read(ser_ref);
35994         FREE(ser);
35995         return tag_ptr(ret_conv, true);
35996 }
35997
35998 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_write"))) TS_UpdateFulfillHTLC_write(uint64_t obj) {
35999         LDKUpdateFulfillHTLC obj_conv;
36000         obj_conv.inner = untag_ptr(obj);
36001         obj_conv.is_owned = ptr_is_owned(obj);
36002         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36003         obj_conv.is_owned = false;
36004         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
36005         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36006         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36007         CVec_u8Z_free(ret_var);
36008         return ret_arr;
36009 }
36010
36011 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_read"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
36012         LDKu8slice ser_ref;
36013         ser_ref.datalen = ser->arr_len;
36014         ser_ref.data = ser->elems;
36015         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
36016         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
36017         FREE(ser);
36018         return tag_ptr(ret_conv, true);
36019 }
36020
36021 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_write"))) TS_UpdateAddHTLC_write(uint64_t obj) {
36022         LDKUpdateAddHTLC obj_conv;
36023         obj_conv.inner = untag_ptr(obj);
36024         obj_conv.is_owned = ptr_is_owned(obj);
36025         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36026         obj_conv.is_owned = false;
36027         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
36028         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36029         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36030         CVec_u8Z_free(ret_var);
36031         return ret_arr;
36032 }
36033
36034 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_read"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
36035         LDKu8slice ser_ref;
36036         ser_ref.datalen = ser->arr_len;
36037         ser_ref.data = ser->elems;
36038         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
36039         *ret_conv = UpdateAddHTLC_read(ser_ref);
36040         FREE(ser);
36041         return tag_ptr(ret_conv, true);
36042 }
36043
36044 uint64_t  __attribute__((export_name("TS_OnionMessage_read"))) TS_OnionMessage_read(int8_tArray ser) {
36045         LDKu8slice ser_ref;
36046         ser_ref.datalen = ser->arr_len;
36047         ser_ref.data = ser->elems;
36048         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
36049         *ret_conv = OnionMessage_read(ser_ref);
36050         FREE(ser);
36051         return tag_ptr(ret_conv, true);
36052 }
36053
36054 int8_tArray  __attribute__((export_name("TS_OnionMessage_write"))) TS_OnionMessage_write(uint64_t obj) {
36055         LDKOnionMessage obj_conv;
36056         obj_conv.inner = untag_ptr(obj);
36057         obj_conv.is_owned = ptr_is_owned(obj);
36058         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36059         obj_conv.is_owned = false;
36060         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
36061         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36062         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36063         CVec_u8Z_free(ret_var);
36064         return ret_arr;
36065 }
36066
36067 int8_tArray  __attribute__((export_name("TS_Ping_write"))) TS_Ping_write(uint64_t obj) {
36068         LDKPing obj_conv;
36069         obj_conv.inner = untag_ptr(obj);
36070         obj_conv.is_owned = ptr_is_owned(obj);
36071         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36072         obj_conv.is_owned = false;
36073         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
36074         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36075         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36076         CVec_u8Z_free(ret_var);
36077         return ret_arr;
36078 }
36079
36080 uint64_t  __attribute__((export_name("TS_Ping_read"))) TS_Ping_read(int8_tArray ser) {
36081         LDKu8slice ser_ref;
36082         ser_ref.datalen = ser->arr_len;
36083         ser_ref.data = ser->elems;
36084         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
36085         *ret_conv = Ping_read(ser_ref);
36086         FREE(ser);
36087         return tag_ptr(ret_conv, true);
36088 }
36089
36090 int8_tArray  __attribute__((export_name("TS_Pong_write"))) TS_Pong_write(uint64_t obj) {
36091         LDKPong obj_conv;
36092         obj_conv.inner = untag_ptr(obj);
36093         obj_conv.is_owned = ptr_is_owned(obj);
36094         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36095         obj_conv.is_owned = false;
36096         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
36097         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36098         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36099         CVec_u8Z_free(ret_var);
36100         return ret_arr;
36101 }
36102
36103 uint64_t  __attribute__((export_name("TS_Pong_read"))) TS_Pong_read(int8_tArray ser) {
36104         LDKu8slice ser_ref;
36105         ser_ref.datalen = ser->arr_len;
36106         ser_ref.data = ser->elems;
36107         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
36108         *ret_conv = Pong_read(ser_ref);
36109         FREE(ser);
36110         return tag_ptr(ret_conv, true);
36111 }
36112
36113 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_write"))) TS_UnsignedChannelAnnouncement_write(uint64_t obj) {
36114         LDKUnsignedChannelAnnouncement obj_conv;
36115         obj_conv.inner = untag_ptr(obj);
36116         obj_conv.is_owned = ptr_is_owned(obj);
36117         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36118         obj_conv.is_owned = false;
36119         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
36120         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36121         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36122         CVec_u8Z_free(ret_var);
36123         return ret_arr;
36124 }
36125
36126 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_read"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
36127         LDKu8slice ser_ref;
36128         ser_ref.datalen = ser->arr_len;
36129         ser_ref.data = ser->elems;
36130         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
36131         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
36132         FREE(ser);
36133         return tag_ptr(ret_conv, true);
36134 }
36135
36136 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_write"))) TS_ChannelAnnouncement_write(uint64_t obj) {
36137         LDKChannelAnnouncement obj_conv;
36138         obj_conv.inner = untag_ptr(obj);
36139         obj_conv.is_owned = ptr_is_owned(obj);
36140         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36141         obj_conv.is_owned = false;
36142         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
36143         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36144         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36145         CVec_u8Z_free(ret_var);
36146         return ret_arr;
36147 }
36148
36149 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_read"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
36150         LDKu8slice ser_ref;
36151         ser_ref.datalen = ser->arr_len;
36152         ser_ref.data = ser->elems;
36153         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
36154         *ret_conv = ChannelAnnouncement_read(ser_ref);
36155         FREE(ser);
36156         return tag_ptr(ret_conv, true);
36157 }
36158
36159 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_write"))) TS_UnsignedChannelUpdate_write(uint64_t obj) {
36160         LDKUnsignedChannelUpdate obj_conv;
36161         obj_conv.inner = untag_ptr(obj);
36162         obj_conv.is_owned = ptr_is_owned(obj);
36163         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36164         obj_conv.is_owned = false;
36165         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
36166         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36167         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36168         CVec_u8Z_free(ret_var);
36169         return ret_arr;
36170 }
36171
36172 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_read"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
36173         LDKu8slice ser_ref;
36174         ser_ref.datalen = ser->arr_len;
36175         ser_ref.data = ser->elems;
36176         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
36177         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
36178         FREE(ser);
36179         return tag_ptr(ret_conv, true);
36180 }
36181
36182 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_write"))) TS_ChannelUpdate_write(uint64_t obj) {
36183         LDKChannelUpdate obj_conv;
36184         obj_conv.inner = untag_ptr(obj);
36185         obj_conv.is_owned = ptr_is_owned(obj);
36186         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36187         obj_conv.is_owned = false;
36188         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
36189         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36190         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36191         CVec_u8Z_free(ret_var);
36192         return ret_arr;
36193 }
36194
36195 uint64_t  __attribute__((export_name("TS_ChannelUpdate_read"))) TS_ChannelUpdate_read(int8_tArray ser) {
36196         LDKu8slice ser_ref;
36197         ser_ref.datalen = ser->arr_len;
36198         ser_ref.data = ser->elems;
36199         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
36200         *ret_conv = ChannelUpdate_read(ser_ref);
36201         FREE(ser);
36202         return tag_ptr(ret_conv, true);
36203 }
36204
36205 int8_tArray  __attribute__((export_name("TS_ErrorMessage_write"))) TS_ErrorMessage_write(uint64_t obj) {
36206         LDKErrorMessage obj_conv;
36207         obj_conv.inner = untag_ptr(obj);
36208         obj_conv.is_owned = ptr_is_owned(obj);
36209         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36210         obj_conv.is_owned = false;
36211         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
36212         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36213         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36214         CVec_u8Z_free(ret_var);
36215         return ret_arr;
36216 }
36217
36218 uint64_t  __attribute__((export_name("TS_ErrorMessage_read"))) TS_ErrorMessage_read(int8_tArray ser) {
36219         LDKu8slice ser_ref;
36220         ser_ref.datalen = ser->arr_len;
36221         ser_ref.data = ser->elems;
36222         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
36223         *ret_conv = ErrorMessage_read(ser_ref);
36224         FREE(ser);
36225         return tag_ptr(ret_conv, true);
36226 }
36227
36228 int8_tArray  __attribute__((export_name("TS_WarningMessage_write"))) TS_WarningMessage_write(uint64_t obj) {
36229         LDKWarningMessage obj_conv;
36230         obj_conv.inner = untag_ptr(obj);
36231         obj_conv.is_owned = ptr_is_owned(obj);
36232         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36233         obj_conv.is_owned = false;
36234         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
36235         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36236         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36237         CVec_u8Z_free(ret_var);
36238         return ret_arr;
36239 }
36240
36241 uint64_t  __attribute__((export_name("TS_WarningMessage_read"))) TS_WarningMessage_read(int8_tArray ser) {
36242         LDKu8slice ser_ref;
36243         ser_ref.datalen = ser->arr_len;
36244         ser_ref.data = ser->elems;
36245         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
36246         *ret_conv = WarningMessage_read(ser_ref);
36247         FREE(ser);
36248         return tag_ptr(ret_conv, true);
36249 }
36250
36251 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_write"))) TS_UnsignedNodeAnnouncement_write(uint64_t obj) {
36252         LDKUnsignedNodeAnnouncement obj_conv;
36253         obj_conv.inner = untag_ptr(obj);
36254         obj_conv.is_owned = ptr_is_owned(obj);
36255         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36256         obj_conv.is_owned = false;
36257         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
36258         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36259         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36260         CVec_u8Z_free(ret_var);
36261         return ret_arr;
36262 }
36263
36264 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_read"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
36265         LDKu8slice ser_ref;
36266         ser_ref.datalen = ser->arr_len;
36267         ser_ref.data = ser->elems;
36268         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
36269         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
36270         FREE(ser);
36271         return tag_ptr(ret_conv, true);
36272 }
36273
36274 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_write"))) TS_NodeAnnouncement_write(uint64_t obj) {
36275         LDKNodeAnnouncement obj_conv;
36276         obj_conv.inner = untag_ptr(obj);
36277         obj_conv.is_owned = ptr_is_owned(obj);
36278         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36279         obj_conv.is_owned = false;
36280         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
36281         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36282         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36283         CVec_u8Z_free(ret_var);
36284         return ret_arr;
36285 }
36286
36287 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_read"))) TS_NodeAnnouncement_read(int8_tArray ser) {
36288         LDKu8slice ser_ref;
36289         ser_ref.datalen = ser->arr_len;
36290         ser_ref.data = ser->elems;
36291         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
36292         *ret_conv = NodeAnnouncement_read(ser_ref);
36293         FREE(ser);
36294         return tag_ptr(ret_conv, true);
36295 }
36296
36297 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_read"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
36298         LDKu8slice ser_ref;
36299         ser_ref.datalen = ser->arr_len;
36300         ser_ref.data = ser->elems;
36301         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
36302         *ret_conv = QueryShortChannelIds_read(ser_ref);
36303         FREE(ser);
36304         return tag_ptr(ret_conv, true);
36305 }
36306
36307 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_write"))) TS_QueryShortChannelIds_write(uint64_t obj) {
36308         LDKQueryShortChannelIds obj_conv;
36309         obj_conv.inner = untag_ptr(obj);
36310         obj_conv.is_owned = ptr_is_owned(obj);
36311         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36312         obj_conv.is_owned = false;
36313         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
36314         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36315         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36316         CVec_u8Z_free(ret_var);
36317         return ret_arr;
36318 }
36319
36320 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_write"))) TS_ReplyShortChannelIdsEnd_write(uint64_t obj) {
36321         LDKReplyShortChannelIdsEnd obj_conv;
36322         obj_conv.inner = untag_ptr(obj);
36323         obj_conv.is_owned = ptr_is_owned(obj);
36324         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36325         obj_conv.is_owned = false;
36326         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
36327         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36328         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36329         CVec_u8Z_free(ret_var);
36330         return ret_arr;
36331 }
36332
36333 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_read"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
36334         LDKu8slice ser_ref;
36335         ser_ref.datalen = ser->arr_len;
36336         ser_ref.data = ser->elems;
36337         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
36338         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
36339         FREE(ser);
36340         return tag_ptr(ret_conv, true);
36341 }
36342
36343 int32_t  __attribute__((export_name("TS_QueryChannelRange_end_blocknum"))) TS_QueryChannelRange_end_blocknum(uint64_t this_arg) {
36344         LDKQueryChannelRange this_arg_conv;
36345         this_arg_conv.inner = untag_ptr(this_arg);
36346         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36348         this_arg_conv.is_owned = false;
36349         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
36350         return ret_conv;
36351 }
36352
36353 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_write"))) TS_QueryChannelRange_write(uint64_t obj) {
36354         LDKQueryChannelRange obj_conv;
36355         obj_conv.inner = untag_ptr(obj);
36356         obj_conv.is_owned = ptr_is_owned(obj);
36357         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36358         obj_conv.is_owned = false;
36359         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
36360         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36361         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36362         CVec_u8Z_free(ret_var);
36363         return ret_arr;
36364 }
36365
36366 uint64_t  __attribute__((export_name("TS_QueryChannelRange_read"))) TS_QueryChannelRange_read(int8_tArray ser) {
36367         LDKu8slice ser_ref;
36368         ser_ref.datalen = ser->arr_len;
36369         ser_ref.data = ser->elems;
36370         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
36371         *ret_conv = QueryChannelRange_read(ser_ref);
36372         FREE(ser);
36373         return tag_ptr(ret_conv, true);
36374 }
36375
36376 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_read"))) TS_ReplyChannelRange_read(int8_tArray ser) {
36377         LDKu8slice ser_ref;
36378         ser_ref.datalen = ser->arr_len;
36379         ser_ref.data = ser->elems;
36380         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
36381         *ret_conv = ReplyChannelRange_read(ser_ref);
36382         FREE(ser);
36383         return tag_ptr(ret_conv, true);
36384 }
36385
36386 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_write"))) TS_ReplyChannelRange_write(uint64_t obj) {
36387         LDKReplyChannelRange obj_conv;
36388         obj_conv.inner = untag_ptr(obj);
36389         obj_conv.is_owned = ptr_is_owned(obj);
36390         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36391         obj_conv.is_owned = false;
36392         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
36393         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36394         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36395         CVec_u8Z_free(ret_var);
36396         return ret_arr;
36397 }
36398
36399 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_write"))) TS_GossipTimestampFilter_write(uint64_t obj) {
36400         LDKGossipTimestampFilter obj_conv;
36401         obj_conv.inner = untag_ptr(obj);
36402         obj_conv.is_owned = ptr_is_owned(obj);
36403         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36404         obj_conv.is_owned = false;
36405         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
36406         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36407         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36408         CVec_u8Z_free(ret_var);
36409         return ret_arr;
36410 }
36411
36412 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_read"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
36413         LDKu8slice ser_ref;
36414         ser_ref.datalen = ser->arr_len;
36415         ser_ref.data = ser->elems;
36416         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
36417         *ret_conv = GossipTimestampFilter_read(ser_ref);
36418         FREE(ser);
36419         return tag_ptr(ret_conv, true);
36420 }
36421
36422 void  __attribute__((export_name("TS_CustomMessageHandler_free"))) TS_CustomMessageHandler_free(uint64_t this_ptr) {
36423         if (!ptr_is_owned(this_ptr)) return;
36424         void* this_ptr_ptr = untag_ptr(this_ptr);
36425         CHECK_ACCESS(this_ptr_ptr);
36426         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
36427         FREE(untag_ptr(this_ptr));
36428         CustomMessageHandler_free(this_ptr_conv);
36429 }
36430
36431 void  __attribute__((export_name("TS_IgnoringMessageHandler_free"))) TS_IgnoringMessageHandler_free(uint64_t this_obj) {
36432         LDKIgnoringMessageHandler this_obj_conv;
36433         this_obj_conv.inner = untag_ptr(this_obj);
36434         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36436         IgnoringMessageHandler_free(this_obj_conv);
36437 }
36438
36439 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_new"))) TS_IgnoringMessageHandler_new() {
36440         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
36441         uint64_t ret_ref = 0;
36442         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36443         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36444         return ret_ref;
36445 }
36446
36447 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_MessageSendEventsProvider"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
36448         LDKIgnoringMessageHandler this_arg_conv;
36449         this_arg_conv.inner = untag_ptr(this_arg);
36450         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36452         this_arg_conv.is_owned = false;
36453         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
36454         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
36455         return tag_ptr(ret_ret, true);
36456 }
36457
36458 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_RoutingMessageHandler"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint64_t this_arg) {
36459         LDKIgnoringMessageHandler this_arg_conv;
36460         this_arg_conv.inner = untag_ptr(this_arg);
36461         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36463         this_arg_conv.is_owned = false;
36464         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
36465         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
36466         return tag_ptr(ret_ret, true);
36467 }
36468
36469 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageProvider"))) TS_IgnoringMessageHandler_as_OnionMessageProvider(uint64_t this_arg) {
36470         LDKIgnoringMessageHandler this_arg_conv;
36471         this_arg_conv.inner = untag_ptr(this_arg);
36472         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36474         this_arg_conv.is_owned = false;
36475         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
36476         *ret_ret = IgnoringMessageHandler_as_OnionMessageProvider(&this_arg_conv);
36477         return tag_ptr(ret_ret, true);
36478 }
36479
36480 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageHandler"))) TS_IgnoringMessageHandler_as_OnionMessageHandler(uint64_t this_arg) {
36481         LDKIgnoringMessageHandler this_arg_conv;
36482         this_arg_conv.inner = untag_ptr(this_arg);
36483         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36485         this_arg_conv.is_owned = false;
36486         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
36487         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
36488         return tag_ptr(ret_ret, true);
36489 }
36490
36491 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomOnionMessageHandler"))) TS_IgnoringMessageHandler_as_CustomOnionMessageHandler(uint64_t this_arg) {
36492         LDKIgnoringMessageHandler this_arg_conv;
36493         this_arg_conv.inner = untag_ptr(this_arg);
36494         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36496         this_arg_conv.is_owned = false;
36497         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
36498         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
36499         return tag_ptr(ret_ret, true);
36500 }
36501
36502 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageReader"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint64_t this_arg) {
36503         LDKIgnoringMessageHandler this_arg_conv;
36504         this_arg_conv.inner = untag_ptr(this_arg);
36505         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36507         this_arg_conv.is_owned = false;
36508         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
36509         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
36510         return tag_ptr(ret_ret, true);
36511 }
36512
36513 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageHandler"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint64_t this_arg) {
36514         LDKIgnoringMessageHandler this_arg_conv;
36515         this_arg_conv.inner = untag_ptr(this_arg);
36516         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36518         this_arg_conv.is_owned = false;
36519         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
36520         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
36521         return tag_ptr(ret_ret, true);
36522 }
36523
36524 void  __attribute__((export_name("TS_ErroringMessageHandler_free"))) TS_ErroringMessageHandler_free(uint64_t this_obj) {
36525         LDKErroringMessageHandler this_obj_conv;
36526         this_obj_conv.inner = untag_ptr(this_obj);
36527         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36529         ErroringMessageHandler_free(this_obj_conv);
36530 }
36531
36532 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_new"))) TS_ErroringMessageHandler_new() {
36533         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
36534         uint64_t ret_ref = 0;
36535         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36536         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36537         return ret_ref;
36538 }
36539
36540 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_MessageSendEventsProvider"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
36541         LDKErroringMessageHandler this_arg_conv;
36542         this_arg_conv.inner = untag_ptr(this_arg);
36543         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36545         this_arg_conv.is_owned = false;
36546         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
36547         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
36548         return tag_ptr(ret_ret, true);
36549 }
36550
36551 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_ChannelMessageHandler"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint64_t this_arg) {
36552         LDKErroringMessageHandler this_arg_conv;
36553         this_arg_conv.inner = untag_ptr(this_arg);
36554         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36556         this_arg_conv.is_owned = false;
36557         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
36558         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
36559         return tag_ptr(ret_ret, true);
36560 }
36561
36562 void  __attribute__((export_name("TS_MessageHandler_free"))) TS_MessageHandler_free(uint64_t this_obj) {
36563         LDKMessageHandler this_obj_conv;
36564         this_obj_conv.inner = untag_ptr(this_obj);
36565         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36567         MessageHandler_free(this_obj_conv);
36568 }
36569
36570 uint64_t  __attribute__((export_name("TS_MessageHandler_get_chan_handler"))) TS_MessageHandler_get_chan_handler(uint64_t this_ptr) {
36571         LDKMessageHandler this_ptr_conv;
36572         this_ptr_conv.inner = untag_ptr(this_ptr);
36573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36575         this_ptr_conv.is_owned = false;
36576         // WARNING: This object doesn't live past this scope, needs clone!
36577         uint64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
36578         return ret_ret;
36579 }
36580
36581 void  __attribute__((export_name("TS_MessageHandler_set_chan_handler"))) TS_MessageHandler_set_chan_handler(uint64_t this_ptr, uint64_t val) {
36582         LDKMessageHandler this_ptr_conv;
36583         this_ptr_conv.inner = untag_ptr(this_ptr);
36584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36586         this_ptr_conv.is_owned = false;
36587         void* val_ptr = untag_ptr(val);
36588         CHECK_ACCESS(val_ptr);
36589         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
36590         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
36591                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36592                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
36593         }
36594         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
36595 }
36596
36597 uint64_t  __attribute__((export_name("TS_MessageHandler_get_route_handler"))) TS_MessageHandler_get_route_handler(uint64_t this_ptr) {
36598         LDKMessageHandler this_ptr_conv;
36599         this_ptr_conv.inner = untag_ptr(this_ptr);
36600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36602         this_ptr_conv.is_owned = false;
36603         // WARNING: This object doesn't live past this scope, needs clone!
36604         uint64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
36605         return ret_ret;
36606 }
36607
36608 void  __attribute__((export_name("TS_MessageHandler_set_route_handler"))) TS_MessageHandler_set_route_handler(uint64_t this_ptr, uint64_t val) {
36609         LDKMessageHandler this_ptr_conv;
36610         this_ptr_conv.inner = untag_ptr(this_ptr);
36611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36613         this_ptr_conv.is_owned = false;
36614         void* val_ptr = untag_ptr(val);
36615         CHECK_ACCESS(val_ptr);
36616         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
36617         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
36618                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36619                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
36620         }
36621         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
36622 }
36623
36624 uint64_t  __attribute__((export_name("TS_MessageHandler_get_onion_message_handler"))) TS_MessageHandler_get_onion_message_handler(uint64_t this_ptr) {
36625         LDKMessageHandler this_ptr_conv;
36626         this_ptr_conv.inner = untag_ptr(this_ptr);
36627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36629         this_ptr_conv.is_owned = false;
36630         // WARNING: This object doesn't live past this scope, needs clone!
36631         uint64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
36632         return ret_ret;
36633 }
36634
36635 void  __attribute__((export_name("TS_MessageHandler_set_onion_message_handler"))) TS_MessageHandler_set_onion_message_handler(uint64_t this_ptr, uint64_t val) {
36636         LDKMessageHandler this_ptr_conv;
36637         this_ptr_conv.inner = untag_ptr(this_ptr);
36638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36640         this_ptr_conv.is_owned = false;
36641         void* val_ptr = untag_ptr(val);
36642         CHECK_ACCESS(val_ptr);
36643         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
36644         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
36645                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36646                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
36647         }
36648         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
36649 }
36650
36651 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) {
36652         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
36653         CHECK_ACCESS(chan_handler_arg_ptr);
36654         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
36655         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
36656                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36657                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
36658         }
36659         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
36660         CHECK_ACCESS(route_handler_arg_ptr);
36661         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
36662         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
36663                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36664                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
36665         }
36666         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
36667         CHECK_ACCESS(onion_message_handler_arg_ptr);
36668         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
36669         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
36670                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36671                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
36672         }
36673         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv);
36674         uint64_t ret_ref = 0;
36675         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36676         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36677         return ret_ref;
36678 }
36679
36680 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
36681         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
36682         *ret_ret = SocketDescriptor_clone(arg);
36683         return tag_ptr(ret_ret, true);
36684 }
36685 int64_t  __attribute__((export_name("TS_SocketDescriptor_clone_ptr"))) TS_SocketDescriptor_clone_ptr(uint64_t arg) {
36686         void* arg_ptr = untag_ptr(arg);
36687         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
36688         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
36689         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
36690         return ret_conv;
36691 }
36692
36693 uint64_t  __attribute__((export_name("TS_SocketDescriptor_clone"))) TS_SocketDescriptor_clone(uint64_t orig) {
36694         void* orig_ptr = untag_ptr(orig);
36695         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
36696         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
36697         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
36698         *ret_ret = SocketDescriptor_clone(orig_conv);
36699         return tag_ptr(ret_ret, true);
36700 }
36701
36702 void  __attribute__((export_name("TS_SocketDescriptor_free"))) TS_SocketDescriptor_free(uint64_t this_ptr) {
36703         if (!ptr_is_owned(this_ptr)) return;
36704         void* this_ptr_ptr = untag_ptr(this_ptr);
36705         CHECK_ACCESS(this_ptr_ptr);
36706         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
36707         FREE(untag_ptr(this_ptr));
36708         SocketDescriptor_free(this_ptr_conv);
36709 }
36710
36711 void  __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError_free(uint64_t this_obj) {
36712         LDKPeerHandleError this_obj_conv;
36713         this_obj_conv.inner = untag_ptr(this_obj);
36714         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36716         PeerHandleError_free(this_obj_conv);
36717 }
36718
36719 jboolean  __attribute__((export_name("TS_PeerHandleError_get_no_connection_possible"))) TS_PeerHandleError_get_no_connection_possible(uint64_t this_ptr) {
36720         LDKPeerHandleError this_ptr_conv;
36721         this_ptr_conv.inner = untag_ptr(this_ptr);
36722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36724         this_ptr_conv.is_owned = false;
36725         jboolean ret_conv = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
36726         return ret_conv;
36727 }
36728
36729 void  __attribute__((export_name("TS_PeerHandleError_set_no_connection_possible"))) TS_PeerHandleError_set_no_connection_possible(uint64_t this_ptr, jboolean val) {
36730         LDKPeerHandleError this_ptr_conv;
36731         this_ptr_conv.inner = untag_ptr(this_ptr);
36732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36734         this_ptr_conv.is_owned = false;
36735         PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
36736 }
36737
36738 uint64_t  __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
36739         LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
36740         uint64_t ret_ref = 0;
36741         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36742         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36743         return ret_ref;
36744 }
36745
36746 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
36747         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
36748         uint64_t ret_ref = 0;
36749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36751         return ret_ref;
36752 }
36753 int64_t  __attribute__((export_name("TS_PeerHandleError_clone_ptr"))) TS_PeerHandleError_clone_ptr(uint64_t arg) {
36754         LDKPeerHandleError arg_conv;
36755         arg_conv.inner = untag_ptr(arg);
36756         arg_conv.is_owned = ptr_is_owned(arg);
36757         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36758         arg_conv.is_owned = false;
36759         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
36760         return ret_conv;
36761 }
36762
36763 uint64_t  __attribute__((export_name("TS_PeerHandleError_clone"))) TS_PeerHandleError_clone(uint64_t orig) {
36764         LDKPeerHandleError orig_conv;
36765         orig_conv.inner = untag_ptr(orig);
36766         orig_conv.is_owned = ptr_is_owned(orig);
36767         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36768         orig_conv.is_owned = false;
36769         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
36770         uint64_t ret_ref = 0;
36771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36773         return ret_ref;
36774 }
36775
36776 void  __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(uint64_t this_obj) {
36777         LDKPeerManager this_obj_conv;
36778         this_obj_conv.inner = untag_ptr(this_obj);
36779         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36781         PeerManager_free(this_obj_conv);
36782 }
36783
36784 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) {
36785         LDKMessageHandler message_handler_conv;
36786         message_handler_conv.inner = untag_ptr(message_handler);
36787         message_handler_conv.is_owned = ptr_is_owned(message_handler);
36788         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
36789         // WARNING: we need a move here but no clone is available for LDKMessageHandler
36790         
36791         LDKSecretKey our_node_secret_ref;
36792         CHECK(our_node_secret->arr_len == 32);
36793         memcpy(our_node_secret_ref.bytes, our_node_secret->elems, 32); FREE(our_node_secret);
36794         unsigned char ephemeral_random_data_arr[32];
36795         CHECK(ephemeral_random_data->arr_len == 32);
36796         memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
36797         unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
36798         void* logger_ptr = untag_ptr(logger);
36799         CHECK_ACCESS(logger_ptr);
36800         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
36801         if (logger_conv.free == LDKLogger_JCalls_free) {
36802                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36803                 LDKLogger_JCalls_cloned(&logger_conv);
36804         }
36805         void* custom_message_handler_ptr = untag_ptr(custom_message_handler);
36806         CHECK_ACCESS(custom_message_handler_ptr);
36807         LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
36808         if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
36809                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36810                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
36811         }
36812         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, current_time, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
36813         uint64_t ret_ref = 0;
36814         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36815         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36816         return ret_ref;
36817 }
36818
36819 ptrArray  __attribute__((export_name("TS_PeerManager_get_peer_node_ids"))) TS_PeerManager_get_peer_node_ids(uint64_t this_arg) {
36820         LDKPeerManager this_arg_conv;
36821         this_arg_conv.inner = untag_ptr(this_arg);
36822         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36824         this_arg_conv.is_owned = false;
36825         LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
36826         ptrArray ret_arr = NULL;
36827         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
36828         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
36829         for (size_t m = 0; m < ret_var.datalen; m++) {
36830                 int8_tArray ret_conv_12_arr = init_int8_tArray(33, __LINE__);
36831                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compressed_form, 33);
36832                 ret_arr_ptr[m] = ret_conv_12_arr;
36833         }
36834         
36835         FREE(ret_var.data);
36836         return ret_arr;
36837 }
36838
36839 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) {
36840         LDKPeerManager this_arg_conv;
36841         this_arg_conv.inner = untag_ptr(this_arg);
36842         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36844         this_arg_conv.is_owned = false;
36845         LDKPublicKey their_node_id_ref;
36846         CHECK(their_node_id->arr_len == 33);
36847         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
36848         void* descriptor_ptr = untag_ptr(descriptor);
36849         CHECK_ACCESS(descriptor_ptr);
36850         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
36851         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
36852                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36853                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
36854         }
36855         void* remote_network_address_ptr = untag_ptr(remote_network_address);
36856         CHECK_ACCESS(remote_network_address_ptr);
36857         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
36858         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
36859         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
36860         return tag_ptr(ret_conv, true);
36861 }
36862
36863 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) {
36864         LDKPeerManager this_arg_conv;
36865         this_arg_conv.inner = untag_ptr(this_arg);
36866         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36868         this_arg_conv.is_owned = false;
36869         void* descriptor_ptr = untag_ptr(descriptor);
36870         CHECK_ACCESS(descriptor_ptr);
36871         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
36872         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
36873                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
36874                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
36875         }
36876         void* remote_network_address_ptr = untag_ptr(remote_network_address);
36877         CHECK_ACCESS(remote_network_address_ptr);
36878         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
36879         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
36880         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
36881         return tag_ptr(ret_conv, true);
36882 }
36883
36884 uint64_t  __attribute__((export_name("TS_PeerManager_write_buffer_space_avail"))) TS_PeerManager_write_buffer_space_avail(uint64_t this_arg, uint64_t descriptor) {
36885         LDKPeerManager this_arg_conv;
36886         this_arg_conv.inner = untag_ptr(this_arg);
36887         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36889         this_arg_conv.is_owned = false;
36890         void* descriptor_ptr = untag_ptr(descriptor);
36891         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
36892         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
36893         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
36894         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
36895         return tag_ptr(ret_conv, true);
36896 }
36897
36898 uint64_t  __attribute__((export_name("TS_PeerManager_read_event"))) TS_PeerManager_read_event(uint64_t this_arg, uint64_t peer_descriptor, int8_tArray data) {
36899         LDKPeerManager this_arg_conv;
36900         this_arg_conv.inner = untag_ptr(this_arg);
36901         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36903         this_arg_conv.is_owned = false;
36904         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
36905         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
36906         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
36907         LDKu8slice data_ref;
36908         data_ref.datalen = data->arr_len;
36909         data_ref.data = data->elems;
36910         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
36911         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
36912         FREE(data);
36913         return tag_ptr(ret_conv, true);
36914 }
36915
36916 void  __attribute__((export_name("TS_PeerManager_process_events"))) TS_PeerManager_process_events(uint64_t this_arg) {
36917         LDKPeerManager this_arg_conv;
36918         this_arg_conv.inner = untag_ptr(this_arg);
36919         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36921         this_arg_conv.is_owned = false;
36922         PeerManager_process_events(&this_arg_conv);
36923 }
36924
36925 void  __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_PeerManager_socket_disconnected(uint64_t this_arg, uint64_t descriptor) {
36926         LDKPeerManager this_arg_conv;
36927         this_arg_conv.inner = untag_ptr(this_arg);
36928         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36930         this_arg_conv.is_owned = false;
36931         void* descriptor_ptr = untag_ptr(descriptor);
36932         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
36933         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
36934         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
36935 }
36936
36937 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) {
36938         LDKPeerManager this_arg_conv;
36939         this_arg_conv.inner = untag_ptr(this_arg);
36940         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36942         this_arg_conv.is_owned = false;
36943         LDKPublicKey node_id_ref;
36944         CHECK(node_id->arr_len == 33);
36945         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
36946         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
36947 }
36948
36949 void  __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint64_t this_arg) {
36950         LDKPeerManager this_arg_conv;
36951         this_arg_conv.inner = untag_ptr(this_arg);
36952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36954         this_arg_conv.is_owned = false;
36955         PeerManager_disconnect_all_peers(&this_arg_conv);
36956 }
36957
36958 void  __attribute__((export_name("TS_PeerManager_timer_tick_occurred"))) TS_PeerManager_timer_tick_occurred(uint64_t this_arg) {
36959         LDKPeerManager this_arg_conv;
36960         this_arg_conv.inner = untag_ptr(this_arg);
36961         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36963         this_arg_conv.is_owned = false;
36964         PeerManager_timer_tick_occurred(&this_arg_conv);
36965 }
36966
36967 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) {
36968         LDKPeerManager this_arg_conv;
36969         this_arg_conv.inner = untag_ptr(this_arg);
36970         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36972         this_arg_conv.is_owned = false;
36973         LDKThreeBytes rgb_ref;
36974         CHECK(rgb->arr_len == 3);
36975         memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
36976         LDKThirtyTwoBytes alias_ref;
36977         CHECK(alias->arr_len == 32);
36978         memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
36979         LDKCVec_NetAddressZ addresses_constr;
36980         addresses_constr.datalen = addresses->arr_len;
36981         if (addresses_constr.datalen > 0)
36982                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
36983         else
36984                 addresses_constr.data = NULL;
36985         uint64_t* addresses_vals = addresses->elems;
36986         for (size_t m = 0; m < addresses_constr.datalen; m++) {
36987                 uint64_t addresses_conv_12 = addresses_vals[m];
36988                 void* addresses_conv_12_ptr = untag_ptr(addresses_conv_12);
36989                 CHECK_ACCESS(addresses_conv_12_ptr);
36990                 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
36991                 addresses_constr.data[m] = addresses_conv_12_conv;
36992         }
36993         FREE(addresses);
36994         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
36995 }
36996
36997 int64_t  __attribute__((export_name("TS_htlc_success_tx_weight"))) TS_htlc_success_tx_weight(jboolean opt_anchors) {
36998         int64_t ret_conv = htlc_success_tx_weight(opt_anchors);
36999         return ret_conv;
37000 }
37001
37002 int64_t  __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeout_tx_weight(jboolean opt_anchors) {
37003         int64_t ret_conv = htlc_timeout_tx_weight(opt_anchors);
37004         return ret_conv;
37005 }
37006
37007 uint32_t  __attribute__((export_name("TS_HTLCClaim_clone"))) TS_HTLCClaim_clone(uint64_t orig) {
37008         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
37009         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_clone(orig_conv));
37010         return ret_conv;
37011 }
37012
37013 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_timeout"))) TS_HTLCClaim_offered_timeout() {
37014         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_timeout());
37015         return ret_conv;
37016 }
37017
37018 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_preimage"))) TS_HTLCClaim_offered_preimage() {
37019         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_preimage());
37020         return ret_conv;
37021 }
37022
37023 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_timeout"))) TS_HTLCClaim_accepted_timeout() {
37024         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_timeout());
37025         return ret_conv;
37026 }
37027
37028 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_preimage"))) TS_HTLCClaim_accepted_preimage() {
37029         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_preimage());
37030         return ret_conv;
37031 }
37032
37033 uint32_t  __attribute__((export_name("TS_HTLCClaim_revocation"))) TS_HTLCClaim_revocation() {
37034         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_revocation());
37035         return ret_conv;
37036 }
37037
37038 jboolean  __attribute__((export_name("TS_HTLCClaim_eq"))) TS_HTLCClaim_eq(uint64_t a, uint64_t b) {
37039         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
37040         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
37041         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
37042         return ret_conv;
37043 }
37044
37045 uint64_t  __attribute__((export_name("TS_HTLCClaim_from_witness"))) TS_HTLCClaim_from_witness(int8_tArray witness) {
37046         LDKWitness witness_ref;
37047         witness_ref.datalen = witness->arr_len;
37048         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
37049         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
37050         witness_ref.data_is_owned = true;
37051         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
37052         *ret_copy = HTLCClaim_from_witness(witness_ref);
37053         uint64_t ret_ref = tag_ptr(ret_copy, true);
37054         return ret_ref;
37055 }
37056
37057 int8_tArray  __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
37058         unsigned char commitment_seed_arr[32];
37059         CHECK(commitment_seed->arr_len == 32);
37060         memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
37061         unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
37062         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37063         memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
37064         return ret_arr;
37065 }
37066
37067 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) {
37068         LDKCVec_u8Z to_holder_script_ref;
37069         to_holder_script_ref.datalen = to_holder_script->arr_len;
37070         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
37071         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
37072         LDKCVec_u8Z to_counterparty_script_ref;
37073         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
37074         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
37075         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
37076         LDKOutPoint funding_outpoint_conv;
37077         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
37078         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
37079         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
37080         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
37081         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);
37082         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37083         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37084         Transaction_free(ret_var);
37085         return ret_arr;
37086 }
37087
37088 void  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_free"))) TS_CounterpartyCommitmentSecrets_free(uint64_t this_obj) {
37089         LDKCounterpartyCommitmentSecrets this_obj_conv;
37090         this_obj_conv.inner = untag_ptr(this_obj);
37091         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37093         CounterpartyCommitmentSecrets_free(this_obj_conv);
37094 }
37095
37096 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
37097         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
37098         uint64_t ret_ref = 0;
37099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37101         return ret_ref;
37102 }
37103 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone_ptr"))) TS_CounterpartyCommitmentSecrets_clone_ptr(uint64_t arg) {
37104         LDKCounterpartyCommitmentSecrets arg_conv;
37105         arg_conv.inner = untag_ptr(arg);
37106         arg_conv.is_owned = ptr_is_owned(arg);
37107         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37108         arg_conv.is_owned = false;
37109         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
37110         return ret_conv;
37111 }
37112
37113 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone"))) TS_CounterpartyCommitmentSecrets_clone(uint64_t orig) {
37114         LDKCounterpartyCommitmentSecrets orig_conv;
37115         orig_conv.inner = untag_ptr(orig);
37116         orig_conv.is_owned = ptr_is_owned(orig);
37117         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37118         orig_conv.is_owned = false;
37119         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
37120         uint64_t ret_ref = 0;
37121         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37122         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37123         return ret_ref;
37124 }
37125
37126 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_new"))) TS_CounterpartyCommitmentSecrets_new() {
37127         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
37128         uint64_t ret_ref = 0;
37129         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37130         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37131         return ret_ref;
37132 }
37133
37134 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_min_seen_secret"))) TS_CounterpartyCommitmentSecrets_get_min_seen_secret(uint64_t this_arg) {
37135         LDKCounterpartyCommitmentSecrets this_arg_conv;
37136         this_arg_conv.inner = untag_ptr(this_arg);
37137         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37139         this_arg_conv.is_owned = false;
37140         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
37141         return ret_conv;
37142 }
37143
37144 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_provide_secret"))) TS_CounterpartyCommitmentSecrets_provide_secret(uint64_t this_arg, int64_t idx, int8_tArray secret) {
37145         LDKCounterpartyCommitmentSecrets this_arg_conv;
37146         this_arg_conv.inner = untag_ptr(this_arg);
37147         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37149         this_arg_conv.is_owned = false;
37150         LDKThirtyTwoBytes secret_ref;
37151         CHECK(secret->arr_len == 32);
37152         memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
37153         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
37154         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
37155         return tag_ptr(ret_conv, true);
37156 }
37157
37158 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_secret"))) TS_CounterpartyCommitmentSecrets_get_secret(uint64_t this_arg, int64_t idx) {
37159         LDKCounterpartyCommitmentSecrets this_arg_conv;
37160         this_arg_conv.inner = untag_ptr(this_arg);
37161         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37163         this_arg_conv.is_owned = false;
37164         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37165         memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
37166         return ret_arr;
37167 }
37168
37169 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_write"))) TS_CounterpartyCommitmentSecrets_write(uint64_t obj) {
37170         LDKCounterpartyCommitmentSecrets obj_conv;
37171         obj_conv.inner = untag_ptr(obj);
37172         obj_conv.is_owned = ptr_is_owned(obj);
37173         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37174         obj_conv.is_owned = false;
37175         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
37176         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37177         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37178         CVec_u8Z_free(ret_var);
37179         return ret_arr;
37180 }
37181
37182 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_read"))) TS_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
37183         LDKu8slice ser_ref;
37184         ser_ref.datalen = ser->arr_len;
37185         ser_ref.data = ser->elems;
37186         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
37187         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
37188         FREE(ser);
37189         return tag_ptr(ret_conv, true);
37190 }
37191
37192 int8_tArray  __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
37193         LDKPublicKey per_commitment_point_ref;
37194         CHECK(per_commitment_point->arr_len == 33);
37195         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
37196         unsigned char base_secret_arr[32];
37197         CHECK(base_secret->arr_len == 32);
37198         memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
37199         unsigned char (*base_secret_ref)[32] = &base_secret_arr;
37200         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37201         memcpy(ret_arr->elems, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes, 32);
37202         return ret_arr;
37203 }
37204
37205 int8_tArray  __attribute__((export_name("TS_derive_public_key"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
37206         LDKPublicKey per_commitment_point_ref;
37207         CHECK(per_commitment_point->arr_len == 33);
37208         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
37209         LDKPublicKey base_point_ref;
37210         CHECK(base_point->arr_len == 33);
37211         memcpy(base_point_ref.compressed_form, base_point->elems, 33); FREE(base_point);
37212         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37213         memcpy(ret_arr->elems, derive_public_key(per_commitment_point_ref, base_point_ref).compressed_form, 33);
37214         return ret_arr;
37215 }
37216
37217 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) {
37218         unsigned char per_commitment_secret_arr[32];
37219         CHECK(per_commitment_secret->arr_len == 32);
37220         memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
37221         unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
37222         unsigned char countersignatory_revocation_base_secret_arr[32];
37223         CHECK(countersignatory_revocation_base_secret->arr_len == 32);
37224         memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
37225         unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
37226         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37227         memcpy(ret_arr->elems, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes, 32);
37228         return ret_arr;
37229 }
37230
37231 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) {
37232         LDKPublicKey per_commitment_point_ref;
37233         CHECK(per_commitment_point->arr_len == 33);
37234         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
37235         LDKPublicKey countersignatory_revocation_base_point_ref;
37236         CHECK(countersignatory_revocation_base_point->arr_len == 33);
37237         memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point->elems, 33); FREE(countersignatory_revocation_base_point);
37238         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37239         memcpy(ret_arr->elems, derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref).compressed_form, 33);
37240         return ret_arr;
37241 }
37242
37243 void  __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint64_t this_obj) {
37244         LDKTxCreationKeys this_obj_conv;
37245         this_obj_conv.inner = untag_ptr(this_obj);
37246         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37248         TxCreationKeys_free(this_obj_conv);
37249 }
37250
37251 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_per_commitment_point"))) TS_TxCreationKeys_get_per_commitment_point(uint64_t this_ptr) {
37252         LDKTxCreationKeys this_ptr_conv;
37253         this_ptr_conv.inner = untag_ptr(this_ptr);
37254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37256         this_ptr_conv.is_owned = false;
37257         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37258         memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
37259         return ret_arr;
37260 }
37261
37262 void  __attribute__((export_name("TS_TxCreationKeys_set_per_commitment_point"))) TS_TxCreationKeys_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
37263         LDKTxCreationKeys this_ptr_conv;
37264         this_ptr_conv.inner = untag_ptr(this_ptr);
37265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37267         this_ptr_conv.is_owned = false;
37268         LDKPublicKey val_ref;
37269         CHECK(val->arr_len == 33);
37270         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37271         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
37272 }
37273
37274 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_revocation_key"))) TS_TxCreationKeys_get_revocation_key(uint64_t this_ptr) {
37275         LDKTxCreationKeys this_ptr_conv;
37276         this_ptr_conv.inner = untag_ptr(this_ptr);
37277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37279         this_ptr_conv.is_owned = false;
37280         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37281         memcpy(ret_arr->elems, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
37282         return ret_arr;
37283 }
37284
37285 void  __attribute__((export_name("TS_TxCreationKeys_set_revocation_key"))) TS_TxCreationKeys_set_revocation_key(uint64_t this_ptr, int8_tArray val) {
37286         LDKTxCreationKeys this_ptr_conv;
37287         this_ptr_conv.inner = untag_ptr(this_ptr);
37288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37290         this_ptr_conv.is_owned = false;
37291         LDKPublicKey val_ref;
37292         CHECK(val->arr_len == 33);
37293         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37294         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
37295 }
37296
37297 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_htlc_key"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint64_t this_ptr) {
37298         LDKTxCreationKeys this_ptr_conv;
37299         this_ptr_conv.inner = untag_ptr(this_ptr);
37300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37302         this_ptr_conv.is_owned = false;
37303         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37304         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
37305         return ret_arr;
37306 }
37307
37308 void  __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_htlc_key"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint64_t this_ptr, int8_tArray val) {
37309         LDKTxCreationKeys this_ptr_conv;
37310         this_ptr_conv.inner = untag_ptr(this_ptr);
37311         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37313         this_ptr_conv.is_owned = false;
37314         LDKPublicKey val_ref;
37315         CHECK(val->arr_len == 33);
37316         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37317         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
37318 }
37319
37320 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_countersignatory_htlc_key"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint64_t this_ptr) {
37321         LDKTxCreationKeys this_ptr_conv;
37322         this_ptr_conv.inner = untag_ptr(this_ptr);
37323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37325         this_ptr_conv.is_owned = false;
37326         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37327         memcpy(ret_arr->elems, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
37328         return ret_arr;
37329 }
37330
37331 void  __attribute__((export_name("TS_TxCreationKeys_set_countersignatory_htlc_key"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint64_t this_ptr, int8_tArray val) {
37332         LDKTxCreationKeys this_ptr_conv;
37333         this_ptr_conv.inner = untag_ptr(this_ptr);
37334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37336         this_ptr_conv.is_owned = false;
37337         LDKPublicKey val_ref;
37338         CHECK(val->arr_len == 33);
37339         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37340         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
37341 }
37342
37343 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint64_t this_ptr) {
37344         LDKTxCreationKeys this_ptr_conv;
37345         this_ptr_conv.inner = untag_ptr(this_ptr);
37346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37348         this_ptr_conv.is_owned = false;
37349         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37350         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
37351         return ret_arr;
37352 }
37353
37354 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) {
37355         LDKTxCreationKeys this_ptr_conv;
37356         this_ptr_conv.inner = untag_ptr(this_ptr);
37357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37359         this_ptr_conv.is_owned = false;
37360         LDKPublicKey val_ref;
37361         CHECK(val->arr_len == 33);
37362         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37363         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
37364 }
37365
37366 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) {
37367         LDKPublicKey per_commitment_point_arg_ref;
37368         CHECK(per_commitment_point_arg->arr_len == 33);
37369         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
37370         LDKPublicKey revocation_key_arg_ref;
37371         CHECK(revocation_key_arg->arr_len == 33);
37372         memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg->elems, 33); FREE(revocation_key_arg);
37373         LDKPublicKey broadcaster_htlc_key_arg_ref;
37374         CHECK(broadcaster_htlc_key_arg->arr_len == 33);
37375         memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg->elems, 33); FREE(broadcaster_htlc_key_arg);
37376         LDKPublicKey countersignatory_htlc_key_arg_ref;
37377         CHECK(countersignatory_htlc_key_arg->arr_len == 33);
37378         memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg->elems, 33); FREE(countersignatory_htlc_key_arg);
37379         LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
37380         CHECK(broadcaster_delayed_payment_key_arg->arr_len == 33);
37381         memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg->elems, 33); FREE(broadcaster_delayed_payment_key_arg);
37382         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);
37383         uint64_t ret_ref = 0;
37384         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37385         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37386         return ret_ref;
37387 }
37388
37389 jboolean  __attribute__((export_name("TS_TxCreationKeys_eq"))) TS_TxCreationKeys_eq(uint64_t a, uint64_t b) {
37390         LDKTxCreationKeys a_conv;
37391         a_conv.inner = untag_ptr(a);
37392         a_conv.is_owned = ptr_is_owned(a);
37393         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37394         a_conv.is_owned = false;
37395         LDKTxCreationKeys b_conv;
37396         b_conv.inner = untag_ptr(b);
37397         b_conv.is_owned = ptr_is_owned(b);
37398         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37399         b_conv.is_owned = false;
37400         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
37401         return ret_conv;
37402 }
37403
37404 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
37405         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
37406         uint64_t ret_ref = 0;
37407         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37408         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37409         return ret_ref;
37410 }
37411 int64_t  __attribute__((export_name("TS_TxCreationKeys_clone_ptr"))) TS_TxCreationKeys_clone_ptr(uint64_t arg) {
37412         LDKTxCreationKeys arg_conv;
37413         arg_conv.inner = untag_ptr(arg);
37414         arg_conv.is_owned = ptr_is_owned(arg);
37415         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37416         arg_conv.is_owned = false;
37417         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
37418         return ret_conv;
37419 }
37420
37421 uint64_t  __attribute__((export_name("TS_TxCreationKeys_clone"))) TS_TxCreationKeys_clone(uint64_t orig) {
37422         LDKTxCreationKeys orig_conv;
37423         orig_conv.inner = untag_ptr(orig);
37424         orig_conv.is_owned = ptr_is_owned(orig);
37425         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37426         orig_conv.is_owned = false;
37427         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
37428         uint64_t ret_ref = 0;
37429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37431         return ret_ref;
37432 }
37433
37434 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_write"))) TS_TxCreationKeys_write(uint64_t obj) {
37435         LDKTxCreationKeys obj_conv;
37436         obj_conv.inner = untag_ptr(obj);
37437         obj_conv.is_owned = ptr_is_owned(obj);
37438         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37439         obj_conv.is_owned = false;
37440         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
37441         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37442         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37443         CVec_u8Z_free(ret_var);
37444         return ret_arr;
37445 }
37446
37447 uint64_t  __attribute__((export_name("TS_TxCreationKeys_read"))) TS_TxCreationKeys_read(int8_tArray ser) {
37448         LDKu8slice ser_ref;
37449         ser_ref.datalen = ser->arr_len;
37450         ser_ref.data = ser->elems;
37451         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
37452         *ret_conv = TxCreationKeys_read(ser_ref);
37453         FREE(ser);
37454         return tag_ptr(ret_conv, true);
37455 }
37456
37457 void  __attribute__((export_name("TS_ChannelPublicKeys_free"))) TS_ChannelPublicKeys_free(uint64_t this_obj) {
37458         LDKChannelPublicKeys this_obj_conv;
37459         this_obj_conv.inner = untag_ptr(this_obj);
37460         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37462         ChannelPublicKeys_free(this_obj_conv);
37463 }
37464
37465 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_funding_pubkey"))) TS_ChannelPublicKeys_get_funding_pubkey(uint64_t this_ptr) {
37466         LDKChannelPublicKeys this_ptr_conv;
37467         this_ptr_conv.inner = untag_ptr(this_ptr);
37468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37470         this_ptr_conv.is_owned = false;
37471         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37472         memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
37473         return ret_arr;
37474 }
37475
37476 void  __attribute__((export_name("TS_ChannelPublicKeys_set_funding_pubkey"))) TS_ChannelPublicKeys_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
37477         LDKChannelPublicKeys this_ptr_conv;
37478         this_ptr_conv.inner = untag_ptr(this_ptr);
37479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37481         this_ptr_conv.is_owned = false;
37482         LDKPublicKey val_ref;
37483         CHECK(val->arr_len == 33);
37484         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37485         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
37486 }
37487
37488 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_revocation_basepoint"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint64_t this_ptr) {
37489         LDKChannelPublicKeys this_ptr_conv;
37490         this_ptr_conv.inner = untag_ptr(this_ptr);
37491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37493         this_ptr_conv.is_owned = false;
37494         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37495         memcpy(ret_arr->elems, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
37496         return ret_arr;
37497 }
37498
37499 void  __attribute__((export_name("TS_ChannelPublicKeys_set_revocation_basepoint"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
37500         LDKChannelPublicKeys this_ptr_conv;
37501         this_ptr_conv.inner = untag_ptr(this_ptr);
37502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37504         this_ptr_conv.is_owned = false;
37505         LDKPublicKey val_ref;
37506         CHECK(val->arr_len == 33);
37507         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37508         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
37509 }
37510
37511 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_payment_point"))) TS_ChannelPublicKeys_get_payment_point(uint64_t this_ptr) {
37512         LDKChannelPublicKeys this_ptr_conv;
37513         this_ptr_conv.inner = untag_ptr(this_ptr);
37514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37516         this_ptr_conv.is_owned = false;
37517         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37518         memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
37519         return ret_arr;
37520 }
37521
37522 void  __attribute__((export_name("TS_ChannelPublicKeys_set_payment_point"))) TS_ChannelPublicKeys_set_payment_point(uint64_t this_ptr, int8_tArray val) {
37523         LDKChannelPublicKeys this_ptr_conv;
37524         this_ptr_conv.inner = untag_ptr(this_ptr);
37525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37527         this_ptr_conv.is_owned = false;
37528         LDKPublicKey val_ref;
37529         CHECK(val->arr_len == 33);
37530         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37531         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
37532 }
37533
37534 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_delayed_payment_basepoint"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint64_t this_ptr) {
37535         LDKChannelPublicKeys this_ptr_conv;
37536         this_ptr_conv.inner = untag_ptr(this_ptr);
37537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37539         this_ptr_conv.is_owned = false;
37540         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37541         memcpy(ret_arr->elems, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
37542         return ret_arr;
37543 }
37544
37545 void  __attribute__((export_name("TS_ChannelPublicKeys_set_delayed_payment_basepoint"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
37546         LDKChannelPublicKeys this_ptr_conv;
37547         this_ptr_conv.inner = untag_ptr(this_ptr);
37548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37550         this_ptr_conv.is_owned = false;
37551         LDKPublicKey val_ref;
37552         CHECK(val->arr_len == 33);
37553         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37554         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
37555 }
37556
37557 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_htlc_basepoint"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint64_t this_ptr) {
37558         LDKChannelPublicKeys this_ptr_conv;
37559         this_ptr_conv.inner = untag_ptr(this_ptr);
37560         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37562         this_ptr_conv.is_owned = false;
37563         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37564         memcpy(ret_arr->elems, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
37565         return ret_arr;
37566 }
37567
37568 void  __attribute__((export_name("TS_ChannelPublicKeys_set_htlc_basepoint"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
37569         LDKChannelPublicKeys this_ptr_conv;
37570         this_ptr_conv.inner = untag_ptr(this_ptr);
37571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37573         this_ptr_conv.is_owned = false;
37574         LDKPublicKey val_ref;
37575         CHECK(val->arr_len == 33);
37576         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37577         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
37578 }
37579
37580 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) {
37581         LDKPublicKey funding_pubkey_arg_ref;
37582         CHECK(funding_pubkey_arg->arr_len == 33);
37583         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
37584         LDKPublicKey revocation_basepoint_arg_ref;
37585         CHECK(revocation_basepoint_arg->arr_len == 33);
37586         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
37587         LDKPublicKey payment_point_arg_ref;
37588         CHECK(payment_point_arg->arr_len == 33);
37589         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
37590         LDKPublicKey delayed_payment_basepoint_arg_ref;
37591         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
37592         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
37593         LDKPublicKey htlc_basepoint_arg_ref;
37594         CHECK(htlc_basepoint_arg->arr_len == 33);
37595         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
37596         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);
37597         uint64_t ret_ref = 0;
37598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37600         return ret_ref;
37601 }
37602
37603 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
37604         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
37605         uint64_t ret_ref = 0;
37606         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37607         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37608         return ret_ref;
37609 }
37610 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone_ptr"))) TS_ChannelPublicKeys_clone_ptr(uint64_t arg) {
37611         LDKChannelPublicKeys arg_conv;
37612         arg_conv.inner = untag_ptr(arg);
37613         arg_conv.is_owned = ptr_is_owned(arg);
37614         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37615         arg_conv.is_owned = false;
37616         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
37617         return ret_conv;
37618 }
37619
37620 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone"))) TS_ChannelPublicKeys_clone(uint64_t orig) {
37621         LDKChannelPublicKeys orig_conv;
37622         orig_conv.inner = untag_ptr(orig);
37623         orig_conv.is_owned = ptr_is_owned(orig);
37624         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37625         orig_conv.is_owned = false;
37626         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
37627         uint64_t ret_ref = 0;
37628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37630         return ret_ref;
37631 }
37632
37633 jboolean  __attribute__((export_name("TS_ChannelPublicKeys_eq"))) TS_ChannelPublicKeys_eq(uint64_t a, uint64_t b) {
37634         LDKChannelPublicKeys a_conv;
37635         a_conv.inner = untag_ptr(a);
37636         a_conv.is_owned = ptr_is_owned(a);
37637         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37638         a_conv.is_owned = false;
37639         LDKChannelPublicKeys b_conv;
37640         b_conv.inner = untag_ptr(b);
37641         b_conv.is_owned = ptr_is_owned(b);
37642         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37643         b_conv.is_owned = false;
37644         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
37645         return ret_conv;
37646 }
37647
37648 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_write"))) TS_ChannelPublicKeys_write(uint64_t obj) {
37649         LDKChannelPublicKeys obj_conv;
37650         obj_conv.inner = untag_ptr(obj);
37651         obj_conv.is_owned = ptr_is_owned(obj);
37652         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37653         obj_conv.is_owned = false;
37654         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
37655         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37656         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37657         CVec_u8Z_free(ret_var);
37658         return ret_arr;
37659 }
37660
37661 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_read"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
37662         LDKu8slice ser_ref;
37663         ser_ref.datalen = ser->arr_len;
37664         ser_ref.data = ser->elems;
37665         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
37666         *ret_conv = ChannelPublicKeys_read(ser_ref);
37667         FREE(ser);
37668         return tag_ptr(ret_conv, true);
37669 }
37670
37671 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) {
37672         LDKPublicKey per_commitment_point_ref;
37673         CHECK(per_commitment_point->arr_len == 33);
37674         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
37675         LDKPublicKey broadcaster_delayed_payment_base_ref;
37676         CHECK(broadcaster_delayed_payment_base->arr_len == 33);
37677         memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base->elems, 33); FREE(broadcaster_delayed_payment_base);
37678         LDKPublicKey broadcaster_htlc_base_ref;
37679         CHECK(broadcaster_htlc_base->arr_len == 33);
37680         memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base->elems, 33); FREE(broadcaster_htlc_base);
37681         LDKPublicKey countersignatory_revocation_base_ref;
37682         CHECK(countersignatory_revocation_base->arr_len == 33);
37683         memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base->elems, 33); FREE(countersignatory_revocation_base);
37684         LDKPublicKey countersignatory_htlc_base_ref;
37685         CHECK(countersignatory_htlc_base->arr_len == 33);
37686         memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base->elems, 33); FREE(countersignatory_htlc_base);
37687         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);
37688         uint64_t ret_ref = 0;
37689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37691         return ret_ref;
37692 }
37693
37694 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) {
37695         LDKPublicKey per_commitment_point_ref;
37696         CHECK(per_commitment_point->arr_len == 33);
37697         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
37698         LDKChannelPublicKeys broadcaster_keys_conv;
37699         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
37700         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
37701         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
37702         broadcaster_keys_conv.is_owned = false;
37703         LDKChannelPublicKeys countersignatory_keys_conv;
37704         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
37705         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
37706         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
37707         countersignatory_keys_conv.is_owned = false;
37708         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
37709         uint64_t ret_ref = 0;
37710         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37711         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37712         return ret_ref;
37713 }
37714
37715 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) {
37716         LDKPublicKey revocation_key_ref;
37717         CHECK(revocation_key->arr_len == 33);
37718         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
37719         LDKPublicKey broadcaster_delayed_payment_key_ref;
37720         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
37721         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
37722         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
37723         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37724         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37725         CVec_u8Z_free(ret_var);
37726         return ret_arr;
37727 }
37728
37729 void  __attribute__((export_name("TS_HTLCOutputInCommitment_free"))) TS_HTLCOutputInCommitment_free(uint64_t this_obj) {
37730         LDKHTLCOutputInCommitment this_obj_conv;
37731         this_obj_conv.inner = untag_ptr(this_obj);
37732         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37734         HTLCOutputInCommitment_free(this_obj_conv);
37735 }
37736
37737 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_get_offered"))) TS_HTLCOutputInCommitment_get_offered(uint64_t this_ptr) {
37738         LDKHTLCOutputInCommitment this_ptr_conv;
37739         this_ptr_conv.inner = untag_ptr(this_ptr);
37740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37742         this_ptr_conv.is_owned = false;
37743         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
37744         return ret_conv;
37745 }
37746
37747 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_offered"))) TS_HTLCOutputInCommitment_set_offered(uint64_t this_ptr, jboolean val) {
37748         LDKHTLCOutputInCommitment this_ptr_conv;
37749         this_ptr_conv.inner = untag_ptr(this_ptr);
37750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37752         this_ptr_conv.is_owned = false;
37753         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
37754 }
37755
37756 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_amount_msat"))) TS_HTLCOutputInCommitment_get_amount_msat(uint64_t this_ptr) {
37757         LDKHTLCOutputInCommitment this_ptr_conv;
37758         this_ptr_conv.inner = untag_ptr(this_ptr);
37759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37761         this_ptr_conv.is_owned = false;
37762         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
37763         return ret_conv;
37764 }
37765
37766 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_amount_msat"))) TS_HTLCOutputInCommitment_set_amount_msat(uint64_t this_ptr, int64_t val) {
37767         LDKHTLCOutputInCommitment this_ptr_conv;
37768         this_ptr_conv.inner = untag_ptr(this_ptr);
37769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37771         this_ptr_conv.is_owned = false;
37772         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
37773 }
37774
37775 int32_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_cltv_expiry"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint64_t this_ptr) {
37776         LDKHTLCOutputInCommitment this_ptr_conv;
37777         this_ptr_conv.inner = untag_ptr(this_ptr);
37778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37780         this_ptr_conv.is_owned = false;
37781         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
37782         return ret_conv;
37783 }
37784
37785 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_cltv_expiry"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
37786         LDKHTLCOutputInCommitment this_ptr_conv;
37787         this_ptr_conv.inner = untag_ptr(this_ptr);
37788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37790         this_ptr_conv.is_owned = false;
37791         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
37792 }
37793
37794 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_get_payment_hash"))) TS_HTLCOutputInCommitment_get_payment_hash(uint64_t this_ptr) {
37795         LDKHTLCOutputInCommitment this_ptr_conv;
37796         this_ptr_conv.inner = untag_ptr(this_ptr);
37797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37799         this_ptr_conv.is_owned = false;
37800         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37801         memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
37802         return ret_arr;
37803 }
37804
37805 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_payment_hash"))) TS_HTLCOutputInCommitment_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
37806         LDKHTLCOutputInCommitment this_ptr_conv;
37807         this_ptr_conv.inner = untag_ptr(this_ptr);
37808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37810         this_ptr_conv.is_owned = false;
37811         LDKThirtyTwoBytes val_ref;
37812         CHECK(val->arr_len == 32);
37813         memcpy(val_ref.data, val->elems, 32); FREE(val);
37814         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
37815 }
37816
37817 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_transaction_output_index"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint64_t this_ptr) {
37818         LDKHTLCOutputInCommitment this_ptr_conv;
37819         this_ptr_conv.inner = untag_ptr(this_ptr);
37820         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37822         this_ptr_conv.is_owned = false;
37823         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
37824         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
37825         uint64_t ret_ref = tag_ptr(ret_copy, true);
37826         return ret_ref;
37827 }
37828
37829 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_transaction_output_index"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint64_t this_ptr, uint64_t val) {
37830         LDKHTLCOutputInCommitment this_ptr_conv;
37831         this_ptr_conv.inner = untag_ptr(this_ptr);
37832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37834         this_ptr_conv.is_owned = false;
37835         void* val_ptr = untag_ptr(val);
37836         CHECK_ACCESS(val_ptr);
37837         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
37838         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
37839         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
37840 }
37841
37842 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) {
37843         LDKThirtyTwoBytes payment_hash_arg_ref;
37844         CHECK(payment_hash_arg->arr_len == 32);
37845         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
37846         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
37847         CHECK_ACCESS(transaction_output_index_arg_ptr);
37848         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
37849         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
37850         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
37851         uint64_t ret_ref = 0;
37852         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37853         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37854         return ret_ref;
37855 }
37856
37857 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
37858         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
37859         uint64_t ret_ref = 0;
37860         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37861         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37862         return ret_ref;
37863 }
37864 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone_ptr"))) TS_HTLCOutputInCommitment_clone_ptr(uint64_t arg) {
37865         LDKHTLCOutputInCommitment arg_conv;
37866         arg_conv.inner = untag_ptr(arg);
37867         arg_conv.is_owned = ptr_is_owned(arg);
37868         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37869         arg_conv.is_owned = false;
37870         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
37871         return ret_conv;
37872 }
37873
37874 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone"))) TS_HTLCOutputInCommitment_clone(uint64_t orig) {
37875         LDKHTLCOutputInCommitment orig_conv;
37876         orig_conv.inner = untag_ptr(orig);
37877         orig_conv.is_owned = ptr_is_owned(orig);
37878         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37879         orig_conv.is_owned = false;
37880         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
37881         uint64_t ret_ref = 0;
37882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37884         return ret_ref;
37885 }
37886
37887 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_eq"))) TS_HTLCOutputInCommitment_eq(uint64_t a, uint64_t b) {
37888         LDKHTLCOutputInCommitment a_conv;
37889         a_conv.inner = untag_ptr(a);
37890         a_conv.is_owned = ptr_is_owned(a);
37891         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37892         a_conv.is_owned = false;
37893         LDKHTLCOutputInCommitment b_conv;
37894         b_conv.inner = untag_ptr(b);
37895         b_conv.is_owned = ptr_is_owned(b);
37896         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37897         b_conv.is_owned = false;
37898         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
37899         return ret_conv;
37900 }
37901
37902 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_write"))) TS_HTLCOutputInCommitment_write(uint64_t obj) {
37903         LDKHTLCOutputInCommitment obj_conv;
37904         obj_conv.inner = untag_ptr(obj);
37905         obj_conv.is_owned = ptr_is_owned(obj);
37906         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37907         obj_conv.is_owned = false;
37908         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
37909         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37910         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37911         CVec_u8Z_free(ret_var);
37912         return ret_arr;
37913 }
37914
37915 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_read"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
37916         LDKu8slice ser_ref;
37917         ser_ref.datalen = ser->arr_len;
37918         ser_ref.data = ser->elems;
37919         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
37920         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
37921         FREE(ser);
37922         return tag_ptr(ret_conv, true);
37923 }
37924
37925 int8_tArray  __attribute__((export_name("TS_get_htlc_redeemscript"))) TS_get_htlc_redeemscript(uint64_t htlc, jboolean opt_anchors, uint64_t keys) {
37926         LDKHTLCOutputInCommitment htlc_conv;
37927         htlc_conv.inner = untag_ptr(htlc);
37928         htlc_conv.is_owned = ptr_is_owned(htlc);
37929         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
37930         htlc_conv.is_owned = false;
37931         LDKTxCreationKeys keys_conv;
37932         keys_conv.inner = untag_ptr(keys);
37933         keys_conv.is_owned = ptr_is_owned(keys);
37934         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
37935         keys_conv.is_owned = false;
37936         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
37937         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37938         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37939         CVec_u8Z_free(ret_var);
37940         return ret_arr;
37941 }
37942
37943 int8_tArray  __attribute__((export_name("TS_make_funding_redeemscript"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
37944         LDKPublicKey broadcaster_ref;
37945         CHECK(broadcaster->arr_len == 33);
37946         memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
37947         LDKPublicKey countersignatory_ref;
37948         CHECK(countersignatory->arr_len == 33);
37949         memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
37950         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
37951         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37952         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37953         CVec_u8Z_free(ret_var);
37954         return ret_arr;
37955 }
37956
37957 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) {
37958         unsigned char commitment_txid_arr[32];
37959         CHECK(commitment_txid->arr_len == 32);
37960         memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
37961         unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
37962         LDKHTLCOutputInCommitment htlc_conv;
37963         htlc_conv.inner = untag_ptr(htlc);
37964         htlc_conv.is_owned = ptr_is_owned(htlc);
37965         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
37966         htlc_conv.is_owned = false;
37967         LDKPublicKey broadcaster_delayed_payment_key_ref;
37968         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
37969         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
37970         LDKPublicKey revocation_key_ref;
37971         CHECK(revocation_key->arr_len == 33);
37972         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
37973         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);
37974         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37975         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37976         Transaction_free(ret_var);
37977         return ret_arr;
37978 }
37979
37980 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) {
37981         LDKSignature local_sig_ref;
37982         CHECK(local_sig->arr_len == 64);
37983         memcpy(local_sig_ref.compact_form, local_sig->elems, 64); FREE(local_sig);
37984         LDKSignature remote_sig_ref;
37985         CHECK(remote_sig->arr_len == 64);
37986         memcpy(remote_sig_ref.compact_form, remote_sig->elems, 64); FREE(remote_sig);
37987         LDKThirtyTwoBytes preimage_ref;
37988         CHECK(preimage->arr_len == 32);
37989         memcpy(preimage_ref.data, preimage->elems, 32); FREE(preimage);
37990         LDKu8slice redeem_script_ref;
37991         redeem_script_ref.datalen = redeem_script->arr_len;
37992         redeem_script_ref.data = redeem_script->elems;
37993         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_ref, redeem_script_ref, opt_anchors);
37994         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37995         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37996         Witness_free(ret_var);
37997         FREE(redeem_script);
37998         return ret_arr;
37999 }
38000
38001 int8_tArray  __attribute__((export_name("TS_get_to_countersignatory_with_anchors_redeemscript"))) TS_get_to_countersignatory_with_anchors_redeemscript(int8_tArray payment_point) {
38002         LDKPublicKey payment_point_ref;
38003         CHECK(payment_point->arr_len == 33);
38004         memcpy(payment_point_ref.compressed_form, payment_point->elems, 33); FREE(payment_point);
38005         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
38006         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38007         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38008         CVec_u8Z_free(ret_var);
38009         return ret_arr;
38010 }
38011
38012 int8_tArray  __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
38013         LDKPublicKey funding_pubkey_ref;
38014         CHECK(funding_pubkey->arr_len == 33);
38015         memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
38016         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
38017         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38018         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38019         CVec_u8Z_free(ret_var);
38020         return ret_arr;
38021 }
38022
38023 int8_tArray  __attribute__((export_name("TS_build_anchor_input_witness"))) TS_build_anchor_input_witness(int8_tArray funding_key, int8_tArray funding_sig) {
38024         LDKPublicKey funding_key_ref;
38025         CHECK(funding_key->arr_len == 33);
38026         memcpy(funding_key_ref.compressed_form, funding_key->elems, 33); FREE(funding_key);
38027         LDKSignature funding_sig_ref;
38028         CHECK(funding_sig->arr_len == 64);
38029         memcpy(funding_sig_ref.compact_form, funding_sig->elems, 64); FREE(funding_sig);
38030         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
38031         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38032         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38033         Witness_free(ret_var);
38034         return ret_arr;
38035 }
38036
38037 void  __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint64_t this_obj) {
38038         LDKChannelTransactionParameters this_obj_conv;
38039         this_obj_conv.inner = untag_ptr(this_obj);
38040         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38042         ChannelTransactionParameters_free(this_obj_conv);
38043 }
38044
38045 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_pubkeys"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint64_t this_ptr) {
38046         LDKChannelTransactionParameters this_ptr_conv;
38047         this_ptr_conv.inner = untag_ptr(this_ptr);
38048         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38050         this_ptr_conv.is_owned = false;
38051         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
38052         uint64_t ret_ref = 0;
38053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38055         return ret_ref;
38056 }
38057
38058 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_pubkeys"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint64_t this_ptr, uint64_t val) {
38059         LDKChannelTransactionParameters this_ptr_conv;
38060         this_ptr_conv.inner = untag_ptr(this_ptr);
38061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38063         this_ptr_conv.is_owned = false;
38064         LDKChannelPublicKeys val_conv;
38065         val_conv.inner = untag_ptr(val);
38066         val_conv.is_owned = ptr_is_owned(val);
38067         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38068         val_conv = ChannelPublicKeys_clone(&val_conv);
38069         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
38070 }
38071
38072 int16_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint64_t this_ptr) {
38073         LDKChannelTransactionParameters this_ptr_conv;
38074         this_ptr_conv.inner = untag_ptr(this_ptr);
38075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38077         this_ptr_conv.is_owned = false;
38078         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
38079         return ret_conv;
38080 }
38081
38082 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) {
38083         LDKChannelTransactionParameters this_ptr_conv;
38084         this_ptr_conv.inner = untag_ptr(this_ptr);
38085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38087         this_ptr_conv.is_owned = false;
38088         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
38089 }
38090
38091 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_get_is_outbound_from_holder"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint64_t this_ptr) {
38092         LDKChannelTransactionParameters this_ptr_conv;
38093         this_ptr_conv.inner = untag_ptr(this_ptr);
38094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38096         this_ptr_conv.is_owned = false;
38097         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
38098         return ret_conv;
38099 }
38100
38101 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_is_outbound_from_holder"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint64_t this_ptr, jboolean val) {
38102         LDKChannelTransactionParameters this_ptr_conv;
38103         this_ptr_conv.inner = untag_ptr(this_ptr);
38104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38106         this_ptr_conv.is_owned = false;
38107         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
38108 }
38109
38110 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_counterparty_parameters"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint64_t this_ptr) {
38111         LDKChannelTransactionParameters this_ptr_conv;
38112         this_ptr_conv.inner = untag_ptr(this_ptr);
38113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38115         this_ptr_conv.is_owned = false;
38116         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
38117         uint64_t ret_ref = 0;
38118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38120         return ret_ref;
38121 }
38122
38123 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_counterparty_parameters"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint64_t this_ptr, uint64_t val) {
38124         LDKChannelTransactionParameters this_ptr_conv;
38125         this_ptr_conv.inner = untag_ptr(this_ptr);
38126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38128         this_ptr_conv.is_owned = false;
38129         LDKCounterpartyChannelTransactionParameters val_conv;
38130         val_conv.inner = untag_ptr(val);
38131         val_conv.is_owned = ptr_is_owned(val);
38132         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38133         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
38134         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
38135 }
38136
38137 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_funding_outpoint"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint64_t this_ptr) {
38138         LDKChannelTransactionParameters this_ptr_conv;
38139         this_ptr_conv.inner = untag_ptr(this_ptr);
38140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38142         this_ptr_conv.is_owned = false;
38143         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
38144         uint64_t ret_ref = 0;
38145         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38146         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38147         return ret_ref;
38148 }
38149
38150 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_funding_outpoint"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint64_t this_ptr, uint64_t val) {
38151         LDKChannelTransactionParameters this_ptr_conv;
38152         this_ptr_conv.inner = untag_ptr(this_ptr);
38153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38155         this_ptr_conv.is_owned = false;
38156         LDKOutPoint val_conv;
38157         val_conv.inner = untag_ptr(val);
38158         val_conv.is_owned = ptr_is_owned(val);
38159         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38160         val_conv = OutPoint_clone(&val_conv);
38161         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
38162 }
38163
38164 uint32_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_opt_anchors"))) TS_ChannelTransactionParameters_get_opt_anchors(uint64_t this_ptr) {
38165         LDKChannelTransactionParameters this_ptr_conv;
38166         this_ptr_conv.inner = untag_ptr(this_ptr);
38167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38169         this_ptr_conv.is_owned = false;
38170         uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
38171         return ret_conv;
38172 }
38173
38174 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_opt_anchors"))) TS_ChannelTransactionParameters_set_opt_anchors(uint64_t this_ptr, uint32_t val) {
38175         LDKChannelTransactionParameters this_ptr_conv;
38176         this_ptr_conv.inner = untag_ptr(this_ptr);
38177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38179         this_ptr_conv.is_owned = false;
38180         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
38181         ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
38182 }
38183
38184 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) {
38185         LDKChannelTransactionParameters this_ptr_conv;
38186         this_ptr_conv.inner = untag_ptr(this_ptr);
38187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38189         this_ptr_conv.is_owned = false;
38190         uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_non_zero_fee_anchors(&this_ptr_conv));
38191         return ret_conv;
38192 }
38193
38194 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) {
38195         LDKChannelTransactionParameters this_ptr_conv;
38196         this_ptr_conv.inner = untag_ptr(this_ptr);
38197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38199         this_ptr_conv.is_owned = false;
38200         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
38201         ChannelTransactionParameters_set_opt_non_zero_fee_anchors(&this_ptr_conv, val_conv);
38202 }
38203
38204 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) {
38205         LDKChannelPublicKeys holder_pubkeys_arg_conv;
38206         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
38207         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
38208         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
38209         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
38210         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
38211         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
38212         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
38213         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
38214         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
38215         LDKOutPoint funding_outpoint_arg_conv;
38216         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
38217         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
38218         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
38219         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
38220         LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_anchors_arg);
38221         LDKCOption_NoneZ opt_non_zero_fee_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_non_zero_fee_anchors_arg);
38222         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);
38223         uint64_t ret_ref = 0;
38224         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38225         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38226         return ret_ref;
38227 }
38228
38229 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
38230         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
38231         uint64_t ret_ref = 0;
38232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38234         return ret_ref;
38235 }
38236 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone_ptr"))) TS_ChannelTransactionParameters_clone_ptr(uint64_t arg) {
38237         LDKChannelTransactionParameters arg_conv;
38238         arg_conv.inner = untag_ptr(arg);
38239         arg_conv.is_owned = ptr_is_owned(arg);
38240         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38241         arg_conv.is_owned = false;
38242         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
38243         return ret_conv;
38244 }
38245
38246 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone"))) TS_ChannelTransactionParameters_clone(uint64_t orig) {
38247         LDKChannelTransactionParameters orig_conv;
38248         orig_conv.inner = untag_ptr(orig);
38249         orig_conv.is_owned = ptr_is_owned(orig);
38250         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38251         orig_conv.is_owned = false;
38252         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
38253         uint64_t ret_ref = 0;
38254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38256         return ret_ref;
38257 }
38258
38259 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_free"))) TS_CounterpartyChannelTransactionParameters_free(uint64_t this_obj) {
38260         LDKCounterpartyChannelTransactionParameters this_obj_conv;
38261         this_obj_conv.inner = untag_ptr(this_obj);
38262         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38264         CounterpartyChannelTransactionParameters_free(this_obj_conv);
38265 }
38266
38267 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_pubkeys"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint64_t this_ptr) {
38268         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
38269         this_ptr_conv.inner = untag_ptr(this_ptr);
38270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38272         this_ptr_conv.is_owned = false;
38273         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
38274         uint64_t ret_ref = 0;
38275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38277         return ret_ref;
38278 }
38279
38280 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_pubkeys"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint64_t this_ptr, uint64_t val) {
38281         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
38282         this_ptr_conv.inner = untag_ptr(this_ptr);
38283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38285         this_ptr_conv.is_owned = false;
38286         LDKChannelPublicKeys val_conv;
38287         val_conv.inner = untag_ptr(val);
38288         val_conv.is_owned = ptr_is_owned(val);
38289         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38290         val_conv = ChannelPublicKeys_clone(&val_conv);
38291         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
38292 }
38293
38294 int16_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint64_t this_ptr) {
38295         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
38296         this_ptr_conv.inner = untag_ptr(this_ptr);
38297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38299         this_ptr_conv.is_owned = false;
38300         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
38301         return ret_conv;
38302 }
38303
38304 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint64_t this_ptr, int16_t val) {
38305         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
38306         this_ptr_conv.inner = untag_ptr(this_ptr);
38307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38309         this_ptr_conv.is_owned = false;
38310         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
38311 }
38312
38313 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_new"))) TS_CounterpartyChannelTransactionParameters_new(uint64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
38314         LDKChannelPublicKeys pubkeys_arg_conv;
38315         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
38316         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
38317         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
38318         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
38319         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
38320         uint64_t ret_ref = 0;
38321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38323         return ret_ref;
38324 }
38325
38326 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
38327         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
38328         uint64_t ret_ref = 0;
38329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38331         return ret_ref;
38332 }
38333 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone_ptr"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint64_t arg) {
38334         LDKCounterpartyChannelTransactionParameters arg_conv;
38335         arg_conv.inner = untag_ptr(arg);
38336         arg_conv.is_owned = ptr_is_owned(arg);
38337         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38338         arg_conv.is_owned = false;
38339         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
38340         return ret_conv;
38341 }
38342
38343 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone"))) TS_CounterpartyChannelTransactionParameters_clone(uint64_t orig) {
38344         LDKCounterpartyChannelTransactionParameters orig_conv;
38345         orig_conv.inner = untag_ptr(orig);
38346         orig_conv.is_owned = ptr_is_owned(orig);
38347         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38348         orig_conv.is_owned = false;
38349         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
38350         uint64_t ret_ref = 0;
38351         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38352         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38353         return ret_ref;
38354 }
38355
38356 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_is_populated"))) TS_ChannelTransactionParameters_is_populated(uint64_t this_arg) {
38357         LDKChannelTransactionParameters this_arg_conv;
38358         this_arg_conv.inner = untag_ptr(this_arg);
38359         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38361         this_arg_conv.is_owned = false;
38362         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
38363         return ret_conv;
38364 }
38365
38366 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_holder_broadcastable"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint64_t this_arg) {
38367         LDKChannelTransactionParameters this_arg_conv;
38368         this_arg_conv.inner = untag_ptr(this_arg);
38369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38371         this_arg_conv.is_owned = false;
38372         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
38373         uint64_t ret_ref = 0;
38374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38376         return ret_ref;
38377 }
38378
38379 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_counterparty_broadcastable"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint64_t this_arg) {
38380         LDKChannelTransactionParameters this_arg_conv;
38381         this_arg_conv.inner = untag_ptr(this_arg);
38382         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38384         this_arg_conv.is_owned = false;
38385         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
38386         uint64_t ret_ref = 0;
38387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38389         return ret_ref;
38390 }
38391
38392 int8_tArray  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_write"))) TS_CounterpartyChannelTransactionParameters_write(uint64_t obj) {
38393         LDKCounterpartyChannelTransactionParameters obj_conv;
38394         obj_conv.inner = untag_ptr(obj);
38395         obj_conv.is_owned = ptr_is_owned(obj);
38396         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38397         obj_conv.is_owned = false;
38398         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
38399         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38400         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38401         CVec_u8Z_free(ret_var);
38402         return ret_arr;
38403 }
38404
38405 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_read"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
38406         LDKu8slice ser_ref;
38407         ser_ref.datalen = ser->arr_len;
38408         ser_ref.data = ser->elems;
38409         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
38410         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
38411         FREE(ser);
38412         return tag_ptr(ret_conv, true);
38413 }
38414
38415 int8_tArray  __attribute__((export_name("TS_ChannelTransactionParameters_write"))) TS_ChannelTransactionParameters_write(uint64_t obj) {
38416         LDKChannelTransactionParameters obj_conv;
38417         obj_conv.inner = untag_ptr(obj);
38418         obj_conv.is_owned = ptr_is_owned(obj);
38419         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38420         obj_conv.is_owned = false;
38421         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
38422         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38423         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38424         CVec_u8Z_free(ret_var);
38425         return ret_arr;
38426 }
38427
38428 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_read"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
38429         LDKu8slice ser_ref;
38430         ser_ref.datalen = ser->arr_len;
38431         ser_ref.data = ser->elems;
38432         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
38433         *ret_conv = ChannelTransactionParameters_read(ser_ref);
38434         FREE(ser);
38435         return tag_ptr(ret_conv, true);
38436 }
38437
38438 void  __attribute__((export_name("TS_DirectedChannelTransactionParameters_free"))) TS_DirectedChannelTransactionParameters_free(uint64_t this_obj) {
38439         LDKDirectedChannelTransactionParameters this_obj_conv;
38440         this_obj_conv.inner = untag_ptr(this_obj);
38441         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38443         DirectedChannelTransactionParameters_free(this_obj_conv);
38444 }
38445
38446 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_broadcaster_pubkeys"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint64_t this_arg) {
38447         LDKDirectedChannelTransactionParameters this_arg_conv;
38448         this_arg_conv.inner = untag_ptr(this_arg);
38449         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38451         this_arg_conv.is_owned = false;
38452         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
38453         uint64_t ret_ref = 0;
38454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38456         return ret_ref;
38457 }
38458
38459 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_countersignatory_pubkeys"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint64_t this_arg) {
38460         LDKDirectedChannelTransactionParameters this_arg_conv;
38461         this_arg_conv.inner = untag_ptr(this_arg);
38462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38464         this_arg_conv.is_owned = false;
38465         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
38466         uint64_t ret_ref = 0;
38467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38469         return ret_ref;
38470 }
38471
38472 int16_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_contest_delay"))) TS_DirectedChannelTransactionParameters_contest_delay(uint64_t this_arg) {
38473         LDKDirectedChannelTransactionParameters this_arg_conv;
38474         this_arg_conv.inner = untag_ptr(this_arg);
38475         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38477         this_arg_conv.is_owned = false;
38478         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
38479         return ret_conv;
38480 }
38481
38482 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_is_outbound"))) TS_DirectedChannelTransactionParameters_is_outbound(uint64_t this_arg) {
38483         LDKDirectedChannelTransactionParameters this_arg_conv;
38484         this_arg_conv.inner = untag_ptr(this_arg);
38485         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38487         this_arg_conv.is_owned = false;
38488         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
38489         return ret_conv;
38490 }
38491
38492 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_funding_outpoint"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint64_t this_arg) {
38493         LDKDirectedChannelTransactionParameters this_arg_conv;
38494         this_arg_conv.inner = untag_ptr(this_arg);
38495         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38497         this_arg_conv.is_owned = false;
38498         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
38499         uint64_t ret_ref = 0;
38500         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38501         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38502         return ret_ref;
38503 }
38504
38505 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_opt_anchors"))) TS_DirectedChannelTransactionParameters_opt_anchors(uint64_t this_arg) {
38506         LDKDirectedChannelTransactionParameters this_arg_conv;
38507         this_arg_conv.inner = untag_ptr(this_arg);
38508         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38510         this_arg_conv.is_owned = false;
38511         jboolean ret_conv = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
38512         return ret_conv;
38513 }
38514
38515 void  __attribute__((export_name("TS_HolderCommitmentTransaction_free"))) TS_HolderCommitmentTransaction_free(uint64_t this_obj) {
38516         LDKHolderCommitmentTransaction this_obj_conv;
38517         this_obj_conv.inner = untag_ptr(this_obj);
38518         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38520         HolderCommitmentTransaction_free(this_obj_conv);
38521 }
38522
38523 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_sig"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint64_t this_ptr) {
38524         LDKHolderCommitmentTransaction this_ptr_conv;
38525         this_ptr_conv.inner = untag_ptr(this_ptr);
38526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38528         this_ptr_conv.is_owned = false;
38529         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
38530         memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
38531         return ret_arr;
38532 }
38533
38534 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_sig"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
38535         LDKHolderCommitmentTransaction this_ptr_conv;
38536         this_ptr_conv.inner = untag_ptr(this_ptr);
38537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38539         this_ptr_conv.is_owned = false;
38540         LDKSignature val_ref;
38541         CHECK(val->arr_len == 64);
38542         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
38543         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
38544 }
38545
38546 ptrArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs(uint64_t this_ptr) {
38547         LDKHolderCommitmentTransaction this_ptr_conv;
38548         this_ptr_conv.inner = untag_ptr(this_ptr);
38549         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38551         this_ptr_conv.is_owned = false;
38552         LDKCVec_SignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
38553         ptrArray ret_arr = NULL;
38554         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
38555         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
38556         for (size_t m = 0; m < ret_var.datalen; m++) {
38557                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
38558                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
38559                 ret_arr_ptr[m] = ret_conv_12_arr;
38560         }
38561         
38562         FREE(ret_var.data);
38563         return ret_arr;
38564 }
38565
38566 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint64_t this_ptr, ptrArray val) {
38567         LDKHolderCommitmentTransaction this_ptr_conv;
38568         this_ptr_conv.inner = untag_ptr(this_ptr);
38569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38571         this_ptr_conv.is_owned = false;
38572         LDKCVec_SignatureZ val_constr;
38573         val_constr.datalen = val->arr_len;
38574         if (val_constr.datalen > 0)
38575                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
38576         else
38577                 val_constr.data = NULL;
38578         int8_tArray* val_vals = (void*) val->elems;
38579         for (size_t m = 0; m < val_constr.datalen; m++) {
38580                 int8_tArray val_conv_12 = val_vals[m];
38581                 LDKSignature val_conv_12_ref;
38582                 CHECK(val_conv_12->arr_len == 64);
38583                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
38584                 val_constr.data[m] = val_conv_12_ref;
38585         }
38586         FREE(val);
38587         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
38588 }
38589
38590 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
38591         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
38592         uint64_t ret_ref = 0;
38593         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38594         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38595         return ret_ref;
38596 }
38597 int64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone_ptr"))) TS_HolderCommitmentTransaction_clone_ptr(uint64_t arg) {
38598         LDKHolderCommitmentTransaction arg_conv;
38599         arg_conv.inner = untag_ptr(arg);
38600         arg_conv.is_owned = ptr_is_owned(arg);
38601         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38602         arg_conv.is_owned = false;
38603         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
38604         return ret_conv;
38605 }
38606
38607 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone"))) TS_HolderCommitmentTransaction_clone(uint64_t orig) {
38608         LDKHolderCommitmentTransaction orig_conv;
38609         orig_conv.inner = untag_ptr(orig);
38610         orig_conv.is_owned = ptr_is_owned(orig);
38611         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38612         orig_conv.is_owned = false;
38613         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
38614         uint64_t ret_ref = 0;
38615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38617         return ret_ref;
38618 }
38619
38620 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_write"))) TS_HolderCommitmentTransaction_write(uint64_t obj) {
38621         LDKHolderCommitmentTransaction obj_conv;
38622         obj_conv.inner = untag_ptr(obj);
38623         obj_conv.is_owned = ptr_is_owned(obj);
38624         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38625         obj_conv.is_owned = false;
38626         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
38627         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38628         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38629         CVec_u8Z_free(ret_var);
38630         return ret_arr;
38631 }
38632
38633 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_read"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
38634         LDKu8slice ser_ref;
38635         ser_ref.datalen = ser->arr_len;
38636         ser_ref.data = ser->elems;
38637         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
38638         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
38639         FREE(ser);
38640         return tag_ptr(ret_conv, true);
38641 }
38642
38643 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) {
38644         LDKCommitmentTransaction commitment_tx_conv;
38645         commitment_tx_conv.inner = untag_ptr(commitment_tx);
38646         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
38647         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
38648         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
38649         LDKSignature counterparty_sig_ref;
38650         CHECK(counterparty_sig->arr_len == 64);
38651         memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
38652         LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
38653         counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
38654         if (counterparty_htlc_sigs_constr.datalen > 0)
38655                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
38656         else
38657                 counterparty_htlc_sigs_constr.data = NULL;
38658         int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
38659         for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
38660                 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
38661                 LDKSignature counterparty_htlc_sigs_conv_12_ref;
38662                 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
38663                 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64); FREE(counterparty_htlc_sigs_conv_12);
38664                 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
38665         }
38666         FREE(counterparty_htlc_sigs);
38667         LDKPublicKey holder_funding_key_ref;
38668         CHECK(holder_funding_key->arr_len == 33);
38669         memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
38670         LDKPublicKey counterparty_funding_key_ref;
38671         CHECK(counterparty_funding_key->arr_len == 33);
38672         memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
38673         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
38674         uint64_t ret_ref = 0;
38675         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38676         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38677         return ret_ref;
38678 }
38679
38680 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_free"))) TS_BuiltCommitmentTransaction_free(uint64_t this_obj) {
38681         LDKBuiltCommitmentTransaction this_obj_conv;
38682         this_obj_conv.inner = untag_ptr(this_obj);
38683         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38685         BuiltCommitmentTransaction_free(this_obj_conv);
38686 }
38687
38688 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_transaction"))) TS_BuiltCommitmentTransaction_get_transaction(uint64_t this_ptr) {
38689         LDKBuiltCommitmentTransaction this_ptr_conv;
38690         this_ptr_conv.inner = untag_ptr(this_ptr);
38691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38693         this_ptr_conv.is_owned = false;
38694         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
38695         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38696         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38697         Transaction_free(ret_var);
38698         return ret_arr;
38699 }
38700
38701 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_transaction"))) TS_BuiltCommitmentTransaction_set_transaction(uint64_t this_ptr, int8_tArray val) {
38702         LDKBuiltCommitmentTransaction this_ptr_conv;
38703         this_ptr_conv.inner = untag_ptr(this_ptr);
38704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38706         this_ptr_conv.is_owned = false;
38707         LDKTransaction val_ref;
38708         val_ref.datalen = val->arr_len;
38709         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
38710         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
38711         val_ref.data_is_owned = true;
38712         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
38713 }
38714
38715 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_txid"))) TS_BuiltCommitmentTransaction_get_txid(uint64_t this_ptr) {
38716         LDKBuiltCommitmentTransaction this_ptr_conv;
38717         this_ptr_conv.inner = untag_ptr(this_ptr);
38718         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38720         this_ptr_conv.is_owned = false;
38721         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38722         memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
38723         return ret_arr;
38724 }
38725
38726 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_txid"))) TS_BuiltCommitmentTransaction_set_txid(uint64_t this_ptr, int8_tArray val) {
38727         LDKBuiltCommitmentTransaction this_ptr_conv;
38728         this_ptr_conv.inner = untag_ptr(this_ptr);
38729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38731         this_ptr_conv.is_owned = false;
38732         LDKThirtyTwoBytes val_ref;
38733         CHECK(val->arr_len == 32);
38734         memcpy(val_ref.data, val->elems, 32); FREE(val);
38735         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
38736 }
38737
38738 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_new"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
38739         LDKTransaction transaction_arg_ref;
38740         transaction_arg_ref.datalen = transaction_arg->arr_len;
38741         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
38742         memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
38743         transaction_arg_ref.data_is_owned = true;
38744         LDKThirtyTwoBytes txid_arg_ref;
38745         CHECK(txid_arg->arr_len == 32);
38746         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
38747         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
38748         uint64_t ret_ref = 0;
38749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38751         return ret_ref;
38752 }
38753
38754 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
38755         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
38756         uint64_t ret_ref = 0;
38757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38759         return ret_ref;
38760 }
38761 int64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone_ptr"))) TS_BuiltCommitmentTransaction_clone_ptr(uint64_t arg) {
38762         LDKBuiltCommitmentTransaction arg_conv;
38763         arg_conv.inner = untag_ptr(arg);
38764         arg_conv.is_owned = ptr_is_owned(arg);
38765         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38766         arg_conv.is_owned = false;
38767         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
38768         return ret_conv;
38769 }
38770
38771 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone"))) TS_BuiltCommitmentTransaction_clone(uint64_t orig) {
38772         LDKBuiltCommitmentTransaction orig_conv;
38773         orig_conv.inner = untag_ptr(orig);
38774         orig_conv.is_owned = ptr_is_owned(orig);
38775         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38776         orig_conv.is_owned = false;
38777         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
38778         uint64_t ret_ref = 0;
38779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38781         return ret_ref;
38782 }
38783
38784 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_write"))) TS_BuiltCommitmentTransaction_write(uint64_t obj) {
38785         LDKBuiltCommitmentTransaction obj_conv;
38786         obj_conv.inner = untag_ptr(obj);
38787         obj_conv.is_owned = ptr_is_owned(obj);
38788         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
38789         obj_conv.is_owned = false;
38790         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
38791         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38792         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38793         CVec_u8Z_free(ret_var);
38794         return ret_arr;
38795 }
38796
38797 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_read"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
38798         LDKu8slice ser_ref;
38799         ser_ref.datalen = ser->arr_len;
38800         ser_ref.data = ser->elems;
38801         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
38802         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
38803         FREE(ser);
38804         return tag_ptr(ret_conv, true);
38805 }
38806
38807 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) {
38808         LDKBuiltCommitmentTransaction this_arg_conv;
38809         this_arg_conv.inner = untag_ptr(this_arg);
38810         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38812         this_arg_conv.is_owned = false;
38813         LDKu8slice funding_redeemscript_ref;
38814         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
38815         funding_redeemscript_ref.data = funding_redeemscript->elems;
38816         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38817         memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
38818         FREE(funding_redeemscript);
38819         return ret_arr;
38820 }
38821
38822 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) {
38823         LDKBuiltCommitmentTransaction this_arg_conv;
38824         this_arg_conv.inner = untag_ptr(this_arg);
38825         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38827         this_arg_conv.is_owned = false;
38828         unsigned char funding_key_arr[32];
38829         CHECK(funding_key->arr_len == 32);
38830         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
38831         unsigned char (*funding_key_ref)[32] = &funding_key_arr;
38832         LDKu8slice funding_redeemscript_ref;
38833         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
38834         funding_redeemscript_ref.data = funding_redeemscript->elems;
38835         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
38836         memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
38837         FREE(funding_redeemscript);
38838         return ret_arr;
38839 }
38840
38841 void  __attribute__((export_name("TS_ClosingTransaction_free"))) TS_ClosingTransaction_free(uint64_t this_obj) {
38842         LDKClosingTransaction this_obj_conv;
38843         this_obj_conv.inner = untag_ptr(this_obj);
38844         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38846         ClosingTransaction_free(this_obj_conv);
38847 }
38848
38849 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
38850         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
38851         uint64_t ret_ref = 0;
38852         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38853         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38854         return ret_ref;
38855 }
38856 int64_t  __attribute__((export_name("TS_ClosingTransaction_clone_ptr"))) TS_ClosingTransaction_clone_ptr(uint64_t arg) {
38857         LDKClosingTransaction arg_conv;
38858         arg_conv.inner = untag_ptr(arg);
38859         arg_conv.is_owned = ptr_is_owned(arg);
38860         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38861         arg_conv.is_owned = false;
38862         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
38863         return ret_conv;
38864 }
38865
38866 uint64_t  __attribute__((export_name("TS_ClosingTransaction_clone"))) TS_ClosingTransaction_clone(uint64_t orig) {
38867         LDKClosingTransaction orig_conv;
38868         orig_conv.inner = untag_ptr(orig);
38869         orig_conv.is_owned = ptr_is_owned(orig);
38870         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38871         orig_conv.is_owned = false;
38872         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
38873         uint64_t ret_ref = 0;
38874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38876         return ret_ref;
38877 }
38878
38879 int64_t  __attribute__((export_name("TS_ClosingTransaction_hash"))) TS_ClosingTransaction_hash(uint64_t o) {
38880         LDKClosingTransaction o_conv;
38881         o_conv.inner = untag_ptr(o);
38882         o_conv.is_owned = ptr_is_owned(o);
38883         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38884         o_conv.is_owned = false;
38885         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
38886         return ret_conv;
38887 }
38888
38889 jboolean  __attribute__((export_name("TS_ClosingTransaction_eq"))) TS_ClosingTransaction_eq(uint64_t a, uint64_t b) {
38890         LDKClosingTransaction a_conv;
38891         a_conv.inner = untag_ptr(a);
38892         a_conv.is_owned = ptr_is_owned(a);
38893         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38894         a_conv.is_owned = false;
38895         LDKClosingTransaction b_conv;
38896         b_conv.inner = untag_ptr(b);
38897         b_conv.is_owned = ptr_is_owned(b);
38898         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38899         b_conv.is_owned = false;
38900         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
38901         return ret_conv;
38902 }
38903
38904 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) {
38905         LDKCVec_u8Z to_holder_script_ref;
38906         to_holder_script_ref.datalen = to_holder_script->arr_len;
38907         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
38908         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
38909         LDKCVec_u8Z to_counterparty_script_ref;
38910         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
38911         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
38912         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
38913         LDKOutPoint funding_outpoint_conv;
38914         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
38915         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
38916         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
38917         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
38918         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
38919         uint64_t ret_ref = 0;
38920         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38921         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38922         return ret_ref;
38923 }
38924
38925 uint64_t  __attribute__((export_name("TS_ClosingTransaction_trust"))) TS_ClosingTransaction_trust(uint64_t this_arg) {
38926         LDKClosingTransaction this_arg_conv;
38927         this_arg_conv.inner = untag_ptr(this_arg);
38928         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38930         this_arg_conv.is_owned = false;
38931         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
38932         uint64_t ret_ref = 0;
38933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38935         return ret_ref;
38936 }
38937
38938 uint64_t  __attribute__((export_name("TS_ClosingTransaction_verify"))) TS_ClosingTransaction_verify(uint64_t this_arg, uint64_t funding_outpoint) {
38939         LDKClosingTransaction this_arg_conv;
38940         this_arg_conv.inner = untag_ptr(this_arg);
38941         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38943         this_arg_conv.is_owned = false;
38944         LDKOutPoint funding_outpoint_conv;
38945         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
38946         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
38947         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
38948         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
38949         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
38950         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
38951         return tag_ptr(ret_conv, true);
38952 }
38953
38954 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_holder_value_sat"))) TS_ClosingTransaction_to_holder_value_sat(uint64_t this_arg) {
38955         LDKClosingTransaction this_arg_conv;
38956         this_arg_conv.inner = untag_ptr(this_arg);
38957         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38959         this_arg_conv.is_owned = false;
38960         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
38961         return ret_conv;
38962 }
38963
38964 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_value_sat"))) TS_ClosingTransaction_to_counterparty_value_sat(uint64_t this_arg) {
38965         LDKClosingTransaction this_arg_conv;
38966         this_arg_conv.inner = untag_ptr(this_arg);
38967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38969         this_arg_conv.is_owned = false;
38970         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
38971         return ret_conv;
38972 }
38973
38974 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_holder_script"))) TS_ClosingTransaction_to_holder_script(uint64_t this_arg) {
38975         LDKClosingTransaction this_arg_conv;
38976         this_arg_conv.inner = untag_ptr(this_arg);
38977         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38979         this_arg_conv.is_owned = false;
38980         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
38981         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38982         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38983         return ret_arr;
38984 }
38985
38986 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_script"))) TS_ClosingTransaction_to_counterparty_script(uint64_t this_arg) {
38987         LDKClosingTransaction this_arg_conv;
38988         this_arg_conv.inner = untag_ptr(this_arg);
38989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38991         this_arg_conv.is_owned = false;
38992         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
38993         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38994         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38995         return ret_arr;
38996 }
38997
38998 void  __attribute__((export_name("TS_TrustedClosingTransaction_free"))) TS_TrustedClosingTransaction_free(uint64_t this_obj) {
38999         LDKTrustedClosingTransaction this_obj_conv;
39000         this_obj_conv.inner = untag_ptr(this_obj);
39001         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39003         TrustedClosingTransaction_free(this_obj_conv);
39004 }
39005
39006 int8_tArray  __attribute__((export_name("TS_TrustedClosingTransaction_built_transaction"))) TS_TrustedClosingTransaction_built_transaction(uint64_t this_arg) {
39007         LDKTrustedClosingTransaction this_arg_conv;
39008         this_arg_conv.inner = untag_ptr(this_arg);
39009         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39011         this_arg_conv.is_owned = false;
39012         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
39013         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39014         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39015         Transaction_free(ret_var);
39016         return ret_arr;
39017 }
39018
39019 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) {
39020         LDKTrustedClosingTransaction this_arg_conv;
39021         this_arg_conv.inner = untag_ptr(this_arg);
39022         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39024         this_arg_conv.is_owned = false;
39025         LDKu8slice funding_redeemscript_ref;
39026         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
39027         funding_redeemscript_ref.data = funding_redeemscript->elems;
39028         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39029         memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
39030         FREE(funding_redeemscript);
39031         return ret_arr;
39032 }
39033
39034 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) {
39035         LDKTrustedClosingTransaction this_arg_conv;
39036         this_arg_conv.inner = untag_ptr(this_arg);
39037         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39039         this_arg_conv.is_owned = false;
39040         unsigned char funding_key_arr[32];
39041         CHECK(funding_key->arr_len == 32);
39042         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
39043         unsigned char (*funding_key_ref)[32] = &funding_key_arr;
39044         LDKu8slice funding_redeemscript_ref;
39045         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
39046         funding_redeemscript_ref.data = funding_redeemscript->elems;
39047         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
39048         memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
39049         FREE(funding_redeemscript);
39050         return ret_arr;
39051 }
39052
39053 void  __attribute__((export_name("TS_CommitmentTransaction_free"))) TS_CommitmentTransaction_free(uint64_t this_obj) {
39054         LDKCommitmentTransaction this_obj_conv;
39055         this_obj_conv.inner = untag_ptr(this_obj);
39056         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39058         CommitmentTransaction_free(this_obj_conv);
39059 }
39060
39061 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
39062         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
39063         uint64_t ret_ref = 0;
39064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39066         return ret_ref;
39067 }
39068 int64_t  __attribute__((export_name("TS_CommitmentTransaction_clone_ptr"))) TS_CommitmentTransaction_clone_ptr(uint64_t arg) {
39069         LDKCommitmentTransaction arg_conv;
39070         arg_conv.inner = untag_ptr(arg);
39071         arg_conv.is_owned = ptr_is_owned(arg);
39072         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39073         arg_conv.is_owned = false;
39074         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
39075         return ret_conv;
39076 }
39077
39078 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_clone"))) TS_CommitmentTransaction_clone(uint64_t orig) {
39079         LDKCommitmentTransaction orig_conv;
39080         orig_conv.inner = untag_ptr(orig);
39081         orig_conv.is_owned = ptr_is_owned(orig);
39082         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39083         orig_conv.is_owned = false;
39084         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
39085         uint64_t ret_ref = 0;
39086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39088         return ret_ref;
39089 }
39090
39091 int8_tArray  __attribute__((export_name("TS_CommitmentTransaction_write"))) TS_CommitmentTransaction_write(uint64_t obj) {
39092         LDKCommitmentTransaction obj_conv;
39093         obj_conv.inner = untag_ptr(obj);
39094         obj_conv.is_owned = ptr_is_owned(obj);
39095         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39096         obj_conv.is_owned = false;
39097         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
39098         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39099         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39100         CVec_u8Z_free(ret_var);
39101         return ret_arr;
39102 }
39103
39104 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_read"))) TS_CommitmentTransaction_read(int8_tArray ser) {
39105         LDKu8slice ser_ref;
39106         ser_ref.datalen = ser->arr_len;
39107         ser_ref.data = ser->elems;
39108         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
39109         *ret_conv = CommitmentTransaction_read(ser_ref);
39110         FREE(ser);
39111         return tag_ptr(ret_conv, true);
39112 }
39113
39114 int64_t  __attribute__((export_name("TS_CommitmentTransaction_commitment_number"))) TS_CommitmentTransaction_commitment_number(uint64_t this_arg) {
39115         LDKCommitmentTransaction this_arg_conv;
39116         this_arg_conv.inner = untag_ptr(this_arg);
39117         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39119         this_arg_conv.is_owned = false;
39120         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
39121         return ret_conv;
39122 }
39123
39124 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_broadcaster_value_sat"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint64_t this_arg) {
39125         LDKCommitmentTransaction this_arg_conv;
39126         this_arg_conv.inner = untag_ptr(this_arg);
39127         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39129         this_arg_conv.is_owned = false;
39130         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
39131         return ret_conv;
39132 }
39133
39134 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_countersignatory_value_sat"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint64_t this_arg) {
39135         LDKCommitmentTransaction this_arg_conv;
39136         this_arg_conv.inner = untag_ptr(this_arg);
39137         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39139         this_arg_conv.is_owned = false;
39140         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
39141         return ret_conv;
39142 }
39143
39144 int32_t  __attribute__((export_name("TS_CommitmentTransaction_feerate_per_kw"))) TS_CommitmentTransaction_feerate_per_kw(uint64_t this_arg) {
39145         LDKCommitmentTransaction this_arg_conv;
39146         this_arg_conv.inner = untag_ptr(this_arg);
39147         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39149         this_arg_conv.is_owned = false;
39150         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
39151         return ret_conv;
39152 }
39153
39154 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_trust"))) TS_CommitmentTransaction_trust(uint64_t this_arg) {
39155         LDKCommitmentTransaction this_arg_conv;
39156         this_arg_conv.inner = untag_ptr(this_arg);
39157         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39159         this_arg_conv.is_owned = false;
39160         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
39161         uint64_t ret_ref = 0;
39162         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39163         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39164         return ret_ref;
39165 }
39166
39167 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) {
39168         LDKCommitmentTransaction this_arg_conv;
39169         this_arg_conv.inner = untag_ptr(this_arg);
39170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39172         this_arg_conv.is_owned = false;
39173         LDKDirectedChannelTransactionParameters channel_parameters_conv;
39174         channel_parameters_conv.inner = untag_ptr(channel_parameters);
39175         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
39176         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
39177         channel_parameters_conv.is_owned = false;
39178         LDKChannelPublicKeys broadcaster_keys_conv;
39179         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
39180         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
39181         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
39182         broadcaster_keys_conv.is_owned = false;
39183         LDKChannelPublicKeys countersignatory_keys_conv;
39184         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
39185         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
39186         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
39187         countersignatory_keys_conv.is_owned = false;
39188         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
39189         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
39190         return tag_ptr(ret_conv, true);
39191 }
39192
39193 void  __attribute__((export_name("TS_TrustedCommitmentTransaction_free"))) TS_TrustedCommitmentTransaction_free(uint64_t this_obj) {
39194         LDKTrustedCommitmentTransaction this_obj_conv;
39195         this_obj_conv.inner = untag_ptr(this_obj);
39196         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39198         TrustedCommitmentTransaction_free(this_obj_conv);
39199 }
39200
39201 int8_tArray  __attribute__((export_name("TS_TrustedCommitmentTransaction_txid"))) TS_TrustedCommitmentTransaction_txid(uint64_t this_arg) {
39202         LDKTrustedCommitmentTransaction this_arg_conv;
39203         this_arg_conv.inner = untag_ptr(this_arg);
39204         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39206         this_arg_conv.is_owned = false;
39207         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39208         memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
39209         return ret_arr;
39210 }
39211
39212 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_built_transaction"))) TS_TrustedCommitmentTransaction_built_transaction(uint64_t this_arg) {
39213         LDKTrustedCommitmentTransaction this_arg_conv;
39214         this_arg_conv.inner = untag_ptr(this_arg);
39215         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39217         this_arg_conv.is_owned = false;
39218         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
39219         uint64_t ret_ref = 0;
39220         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39221         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39222         return ret_ref;
39223 }
39224
39225 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_keys"))) TS_TrustedCommitmentTransaction_keys(uint64_t this_arg) {
39226         LDKTrustedCommitmentTransaction this_arg_conv;
39227         this_arg_conv.inner = untag_ptr(this_arg);
39228         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39230         this_arg_conv.is_owned = false;
39231         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
39232         uint64_t ret_ref = 0;
39233         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39234         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39235         return ret_ref;
39236 }
39237
39238 jboolean  __attribute__((export_name("TS_TrustedCommitmentTransaction_opt_anchors"))) TS_TrustedCommitmentTransaction_opt_anchors(uint64_t this_arg) {
39239         LDKTrustedCommitmentTransaction this_arg_conv;
39240         this_arg_conv.inner = untag_ptr(this_arg);
39241         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39243         this_arg_conv.is_owned = false;
39244         jboolean ret_conv = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
39245         return ret_conv;
39246 }
39247
39248 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) {
39249         LDKTrustedCommitmentTransaction this_arg_conv;
39250         this_arg_conv.inner = untag_ptr(this_arg);
39251         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39253         this_arg_conv.is_owned = false;
39254         unsigned char htlc_base_key_arr[32];
39255         CHECK(htlc_base_key->arr_len == 32);
39256         memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
39257         unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
39258         LDKDirectedChannelTransactionParameters channel_parameters_conv;
39259         channel_parameters_conv.inner = untag_ptr(channel_parameters);
39260         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
39261         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
39262         channel_parameters_conv.is_owned = false;
39263         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
39264         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
39265         return tag_ptr(ret_conv, true);
39266 }
39267
39268 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) {
39269         LDKPublicKey broadcaster_payment_basepoint_ref;
39270         CHECK(broadcaster_payment_basepoint->arr_len == 33);
39271         memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
39272         LDKPublicKey countersignatory_payment_basepoint_ref;
39273         CHECK(countersignatory_payment_basepoint->arr_len == 33);
39274         memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
39275         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
39276         return ret_conv;
39277 }
39278
39279 jboolean  __attribute__((export_name("TS_InitFeatures_eq"))) TS_InitFeatures_eq(uint64_t a, uint64_t b) {
39280         LDKInitFeatures a_conv;
39281         a_conv.inner = untag_ptr(a);
39282         a_conv.is_owned = ptr_is_owned(a);
39283         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39284         a_conv.is_owned = false;
39285         LDKInitFeatures b_conv;
39286         b_conv.inner = untag_ptr(b);
39287         b_conv.is_owned = ptr_is_owned(b);
39288         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39289         b_conv.is_owned = false;
39290         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
39291         return ret_conv;
39292 }
39293
39294 jboolean  __attribute__((export_name("TS_NodeFeatures_eq"))) TS_NodeFeatures_eq(uint64_t a, uint64_t b) {
39295         LDKNodeFeatures a_conv;
39296         a_conv.inner = untag_ptr(a);
39297         a_conv.is_owned = ptr_is_owned(a);
39298         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39299         a_conv.is_owned = false;
39300         LDKNodeFeatures b_conv;
39301         b_conv.inner = untag_ptr(b);
39302         b_conv.is_owned = ptr_is_owned(b);
39303         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39304         b_conv.is_owned = false;
39305         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
39306         return ret_conv;
39307 }
39308
39309 jboolean  __attribute__((export_name("TS_ChannelFeatures_eq"))) TS_ChannelFeatures_eq(uint64_t a, uint64_t b) {
39310         LDKChannelFeatures a_conv;
39311         a_conv.inner = untag_ptr(a);
39312         a_conv.is_owned = ptr_is_owned(a);
39313         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39314         a_conv.is_owned = false;
39315         LDKChannelFeatures b_conv;
39316         b_conv.inner = untag_ptr(b);
39317         b_conv.is_owned = ptr_is_owned(b);
39318         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39319         b_conv.is_owned = false;
39320         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
39321         return ret_conv;
39322 }
39323
39324 jboolean  __attribute__((export_name("TS_InvoiceFeatures_eq"))) TS_InvoiceFeatures_eq(uint64_t a, uint64_t b) {
39325         LDKInvoiceFeatures a_conv;
39326         a_conv.inner = untag_ptr(a);
39327         a_conv.is_owned = ptr_is_owned(a);
39328         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39329         a_conv.is_owned = false;
39330         LDKInvoiceFeatures b_conv;
39331         b_conv.inner = untag_ptr(b);
39332         b_conv.is_owned = ptr_is_owned(b);
39333         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39334         b_conv.is_owned = false;
39335         jboolean ret_conv = InvoiceFeatures_eq(&a_conv, &b_conv);
39336         return ret_conv;
39337 }
39338
39339 jboolean  __attribute__((export_name("TS_OfferFeatures_eq"))) TS_OfferFeatures_eq(uint64_t a, uint64_t b) {
39340         LDKOfferFeatures a_conv;
39341         a_conv.inner = untag_ptr(a);
39342         a_conv.is_owned = ptr_is_owned(a);
39343         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39344         a_conv.is_owned = false;
39345         LDKOfferFeatures b_conv;
39346         b_conv.inner = untag_ptr(b);
39347         b_conv.is_owned = ptr_is_owned(b);
39348         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39349         b_conv.is_owned = false;
39350         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
39351         return ret_conv;
39352 }
39353
39354 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_eq"))) TS_InvoiceRequestFeatures_eq(uint64_t a, uint64_t b) {
39355         LDKInvoiceRequestFeatures a_conv;
39356         a_conv.inner = untag_ptr(a);
39357         a_conv.is_owned = ptr_is_owned(a);
39358         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39359         a_conv.is_owned = false;
39360         LDKInvoiceRequestFeatures b_conv;
39361         b_conv.inner = untag_ptr(b);
39362         b_conv.is_owned = ptr_is_owned(b);
39363         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39364         b_conv.is_owned = false;
39365         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
39366         return ret_conv;
39367 }
39368
39369 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint64_t a, uint64_t b) {
39370         LDKChannelTypeFeatures a_conv;
39371         a_conv.inner = untag_ptr(a);
39372         a_conv.is_owned = ptr_is_owned(a);
39373         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39374         a_conv.is_owned = false;
39375         LDKChannelTypeFeatures b_conv;
39376         b_conv.inner = untag_ptr(b);
39377         b_conv.is_owned = ptr_is_owned(b);
39378         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39379         b_conv.is_owned = false;
39380         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
39381         return ret_conv;
39382 }
39383
39384 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
39385         LDKInitFeatures ret_var = InitFeatures_clone(arg);
39386         uint64_t ret_ref = 0;
39387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39389         return ret_ref;
39390 }
39391 int64_t  __attribute__((export_name("TS_InitFeatures_clone_ptr"))) TS_InitFeatures_clone_ptr(uint64_t arg) {
39392         LDKInitFeatures arg_conv;
39393         arg_conv.inner = untag_ptr(arg);
39394         arg_conv.is_owned = ptr_is_owned(arg);
39395         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39396         arg_conv.is_owned = false;
39397         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
39398         return ret_conv;
39399 }
39400
39401 uint64_t  __attribute__((export_name("TS_InitFeatures_clone"))) TS_InitFeatures_clone(uint64_t orig) {
39402         LDKInitFeatures orig_conv;
39403         orig_conv.inner = untag_ptr(orig);
39404         orig_conv.is_owned = ptr_is_owned(orig);
39405         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39406         orig_conv.is_owned = false;
39407         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
39408         uint64_t ret_ref = 0;
39409         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39410         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39411         return ret_ref;
39412 }
39413
39414 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
39415         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
39416         uint64_t ret_ref = 0;
39417         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39418         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39419         return ret_ref;
39420 }
39421 int64_t  __attribute__((export_name("TS_NodeFeatures_clone_ptr"))) TS_NodeFeatures_clone_ptr(uint64_t arg) {
39422         LDKNodeFeatures arg_conv;
39423         arg_conv.inner = untag_ptr(arg);
39424         arg_conv.is_owned = ptr_is_owned(arg);
39425         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39426         arg_conv.is_owned = false;
39427         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
39428         return ret_conv;
39429 }
39430
39431 uint64_t  __attribute__((export_name("TS_NodeFeatures_clone"))) TS_NodeFeatures_clone(uint64_t orig) {
39432         LDKNodeFeatures orig_conv;
39433         orig_conv.inner = untag_ptr(orig);
39434         orig_conv.is_owned = ptr_is_owned(orig);
39435         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39436         orig_conv.is_owned = false;
39437         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
39438         uint64_t ret_ref = 0;
39439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39441         return ret_ref;
39442 }
39443
39444 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
39445         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
39446         uint64_t ret_ref = 0;
39447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39449         return ret_ref;
39450 }
39451 int64_t  __attribute__((export_name("TS_ChannelFeatures_clone_ptr"))) TS_ChannelFeatures_clone_ptr(uint64_t arg) {
39452         LDKChannelFeatures arg_conv;
39453         arg_conv.inner = untag_ptr(arg);
39454         arg_conv.is_owned = ptr_is_owned(arg);
39455         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39456         arg_conv.is_owned = false;
39457         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
39458         return ret_conv;
39459 }
39460
39461 uint64_t  __attribute__((export_name("TS_ChannelFeatures_clone"))) TS_ChannelFeatures_clone(uint64_t orig) {
39462         LDKChannelFeatures orig_conv;
39463         orig_conv.inner = untag_ptr(orig);
39464         orig_conv.is_owned = ptr_is_owned(orig);
39465         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39466         orig_conv.is_owned = false;
39467         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
39468         uint64_t ret_ref = 0;
39469         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39470         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39471         return ret_ref;
39472 }
39473
39474 static inline uint64_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
39475         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
39476         uint64_t ret_ref = 0;
39477         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39478         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39479         return ret_ref;
39480 }
39481 int64_t  __attribute__((export_name("TS_InvoiceFeatures_clone_ptr"))) TS_InvoiceFeatures_clone_ptr(uint64_t arg) {
39482         LDKInvoiceFeatures arg_conv;
39483         arg_conv.inner = untag_ptr(arg);
39484         arg_conv.is_owned = ptr_is_owned(arg);
39485         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39486         arg_conv.is_owned = false;
39487         int64_t ret_conv = InvoiceFeatures_clone_ptr(&arg_conv);
39488         return ret_conv;
39489 }
39490
39491 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_clone"))) TS_InvoiceFeatures_clone(uint64_t orig) {
39492         LDKInvoiceFeatures orig_conv;
39493         orig_conv.inner = untag_ptr(orig);
39494         orig_conv.is_owned = ptr_is_owned(orig);
39495         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39496         orig_conv.is_owned = false;
39497         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
39498         uint64_t ret_ref = 0;
39499         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39500         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39501         return ret_ref;
39502 }
39503
39504 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
39505         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
39506         uint64_t ret_ref = 0;
39507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39509         return ret_ref;
39510 }
39511 int64_t  __attribute__((export_name("TS_OfferFeatures_clone_ptr"))) TS_OfferFeatures_clone_ptr(uint64_t arg) {
39512         LDKOfferFeatures arg_conv;
39513         arg_conv.inner = untag_ptr(arg);
39514         arg_conv.is_owned = ptr_is_owned(arg);
39515         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39516         arg_conv.is_owned = false;
39517         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
39518         return ret_conv;
39519 }
39520
39521 uint64_t  __attribute__((export_name("TS_OfferFeatures_clone"))) TS_OfferFeatures_clone(uint64_t orig) {
39522         LDKOfferFeatures orig_conv;
39523         orig_conv.inner = untag_ptr(orig);
39524         orig_conv.is_owned = ptr_is_owned(orig);
39525         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39526         orig_conv.is_owned = false;
39527         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
39528         uint64_t ret_ref = 0;
39529         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39530         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39531         return ret_ref;
39532 }
39533
39534 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
39535         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
39536         uint64_t ret_ref = 0;
39537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39539         return ret_ref;
39540 }
39541 int64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone_ptr"))) TS_InvoiceRequestFeatures_clone_ptr(uint64_t arg) {
39542         LDKInvoiceRequestFeatures arg_conv;
39543         arg_conv.inner = untag_ptr(arg);
39544         arg_conv.is_owned = ptr_is_owned(arg);
39545         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39546         arg_conv.is_owned = false;
39547         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
39548         return ret_conv;
39549 }
39550
39551 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone"))) TS_InvoiceRequestFeatures_clone(uint64_t orig) {
39552         LDKInvoiceRequestFeatures orig_conv;
39553         orig_conv.inner = untag_ptr(orig);
39554         orig_conv.is_owned = ptr_is_owned(orig);
39555         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39556         orig_conv.is_owned = false;
39557         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
39558         uint64_t ret_ref = 0;
39559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39561         return ret_ref;
39562 }
39563
39564 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
39565         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
39566         uint64_t ret_ref = 0;
39567         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39568         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39569         return ret_ref;
39570 }
39571 int64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone_ptr"))) TS_ChannelTypeFeatures_clone_ptr(uint64_t arg) {
39572         LDKChannelTypeFeatures arg_conv;
39573         arg_conv.inner = untag_ptr(arg);
39574         arg_conv.is_owned = ptr_is_owned(arg);
39575         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39576         arg_conv.is_owned = false;
39577         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
39578         return ret_conv;
39579 }
39580
39581 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone"))) TS_ChannelTypeFeatures_clone(uint64_t orig) {
39582         LDKChannelTypeFeatures orig_conv;
39583         orig_conv.inner = untag_ptr(orig);
39584         orig_conv.is_owned = ptr_is_owned(orig);
39585         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39586         orig_conv.is_owned = false;
39587         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
39588         uint64_t ret_ref = 0;
39589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39591         return ret_ref;
39592 }
39593
39594 void  __attribute__((export_name("TS_InitFeatures_free"))) TS_InitFeatures_free(uint64_t this_obj) {
39595         LDKInitFeatures this_obj_conv;
39596         this_obj_conv.inner = untag_ptr(this_obj);
39597         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39599         InitFeatures_free(this_obj_conv);
39600 }
39601
39602 void  __attribute__((export_name("TS_NodeFeatures_free"))) TS_NodeFeatures_free(uint64_t this_obj) {
39603         LDKNodeFeatures this_obj_conv;
39604         this_obj_conv.inner = untag_ptr(this_obj);
39605         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39607         NodeFeatures_free(this_obj_conv);
39608 }
39609
39610 void  __attribute__((export_name("TS_ChannelFeatures_free"))) TS_ChannelFeatures_free(uint64_t this_obj) {
39611         LDKChannelFeatures this_obj_conv;
39612         this_obj_conv.inner = untag_ptr(this_obj);
39613         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39615         ChannelFeatures_free(this_obj_conv);
39616 }
39617
39618 void  __attribute__((export_name("TS_InvoiceFeatures_free"))) TS_InvoiceFeatures_free(uint64_t this_obj) {
39619         LDKInvoiceFeatures this_obj_conv;
39620         this_obj_conv.inner = untag_ptr(this_obj);
39621         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39623         InvoiceFeatures_free(this_obj_conv);
39624 }
39625
39626 void  __attribute__((export_name("TS_OfferFeatures_free"))) TS_OfferFeatures_free(uint64_t this_obj) {
39627         LDKOfferFeatures this_obj_conv;
39628         this_obj_conv.inner = untag_ptr(this_obj);
39629         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39631         OfferFeatures_free(this_obj_conv);
39632 }
39633
39634 void  __attribute__((export_name("TS_InvoiceRequestFeatures_free"))) TS_InvoiceRequestFeatures_free(uint64_t this_obj) {
39635         LDKInvoiceRequestFeatures this_obj_conv;
39636         this_obj_conv.inner = untag_ptr(this_obj);
39637         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39639         InvoiceRequestFeatures_free(this_obj_conv);
39640 }
39641
39642 void  __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint64_t this_obj) {
39643         LDKChannelTypeFeatures this_obj_conv;
39644         this_obj_conv.inner = untag_ptr(this_obj);
39645         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39647         ChannelTypeFeatures_free(this_obj_conv);
39648 }
39649
39650 uint64_t  __attribute__((export_name("TS_InitFeatures_empty"))) TS_InitFeatures_empty() {
39651         LDKInitFeatures ret_var = InitFeatures_empty();
39652         uint64_t ret_ref = 0;
39653         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39654         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39655         return ret_ref;
39656 }
39657
39658 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits"))) TS_InitFeatures_requires_unknown_bits(uint64_t this_arg) {
39659         LDKInitFeatures this_arg_conv;
39660         this_arg_conv.inner = untag_ptr(this_arg);
39661         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39663         this_arg_conv.is_owned = false;
39664         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
39665         return ret_conv;
39666 }
39667
39668 uint64_t  __attribute__((export_name("TS_NodeFeatures_empty"))) TS_NodeFeatures_empty() {
39669         LDKNodeFeatures ret_var = NodeFeatures_empty();
39670         uint64_t ret_ref = 0;
39671         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39672         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39673         return ret_ref;
39674 }
39675
39676 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits"))) TS_NodeFeatures_requires_unknown_bits(uint64_t this_arg) {
39677         LDKNodeFeatures this_arg_conv;
39678         this_arg_conv.inner = untag_ptr(this_arg);
39679         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39681         this_arg_conv.is_owned = false;
39682         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
39683         return ret_conv;
39684 }
39685
39686 uint64_t  __attribute__((export_name("TS_ChannelFeatures_empty"))) TS_ChannelFeatures_empty() {
39687         LDKChannelFeatures ret_var = ChannelFeatures_empty();
39688         uint64_t ret_ref = 0;
39689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39691         return ret_ref;
39692 }
39693
39694 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits"))) TS_ChannelFeatures_requires_unknown_bits(uint64_t this_arg) {
39695         LDKChannelFeatures this_arg_conv;
39696         this_arg_conv.inner = untag_ptr(this_arg);
39697         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39699         this_arg_conv.is_owned = false;
39700         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
39701         return ret_conv;
39702 }
39703
39704 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_empty"))) TS_InvoiceFeatures_empty() {
39705         LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
39706         uint64_t ret_ref = 0;
39707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39709         return ret_ref;
39710 }
39711
39712 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_unknown_bits"))) TS_InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
39713         LDKInvoiceFeatures this_arg_conv;
39714         this_arg_conv.inner = untag_ptr(this_arg);
39715         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39717         this_arg_conv.is_owned = false;
39718         jboolean ret_conv = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
39719         return ret_conv;
39720 }
39721
39722 uint64_t  __attribute__((export_name("TS_OfferFeatures_empty"))) TS_OfferFeatures_empty() {
39723         LDKOfferFeatures ret_var = OfferFeatures_empty();
39724         uint64_t ret_ref = 0;
39725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39727         return ret_ref;
39728 }
39729
39730 jboolean  __attribute__((export_name("TS_OfferFeatures_requires_unknown_bits"))) TS_OfferFeatures_requires_unknown_bits(uint64_t this_arg) {
39731         LDKOfferFeatures this_arg_conv;
39732         this_arg_conv.inner = untag_ptr(this_arg);
39733         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39735         this_arg_conv.is_owned = false;
39736         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
39737         return ret_conv;
39738 }
39739
39740 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_empty"))) TS_InvoiceRequestFeatures_empty() {
39741         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
39742         uint64_t ret_ref = 0;
39743         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39744         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39745         return ret_ref;
39746 }
39747
39748 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_requires_unknown_bits"))) TS_InvoiceRequestFeatures_requires_unknown_bits(uint64_t this_arg) {
39749         LDKInvoiceRequestFeatures this_arg_conv;
39750         this_arg_conv.inner = untag_ptr(this_arg);
39751         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39753         this_arg_conv.is_owned = false;
39754         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
39755         return ret_conv;
39756 }
39757
39758 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() {
39759         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
39760         uint64_t ret_ref = 0;
39761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39763         return ret_ref;
39764 }
39765
39766 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint64_t this_arg) {
39767         LDKChannelTypeFeatures this_arg_conv;
39768         this_arg_conv.inner = untag_ptr(this_arg);
39769         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39771         this_arg_conv.is_owned = false;
39772         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
39773         return ret_conv;
39774 }
39775
39776 int8_tArray  __attribute__((export_name("TS_InitFeatures_write"))) TS_InitFeatures_write(uint64_t obj) {
39777         LDKInitFeatures obj_conv;
39778         obj_conv.inner = untag_ptr(obj);
39779         obj_conv.is_owned = ptr_is_owned(obj);
39780         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39781         obj_conv.is_owned = false;
39782         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
39783         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39784         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39785         CVec_u8Z_free(ret_var);
39786         return ret_arr;
39787 }
39788
39789 uint64_t  __attribute__((export_name("TS_InitFeatures_read"))) TS_InitFeatures_read(int8_tArray ser) {
39790         LDKu8slice ser_ref;
39791         ser_ref.datalen = ser->arr_len;
39792         ser_ref.data = ser->elems;
39793         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
39794         *ret_conv = InitFeatures_read(ser_ref);
39795         FREE(ser);
39796         return tag_ptr(ret_conv, true);
39797 }
39798
39799 int8_tArray  __attribute__((export_name("TS_ChannelFeatures_write"))) TS_ChannelFeatures_write(uint64_t obj) {
39800         LDKChannelFeatures obj_conv;
39801         obj_conv.inner = untag_ptr(obj);
39802         obj_conv.is_owned = ptr_is_owned(obj);
39803         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39804         obj_conv.is_owned = false;
39805         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
39806         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39807         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39808         CVec_u8Z_free(ret_var);
39809         return ret_arr;
39810 }
39811
39812 uint64_t  __attribute__((export_name("TS_ChannelFeatures_read"))) TS_ChannelFeatures_read(int8_tArray ser) {
39813         LDKu8slice ser_ref;
39814         ser_ref.datalen = ser->arr_len;
39815         ser_ref.data = ser->elems;
39816         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
39817         *ret_conv = ChannelFeatures_read(ser_ref);
39818         FREE(ser);
39819         return tag_ptr(ret_conv, true);
39820 }
39821
39822 int8_tArray  __attribute__((export_name("TS_NodeFeatures_write"))) TS_NodeFeatures_write(uint64_t obj) {
39823         LDKNodeFeatures obj_conv;
39824         obj_conv.inner = untag_ptr(obj);
39825         obj_conv.is_owned = ptr_is_owned(obj);
39826         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39827         obj_conv.is_owned = false;
39828         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
39829         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39830         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39831         CVec_u8Z_free(ret_var);
39832         return ret_arr;
39833 }
39834
39835 uint64_t  __attribute__((export_name("TS_NodeFeatures_read"))) TS_NodeFeatures_read(int8_tArray ser) {
39836         LDKu8slice ser_ref;
39837         ser_ref.datalen = ser->arr_len;
39838         ser_ref.data = ser->elems;
39839         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
39840         *ret_conv = NodeFeatures_read(ser_ref);
39841         FREE(ser);
39842         return tag_ptr(ret_conv, true);
39843 }
39844
39845 int8_tArray  __attribute__((export_name("TS_InvoiceFeatures_write"))) TS_InvoiceFeatures_write(uint64_t obj) {
39846         LDKInvoiceFeatures obj_conv;
39847         obj_conv.inner = untag_ptr(obj);
39848         obj_conv.is_owned = ptr_is_owned(obj);
39849         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39850         obj_conv.is_owned = false;
39851         LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
39852         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39853         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39854         CVec_u8Z_free(ret_var);
39855         return ret_arr;
39856 }
39857
39858 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_read"))) TS_InvoiceFeatures_read(int8_tArray ser) {
39859         LDKu8slice ser_ref;
39860         ser_ref.datalen = ser->arr_len;
39861         ser_ref.data = ser->elems;
39862         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
39863         *ret_conv = InvoiceFeatures_read(ser_ref);
39864         FREE(ser);
39865         return tag_ptr(ret_conv, true);
39866 }
39867
39868 int8_tArray  __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint64_t obj) {
39869         LDKChannelTypeFeatures obj_conv;
39870         obj_conv.inner = untag_ptr(obj);
39871         obj_conv.is_owned = ptr_is_owned(obj);
39872         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39873         obj_conv.is_owned = false;
39874         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
39875         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39876         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39877         CVec_u8Z_free(ret_var);
39878         return ret_arr;
39879 }
39880
39881 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
39882         LDKu8slice ser_ref;
39883         ser_ref.datalen = ser->arr_len;
39884         ser_ref.data = ser->elems;
39885         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
39886         *ret_conv = ChannelTypeFeatures_read(ser_ref);
39887         FREE(ser);
39888         return tag_ptr(ret_conv, true);
39889 }
39890
39891 int8_tArray  __attribute__((export_name("TS_OfferFeatures_write"))) TS_OfferFeatures_write(uint64_t obj) {
39892         LDKOfferFeatures obj_conv;
39893         obj_conv.inner = untag_ptr(obj);
39894         obj_conv.is_owned = ptr_is_owned(obj);
39895         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39896         obj_conv.is_owned = false;
39897         LDKCVec_u8Z ret_var = OfferFeatures_write(&obj_conv);
39898         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39899         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39900         CVec_u8Z_free(ret_var);
39901         return ret_arr;
39902 }
39903
39904 uint64_t  __attribute__((export_name("TS_OfferFeatures_read"))) TS_OfferFeatures_read(int8_tArray ser) {
39905         LDKu8slice ser_ref;
39906         ser_ref.datalen = ser->arr_len;
39907         ser_ref.data = ser->elems;
39908         LDKCResult_OfferFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferFeaturesDecodeErrorZ), "LDKCResult_OfferFeaturesDecodeErrorZ");
39909         *ret_conv = OfferFeatures_read(ser_ref);
39910         FREE(ser);
39911         return tag_ptr(ret_conv, true);
39912 }
39913
39914 int8_tArray  __attribute__((export_name("TS_InvoiceRequestFeatures_write"))) TS_InvoiceRequestFeatures_write(uint64_t obj) {
39915         LDKInvoiceRequestFeatures obj_conv;
39916         obj_conv.inner = untag_ptr(obj);
39917         obj_conv.is_owned = ptr_is_owned(obj);
39918         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39919         obj_conv.is_owned = false;
39920         LDKCVec_u8Z ret_var = InvoiceRequestFeatures_write(&obj_conv);
39921         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39922         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39923         CVec_u8Z_free(ret_var);
39924         return ret_arr;
39925 }
39926
39927 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_read"))) TS_InvoiceRequestFeatures_read(int8_tArray ser) {
39928         LDKu8slice ser_ref;
39929         ser_ref.datalen = ser->arr_len;
39930         ser_ref.data = ser->elems;
39931         LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ), "LDKCResult_InvoiceRequestFeaturesDecodeErrorZ");
39932         *ret_conv = InvoiceRequestFeatures_read(ser_ref);
39933         FREE(ser);
39934         return tag_ptr(ret_conv, true);
39935 }
39936
39937 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_optional"))) TS_InitFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
39938         LDKInitFeatures this_arg_conv;
39939         this_arg_conv.inner = untag_ptr(this_arg);
39940         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39942         this_arg_conv.is_owned = false;
39943         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
39944 }
39945
39946 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_required"))) TS_InitFeatures_set_data_loss_protect_required(uint64_t this_arg) {
39947         LDKInitFeatures this_arg_conv;
39948         this_arg_conv.inner = untag_ptr(this_arg);
39949         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39951         this_arg_conv.is_owned = false;
39952         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
39953 }
39954
39955 jboolean  __attribute__((export_name("TS_InitFeatures_supports_data_loss_protect"))) TS_InitFeatures_supports_data_loss_protect(uint64_t this_arg) {
39956         LDKInitFeatures this_arg_conv;
39957         this_arg_conv.inner = untag_ptr(this_arg);
39958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39960         this_arg_conv.is_owned = false;
39961         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
39962         return ret_conv;
39963 }
39964
39965 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_optional"))) TS_NodeFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
39966         LDKNodeFeatures this_arg_conv;
39967         this_arg_conv.inner = untag_ptr(this_arg);
39968         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39970         this_arg_conv.is_owned = false;
39971         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
39972 }
39973
39974 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_required"))) TS_NodeFeatures_set_data_loss_protect_required(uint64_t this_arg) {
39975         LDKNodeFeatures this_arg_conv;
39976         this_arg_conv.inner = untag_ptr(this_arg);
39977         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39979         this_arg_conv.is_owned = false;
39980         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
39981 }
39982
39983 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_data_loss_protect"))) TS_NodeFeatures_supports_data_loss_protect(uint64_t this_arg) {
39984         LDKNodeFeatures this_arg_conv;
39985         this_arg_conv.inner = untag_ptr(this_arg);
39986         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39988         this_arg_conv.is_owned = false;
39989         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
39990         return ret_conv;
39991 }
39992
39993 jboolean  __attribute__((export_name("TS_InitFeatures_requires_data_loss_protect"))) TS_InitFeatures_requires_data_loss_protect(uint64_t this_arg) {
39994         LDKInitFeatures this_arg_conv;
39995         this_arg_conv.inner = untag_ptr(this_arg);
39996         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39998         this_arg_conv.is_owned = false;
39999         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
40000         return ret_conv;
40001 }
40002
40003 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_data_loss_protect"))) TS_NodeFeatures_requires_data_loss_protect(uint64_t this_arg) {
40004         LDKNodeFeatures this_arg_conv;
40005         this_arg_conv.inner = untag_ptr(this_arg);
40006         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40008         this_arg_conv.is_owned = false;
40009         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
40010         return ret_conv;
40011 }
40012
40013 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_optional"))) TS_InitFeatures_set_initial_routing_sync_optional(uint64_t this_arg) {
40014         LDKInitFeatures this_arg_conv;
40015         this_arg_conv.inner = untag_ptr(this_arg);
40016         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40018         this_arg_conv.is_owned = false;
40019         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
40020 }
40021
40022 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_required"))) TS_InitFeatures_set_initial_routing_sync_required(uint64_t this_arg) {
40023         LDKInitFeatures this_arg_conv;
40024         this_arg_conv.inner = untag_ptr(this_arg);
40025         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40027         this_arg_conv.is_owned = false;
40028         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
40029 }
40030
40031 jboolean  __attribute__((export_name("TS_InitFeatures_initial_routing_sync"))) TS_InitFeatures_initial_routing_sync(uint64_t this_arg) {
40032         LDKInitFeatures this_arg_conv;
40033         this_arg_conv.inner = untag_ptr(this_arg);
40034         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40036         this_arg_conv.is_owned = false;
40037         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
40038         return ret_conv;
40039 }
40040
40041 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_optional"))) TS_InitFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
40042         LDKInitFeatures this_arg_conv;
40043         this_arg_conv.inner = untag_ptr(this_arg);
40044         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40046         this_arg_conv.is_owned = false;
40047         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
40048 }
40049
40050 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_required"))) TS_InitFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
40051         LDKInitFeatures this_arg_conv;
40052         this_arg_conv.inner = untag_ptr(this_arg);
40053         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40055         this_arg_conv.is_owned = false;
40056         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
40057 }
40058
40059 jboolean  __attribute__((export_name("TS_InitFeatures_supports_upfront_shutdown_script"))) TS_InitFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
40060         LDKInitFeatures this_arg_conv;
40061         this_arg_conv.inner = untag_ptr(this_arg);
40062         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40064         this_arg_conv.is_owned = false;
40065         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
40066         return ret_conv;
40067 }
40068
40069 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_optional"))) TS_NodeFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
40070         LDKNodeFeatures this_arg_conv;
40071         this_arg_conv.inner = untag_ptr(this_arg);
40072         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40074         this_arg_conv.is_owned = false;
40075         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
40076 }
40077
40078 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_required"))) TS_NodeFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
40079         LDKNodeFeatures this_arg_conv;
40080         this_arg_conv.inner = untag_ptr(this_arg);
40081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40083         this_arg_conv.is_owned = false;
40084         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
40085 }
40086
40087 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_upfront_shutdown_script"))) TS_NodeFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
40088         LDKNodeFeatures this_arg_conv;
40089         this_arg_conv.inner = untag_ptr(this_arg);
40090         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40092         this_arg_conv.is_owned = false;
40093         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
40094         return ret_conv;
40095 }
40096
40097 jboolean  __attribute__((export_name("TS_InitFeatures_requires_upfront_shutdown_script"))) TS_InitFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
40098         LDKInitFeatures this_arg_conv;
40099         this_arg_conv.inner = untag_ptr(this_arg);
40100         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40102         this_arg_conv.is_owned = false;
40103         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
40104         return ret_conv;
40105 }
40106
40107 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_upfront_shutdown_script"))) TS_NodeFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
40108         LDKNodeFeatures this_arg_conv;
40109         this_arg_conv.inner = untag_ptr(this_arg);
40110         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40112         this_arg_conv.is_owned = false;
40113         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
40114         return ret_conv;
40115 }
40116
40117 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_optional"))) TS_InitFeatures_set_gossip_queries_optional(uint64_t this_arg) {
40118         LDKInitFeatures this_arg_conv;
40119         this_arg_conv.inner = untag_ptr(this_arg);
40120         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40122         this_arg_conv.is_owned = false;
40123         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
40124 }
40125
40126 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_required"))) TS_InitFeatures_set_gossip_queries_required(uint64_t this_arg) {
40127         LDKInitFeatures this_arg_conv;
40128         this_arg_conv.inner = untag_ptr(this_arg);
40129         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40131         this_arg_conv.is_owned = false;
40132         InitFeatures_set_gossip_queries_required(&this_arg_conv);
40133 }
40134
40135 jboolean  __attribute__((export_name("TS_InitFeatures_supports_gossip_queries"))) TS_InitFeatures_supports_gossip_queries(uint64_t this_arg) {
40136         LDKInitFeatures this_arg_conv;
40137         this_arg_conv.inner = untag_ptr(this_arg);
40138         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40140         this_arg_conv.is_owned = false;
40141         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
40142         return ret_conv;
40143 }
40144
40145 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_optional"))) TS_NodeFeatures_set_gossip_queries_optional(uint64_t this_arg) {
40146         LDKNodeFeatures this_arg_conv;
40147         this_arg_conv.inner = untag_ptr(this_arg);
40148         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40150         this_arg_conv.is_owned = false;
40151         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
40152 }
40153
40154 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_required"))) TS_NodeFeatures_set_gossip_queries_required(uint64_t this_arg) {
40155         LDKNodeFeatures this_arg_conv;
40156         this_arg_conv.inner = untag_ptr(this_arg);
40157         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40159         this_arg_conv.is_owned = false;
40160         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
40161 }
40162
40163 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_gossip_queries"))) TS_NodeFeatures_supports_gossip_queries(uint64_t this_arg) {
40164         LDKNodeFeatures this_arg_conv;
40165         this_arg_conv.inner = untag_ptr(this_arg);
40166         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40168         this_arg_conv.is_owned = false;
40169         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
40170         return ret_conv;
40171 }
40172
40173 jboolean  __attribute__((export_name("TS_InitFeatures_requires_gossip_queries"))) TS_InitFeatures_requires_gossip_queries(uint64_t this_arg) {
40174         LDKInitFeatures this_arg_conv;
40175         this_arg_conv.inner = untag_ptr(this_arg);
40176         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40178         this_arg_conv.is_owned = false;
40179         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
40180         return ret_conv;
40181 }
40182
40183 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_gossip_queries"))) TS_NodeFeatures_requires_gossip_queries(uint64_t this_arg) {
40184         LDKNodeFeatures this_arg_conv;
40185         this_arg_conv.inner = untag_ptr(this_arg);
40186         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40188         this_arg_conv.is_owned = false;
40189         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
40190         return ret_conv;
40191 }
40192
40193 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_optional"))) TS_InitFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
40194         LDKInitFeatures this_arg_conv;
40195         this_arg_conv.inner = untag_ptr(this_arg);
40196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40198         this_arg_conv.is_owned = false;
40199         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
40200 }
40201
40202 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_required"))) TS_InitFeatures_set_variable_length_onion_required(uint64_t this_arg) {
40203         LDKInitFeatures this_arg_conv;
40204         this_arg_conv.inner = untag_ptr(this_arg);
40205         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40207         this_arg_conv.is_owned = false;
40208         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
40209 }
40210
40211 jboolean  __attribute__((export_name("TS_InitFeatures_supports_variable_length_onion"))) TS_InitFeatures_supports_variable_length_onion(uint64_t this_arg) {
40212         LDKInitFeatures this_arg_conv;
40213         this_arg_conv.inner = untag_ptr(this_arg);
40214         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40216         this_arg_conv.is_owned = false;
40217         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
40218         return ret_conv;
40219 }
40220
40221 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_optional"))) TS_NodeFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
40222         LDKNodeFeatures this_arg_conv;
40223         this_arg_conv.inner = untag_ptr(this_arg);
40224         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40226         this_arg_conv.is_owned = false;
40227         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
40228 }
40229
40230 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_required"))) TS_NodeFeatures_set_variable_length_onion_required(uint64_t this_arg) {
40231         LDKNodeFeatures this_arg_conv;
40232         this_arg_conv.inner = untag_ptr(this_arg);
40233         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40235         this_arg_conv.is_owned = false;
40236         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
40237 }
40238
40239 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_variable_length_onion"))) TS_NodeFeatures_supports_variable_length_onion(uint64_t this_arg) {
40240         LDKNodeFeatures this_arg_conv;
40241         this_arg_conv.inner = untag_ptr(this_arg);
40242         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40244         this_arg_conv.is_owned = false;
40245         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
40246         return ret_conv;
40247 }
40248
40249 void  __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_optional"))) TS_InvoiceFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
40250         LDKInvoiceFeatures this_arg_conv;
40251         this_arg_conv.inner = untag_ptr(this_arg);
40252         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40254         this_arg_conv.is_owned = false;
40255         InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
40256 }
40257
40258 void  __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_required"))) TS_InvoiceFeatures_set_variable_length_onion_required(uint64_t this_arg) {
40259         LDKInvoiceFeatures this_arg_conv;
40260         this_arg_conv.inner = untag_ptr(this_arg);
40261         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40263         this_arg_conv.is_owned = false;
40264         InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
40265 }
40266
40267 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_variable_length_onion"))) TS_InvoiceFeatures_supports_variable_length_onion(uint64_t this_arg) {
40268         LDKInvoiceFeatures this_arg_conv;
40269         this_arg_conv.inner = untag_ptr(this_arg);
40270         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40272         this_arg_conv.is_owned = false;
40273         jboolean ret_conv = InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
40274         return ret_conv;
40275 }
40276
40277 jboolean  __attribute__((export_name("TS_InitFeatures_requires_variable_length_onion"))) TS_InitFeatures_requires_variable_length_onion(uint64_t this_arg) {
40278         LDKInitFeatures this_arg_conv;
40279         this_arg_conv.inner = untag_ptr(this_arg);
40280         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40282         this_arg_conv.is_owned = false;
40283         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
40284         return ret_conv;
40285 }
40286
40287 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_variable_length_onion"))) TS_NodeFeatures_requires_variable_length_onion(uint64_t this_arg) {
40288         LDKNodeFeatures this_arg_conv;
40289         this_arg_conv.inner = untag_ptr(this_arg);
40290         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40292         this_arg_conv.is_owned = false;
40293         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
40294         return ret_conv;
40295 }
40296
40297 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_variable_length_onion"))) TS_InvoiceFeatures_requires_variable_length_onion(uint64_t this_arg) {
40298         LDKInvoiceFeatures this_arg_conv;
40299         this_arg_conv.inner = untag_ptr(this_arg);
40300         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40302         this_arg_conv.is_owned = false;
40303         jboolean ret_conv = InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
40304         return ret_conv;
40305 }
40306
40307 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_optional"))) TS_InitFeatures_set_static_remote_key_optional(uint64_t this_arg) {
40308         LDKInitFeatures this_arg_conv;
40309         this_arg_conv.inner = untag_ptr(this_arg);
40310         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40312         this_arg_conv.is_owned = false;
40313         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
40314 }
40315
40316 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_required"))) TS_InitFeatures_set_static_remote_key_required(uint64_t this_arg) {
40317         LDKInitFeatures this_arg_conv;
40318         this_arg_conv.inner = untag_ptr(this_arg);
40319         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40321         this_arg_conv.is_owned = false;
40322         InitFeatures_set_static_remote_key_required(&this_arg_conv);
40323 }
40324
40325 jboolean  __attribute__((export_name("TS_InitFeatures_supports_static_remote_key"))) TS_InitFeatures_supports_static_remote_key(uint64_t this_arg) {
40326         LDKInitFeatures this_arg_conv;
40327         this_arg_conv.inner = untag_ptr(this_arg);
40328         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40330         this_arg_conv.is_owned = false;
40331         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
40332         return ret_conv;
40333 }
40334
40335 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_optional"))) TS_NodeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
40336         LDKNodeFeatures this_arg_conv;
40337         this_arg_conv.inner = untag_ptr(this_arg);
40338         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40340         this_arg_conv.is_owned = false;
40341         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
40342 }
40343
40344 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_required"))) TS_NodeFeatures_set_static_remote_key_required(uint64_t this_arg) {
40345         LDKNodeFeatures this_arg_conv;
40346         this_arg_conv.inner = untag_ptr(this_arg);
40347         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40349         this_arg_conv.is_owned = false;
40350         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
40351 }
40352
40353 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_static_remote_key"))) TS_NodeFeatures_supports_static_remote_key(uint64_t this_arg) {
40354         LDKNodeFeatures this_arg_conv;
40355         this_arg_conv.inner = untag_ptr(this_arg);
40356         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40358         this_arg_conv.is_owned = false;
40359         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
40360         return ret_conv;
40361 }
40362
40363 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_optional"))) TS_ChannelTypeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
40364         LDKChannelTypeFeatures this_arg_conv;
40365         this_arg_conv.inner = untag_ptr(this_arg);
40366         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40368         this_arg_conv.is_owned = false;
40369         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
40370 }
40371
40372 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_required"))) TS_ChannelTypeFeatures_set_static_remote_key_required(uint64_t this_arg) {
40373         LDKChannelTypeFeatures this_arg_conv;
40374         this_arg_conv.inner = untag_ptr(this_arg);
40375         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40377         this_arg_conv.is_owned = false;
40378         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
40379 }
40380
40381 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_static_remote_key"))) TS_ChannelTypeFeatures_supports_static_remote_key(uint64_t this_arg) {
40382         LDKChannelTypeFeatures this_arg_conv;
40383         this_arg_conv.inner = untag_ptr(this_arg);
40384         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40386         this_arg_conv.is_owned = false;
40387         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
40388         return ret_conv;
40389 }
40390
40391 jboolean  __attribute__((export_name("TS_InitFeatures_requires_static_remote_key"))) TS_InitFeatures_requires_static_remote_key(uint64_t this_arg) {
40392         LDKInitFeatures this_arg_conv;
40393         this_arg_conv.inner = untag_ptr(this_arg);
40394         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40396         this_arg_conv.is_owned = false;
40397         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
40398         return ret_conv;
40399 }
40400
40401 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_static_remote_key"))) TS_NodeFeatures_requires_static_remote_key(uint64_t this_arg) {
40402         LDKNodeFeatures this_arg_conv;
40403         this_arg_conv.inner = untag_ptr(this_arg);
40404         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40406         this_arg_conv.is_owned = false;
40407         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
40408         return ret_conv;
40409 }
40410
40411 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_static_remote_key"))) TS_ChannelTypeFeatures_requires_static_remote_key(uint64_t this_arg) {
40412         LDKChannelTypeFeatures this_arg_conv;
40413         this_arg_conv.inner = untag_ptr(this_arg);
40414         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40416         this_arg_conv.is_owned = false;
40417         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
40418         return ret_conv;
40419 }
40420
40421 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_optional"))) TS_InitFeatures_set_payment_secret_optional(uint64_t this_arg) {
40422         LDKInitFeatures this_arg_conv;
40423         this_arg_conv.inner = untag_ptr(this_arg);
40424         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40426         this_arg_conv.is_owned = false;
40427         InitFeatures_set_payment_secret_optional(&this_arg_conv);
40428 }
40429
40430 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_required"))) TS_InitFeatures_set_payment_secret_required(uint64_t this_arg) {
40431         LDKInitFeatures this_arg_conv;
40432         this_arg_conv.inner = untag_ptr(this_arg);
40433         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40435         this_arg_conv.is_owned = false;
40436         InitFeatures_set_payment_secret_required(&this_arg_conv);
40437 }
40438
40439 jboolean  __attribute__((export_name("TS_InitFeatures_supports_payment_secret"))) TS_InitFeatures_supports_payment_secret(uint64_t this_arg) {
40440         LDKInitFeatures this_arg_conv;
40441         this_arg_conv.inner = untag_ptr(this_arg);
40442         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40444         this_arg_conv.is_owned = false;
40445         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
40446         return ret_conv;
40447 }
40448
40449 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_optional"))) TS_NodeFeatures_set_payment_secret_optional(uint64_t this_arg) {
40450         LDKNodeFeatures this_arg_conv;
40451         this_arg_conv.inner = untag_ptr(this_arg);
40452         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40454         this_arg_conv.is_owned = false;
40455         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
40456 }
40457
40458 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_required"))) TS_NodeFeatures_set_payment_secret_required(uint64_t this_arg) {
40459         LDKNodeFeatures this_arg_conv;
40460         this_arg_conv.inner = untag_ptr(this_arg);
40461         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40463         this_arg_conv.is_owned = false;
40464         NodeFeatures_set_payment_secret_required(&this_arg_conv);
40465 }
40466
40467 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_payment_secret"))) TS_NodeFeatures_supports_payment_secret(uint64_t this_arg) {
40468         LDKNodeFeatures this_arg_conv;
40469         this_arg_conv.inner = untag_ptr(this_arg);
40470         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40472         this_arg_conv.is_owned = false;
40473         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
40474         return ret_conv;
40475 }
40476
40477 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_optional"))) TS_InvoiceFeatures_set_payment_secret_optional(uint64_t this_arg) {
40478         LDKInvoiceFeatures this_arg_conv;
40479         this_arg_conv.inner = untag_ptr(this_arg);
40480         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40482         this_arg_conv.is_owned = false;
40483         InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
40484 }
40485
40486 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_required"))) TS_InvoiceFeatures_set_payment_secret_required(uint64_t this_arg) {
40487         LDKInvoiceFeatures this_arg_conv;
40488         this_arg_conv.inner = untag_ptr(this_arg);
40489         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40491         this_arg_conv.is_owned = false;
40492         InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
40493 }
40494
40495 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_payment_secret"))) TS_InvoiceFeatures_supports_payment_secret(uint64_t this_arg) {
40496         LDKInvoiceFeatures this_arg_conv;
40497         this_arg_conv.inner = untag_ptr(this_arg);
40498         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40500         this_arg_conv.is_owned = false;
40501         jboolean ret_conv = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
40502         return ret_conv;
40503 }
40504
40505 jboolean  __attribute__((export_name("TS_InitFeatures_requires_payment_secret"))) TS_InitFeatures_requires_payment_secret(uint64_t this_arg) {
40506         LDKInitFeatures this_arg_conv;
40507         this_arg_conv.inner = untag_ptr(this_arg);
40508         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40510         this_arg_conv.is_owned = false;
40511         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
40512         return ret_conv;
40513 }
40514
40515 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_payment_secret"))) TS_NodeFeatures_requires_payment_secret(uint64_t this_arg) {
40516         LDKNodeFeatures this_arg_conv;
40517         this_arg_conv.inner = untag_ptr(this_arg);
40518         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40520         this_arg_conv.is_owned = false;
40521         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
40522         return ret_conv;
40523 }
40524
40525 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_payment_secret"))) TS_InvoiceFeatures_requires_payment_secret(uint64_t this_arg) {
40526         LDKInvoiceFeatures this_arg_conv;
40527         this_arg_conv.inner = untag_ptr(this_arg);
40528         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40530         this_arg_conv.is_owned = false;
40531         jboolean ret_conv = InvoiceFeatures_requires_payment_secret(&this_arg_conv);
40532         return ret_conv;
40533 }
40534
40535 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_optional"))) TS_InitFeatures_set_basic_mpp_optional(uint64_t this_arg) {
40536         LDKInitFeatures this_arg_conv;
40537         this_arg_conv.inner = untag_ptr(this_arg);
40538         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40540         this_arg_conv.is_owned = false;
40541         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
40542 }
40543
40544 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_required"))) TS_InitFeatures_set_basic_mpp_required(uint64_t this_arg) {
40545         LDKInitFeatures this_arg_conv;
40546         this_arg_conv.inner = untag_ptr(this_arg);
40547         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40549         this_arg_conv.is_owned = false;
40550         InitFeatures_set_basic_mpp_required(&this_arg_conv);
40551 }
40552
40553 jboolean  __attribute__((export_name("TS_InitFeatures_supports_basic_mpp"))) TS_InitFeatures_supports_basic_mpp(uint64_t this_arg) {
40554         LDKInitFeatures this_arg_conv;
40555         this_arg_conv.inner = untag_ptr(this_arg);
40556         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40558         this_arg_conv.is_owned = false;
40559         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
40560         return ret_conv;
40561 }
40562
40563 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_optional"))) TS_NodeFeatures_set_basic_mpp_optional(uint64_t this_arg) {
40564         LDKNodeFeatures this_arg_conv;
40565         this_arg_conv.inner = untag_ptr(this_arg);
40566         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40568         this_arg_conv.is_owned = false;
40569         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
40570 }
40571
40572 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_required"))) TS_NodeFeatures_set_basic_mpp_required(uint64_t this_arg) {
40573         LDKNodeFeatures this_arg_conv;
40574         this_arg_conv.inner = untag_ptr(this_arg);
40575         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40577         this_arg_conv.is_owned = false;
40578         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
40579 }
40580
40581 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_basic_mpp"))) TS_NodeFeatures_supports_basic_mpp(uint64_t this_arg) {
40582         LDKNodeFeatures this_arg_conv;
40583         this_arg_conv.inner = untag_ptr(this_arg);
40584         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40586         this_arg_conv.is_owned = false;
40587         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
40588         return ret_conv;
40589 }
40590
40591 void  __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_optional"))) TS_InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
40592         LDKInvoiceFeatures this_arg_conv;
40593         this_arg_conv.inner = untag_ptr(this_arg);
40594         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40596         this_arg_conv.is_owned = false;
40597         InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
40598 }
40599
40600 void  __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_required"))) TS_InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
40601         LDKInvoiceFeatures this_arg_conv;
40602         this_arg_conv.inner = untag_ptr(this_arg);
40603         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40605         this_arg_conv.is_owned = false;
40606         InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
40607 }
40608
40609 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_basic_mpp"))) TS_InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
40610         LDKInvoiceFeatures this_arg_conv;
40611         this_arg_conv.inner = untag_ptr(this_arg);
40612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40614         this_arg_conv.is_owned = false;
40615         jboolean ret_conv = InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
40616         return ret_conv;
40617 }
40618
40619 jboolean  __attribute__((export_name("TS_InitFeatures_requires_basic_mpp"))) TS_InitFeatures_requires_basic_mpp(uint64_t this_arg) {
40620         LDKInitFeatures this_arg_conv;
40621         this_arg_conv.inner = untag_ptr(this_arg);
40622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40624         this_arg_conv.is_owned = false;
40625         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
40626         return ret_conv;
40627 }
40628
40629 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_basic_mpp"))) TS_NodeFeatures_requires_basic_mpp(uint64_t this_arg) {
40630         LDKNodeFeatures this_arg_conv;
40631         this_arg_conv.inner = untag_ptr(this_arg);
40632         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40634         this_arg_conv.is_owned = false;
40635         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
40636         return ret_conv;
40637 }
40638
40639 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_basic_mpp"))) TS_InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
40640         LDKInvoiceFeatures this_arg_conv;
40641         this_arg_conv.inner = untag_ptr(this_arg);
40642         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40644         this_arg_conv.is_owned = false;
40645         jboolean ret_conv = InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
40646         return ret_conv;
40647 }
40648
40649 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_optional"))) TS_InitFeatures_set_wumbo_optional(uint64_t this_arg) {
40650         LDKInitFeatures this_arg_conv;
40651         this_arg_conv.inner = untag_ptr(this_arg);
40652         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40654         this_arg_conv.is_owned = false;
40655         InitFeatures_set_wumbo_optional(&this_arg_conv);
40656 }
40657
40658 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_required"))) TS_InitFeatures_set_wumbo_required(uint64_t this_arg) {
40659         LDKInitFeatures this_arg_conv;
40660         this_arg_conv.inner = untag_ptr(this_arg);
40661         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40663         this_arg_conv.is_owned = false;
40664         InitFeatures_set_wumbo_required(&this_arg_conv);
40665 }
40666
40667 jboolean  __attribute__((export_name("TS_InitFeatures_supports_wumbo"))) TS_InitFeatures_supports_wumbo(uint64_t this_arg) {
40668         LDKInitFeatures this_arg_conv;
40669         this_arg_conv.inner = untag_ptr(this_arg);
40670         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40672         this_arg_conv.is_owned = false;
40673         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
40674         return ret_conv;
40675 }
40676
40677 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_optional"))) TS_NodeFeatures_set_wumbo_optional(uint64_t this_arg) {
40678         LDKNodeFeatures this_arg_conv;
40679         this_arg_conv.inner = untag_ptr(this_arg);
40680         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40682         this_arg_conv.is_owned = false;
40683         NodeFeatures_set_wumbo_optional(&this_arg_conv);
40684 }
40685
40686 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_required"))) TS_NodeFeatures_set_wumbo_required(uint64_t this_arg) {
40687         LDKNodeFeatures this_arg_conv;
40688         this_arg_conv.inner = untag_ptr(this_arg);
40689         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40691         this_arg_conv.is_owned = false;
40692         NodeFeatures_set_wumbo_required(&this_arg_conv);
40693 }
40694
40695 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_wumbo"))) TS_NodeFeatures_supports_wumbo(uint64_t this_arg) {
40696         LDKNodeFeatures this_arg_conv;
40697         this_arg_conv.inner = untag_ptr(this_arg);
40698         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40700         this_arg_conv.is_owned = false;
40701         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
40702         return ret_conv;
40703 }
40704
40705 jboolean  __attribute__((export_name("TS_InitFeatures_requires_wumbo"))) TS_InitFeatures_requires_wumbo(uint64_t this_arg) {
40706         LDKInitFeatures this_arg_conv;
40707         this_arg_conv.inner = untag_ptr(this_arg);
40708         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40710         this_arg_conv.is_owned = false;
40711         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
40712         return ret_conv;
40713 }
40714
40715 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_wumbo"))) TS_NodeFeatures_requires_wumbo(uint64_t this_arg) {
40716         LDKNodeFeatures this_arg_conv;
40717         this_arg_conv.inner = untag_ptr(this_arg);
40718         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40720         this_arg_conv.is_owned = false;
40721         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
40722         return ret_conv;
40723 }
40724
40725 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_optional"))) TS_InitFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
40726         LDKInitFeatures this_arg_conv;
40727         this_arg_conv.inner = untag_ptr(this_arg);
40728         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40730         this_arg_conv.is_owned = false;
40731         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
40732 }
40733
40734 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_required"))) TS_InitFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
40735         LDKInitFeatures this_arg_conv;
40736         this_arg_conv.inner = untag_ptr(this_arg);
40737         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40739         this_arg_conv.is_owned = false;
40740         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
40741 }
40742
40743 jboolean  __attribute__((export_name("TS_InitFeatures_supports_shutdown_anysegwit"))) TS_InitFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
40744         LDKInitFeatures this_arg_conv;
40745         this_arg_conv.inner = untag_ptr(this_arg);
40746         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40748         this_arg_conv.is_owned = false;
40749         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
40750         return ret_conv;
40751 }
40752
40753 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_optional"))) TS_NodeFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
40754         LDKNodeFeatures this_arg_conv;
40755         this_arg_conv.inner = untag_ptr(this_arg);
40756         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40758         this_arg_conv.is_owned = false;
40759         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
40760 }
40761
40762 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_required"))) TS_NodeFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
40763         LDKNodeFeatures this_arg_conv;
40764         this_arg_conv.inner = untag_ptr(this_arg);
40765         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40767         this_arg_conv.is_owned = false;
40768         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
40769 }
40770
40771 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_shutdown_anysegwit"))) TS_NodeFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
40772         LDKNodeFeatures this_arg_conv;
40773         this_arg_conv.inner = untag_ptr(this_arg);
40774         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40776         this_arg_conv.is_owned = false;
40777         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
40778         return ret_conv;
40779 }
40780
40781 jboolean  __attribute__((export_name("TS_InitFeatures_requires_shutdown_anysegwit"))) TS_InitFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
40782         LDKInitFeatures this_arg_conv;
40783         this_arg_conv.inner = untag_ptr(this_arg);
40784         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40786         this_arg_conv.is_owned = false;
40787         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
40788         return ret_conv;
40789 }
40790
40791 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_shutdown_anysegwit"))) TS_NodeFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
40792         LDKNodeFeatures this_arg_conv;
40793         this_arg_conv.inner = untag_ptr(this_arg);
40794         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40796         this_arg_conv.is_owned = false;
40797         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
40798         return ret_conv;
40799 }
40800
40801 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_optional"))) TS_InitFeatures_set_onion_messages_optional(uint64_t this_arg) {
40802         LDKInitFeatures this_arg_conv;
40803         this_arg_conv.inner = untag_ptr(this_arg);
40804         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40806         this_arg_conv.is_owned = false;
40807         InitFeatures_set_onion_messages_optional(&this_arg_conv);
40808 }
40809
40810 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_required"))) TS_InitFeatures_set_onion_messages_required(uint64_t this_arg) {
40811         LDKInitFeatures this_arg_conv;
40812         this_arg_conv.inner = untag_ptr(this_arg);
40813         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40815         this_arg_conv.is_owned = false;
40816         InitFeatures_set_onion_messages_required(&this_arg_conv);
40817 }
40818
40819 jboolean  __attribute__((export_name("TS_InitFeatures_supports_onion_messages"))) TS_InitFeatures_supports_onion_messages(uint64_t this_arg) {
40820         LDKInitFeatures this_arg_conv;
40821         this_arg_conv.inner = untag_ptr(this_arg);
40822         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40824         this_arg_conv.is_owned = false;
40825         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
40826         return ret_conv;
40827 }
40828
40829 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_optional"))) TS_NodeFeatures_set_onion_messages_optional(uint64_t this_arg) {
40830         LDKNodeFeatures this_arg_conv;
40831         this_arg_conv.inner = untag_ptr(this_arg);
40832         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40834         this_arg_conv.is_owned = false;
40835         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
40836 }
40837
40838 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_required"))) TS_NodeFeatures_set_onion_messages_required(uint64_t this_arg) {
40839         LDKNodeFeatures this_arg_conv;
40840         this_arg_conv.inner = untag_ptr(this_arg);
40841         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40843         this_arg_conv.is_owned = false;
40844         NodeFeatures_set_onion_messages_required(&this_arg_conv);
40845 }
40846
40847 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_onion_messages"))) TS_NodeFeatures_supports_onion_messages(uint64_t this_arg) {
40848         LDKNodeFeatures this_arg_conv;
40849         this_arg_conv.inner = untag_ptr(this_arg);
40850         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40852         this_arg_conv.is_owned = false;
40853         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
40854         return ret_conv;
40855 }
40856
40857 jboolean  __attribute__((export_name("TS_InitFeatures_requires_onion_messages"))) TS_InitFeatures_requires_onion_messages(uint64_t this_arg) {
40858         LDKInitFeatures this_arg_conv;
40859         this_arg_conv.inner = untag_ptr(this_arg);
40860         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40862         this_arg_conv.is_owned = false;
40863         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
40864         return ret_conv;
40865 }
40866
40867 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_onion_messages"))) TS_NodeFeatures_requires_onion_messages(uint64_t this_arg) {
40868         LDKNodeFeatures this_arg_conv;
40869         this_arg_conv.inner = untag_ptr(this_arg);
40870         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40872         this_arg_conv.is_owned = false;
40873         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
40874         return ret_conv;
40875 }
40876
40877 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_optional"))) TS_InitFeatures_set_channel_type_optional(uint64_t this_arg) {
40878         LDKInitFeatures this_arg_conv;
40879         this_arg_conv.inner = untag_ptr(this_arg);
40880         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40882         this_arg_conv.is_owned = false;
40883         InitFeatures_set_channel_type_optional(&this_arg_conv);
40884 }
40885
40886 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_required"))) TS_InitFeatures_set_channel_type_required(uint64_t this_arg) {
40887         LDKInitFeatures this_arg_conv;
40888         this_arg_conv.inner = untag_ptr(this_arg);
40889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40891         this_arg_conv.is_owned = false;
40892         InitFeatures_set_channel_type_required(&this_arg_conv);
40893 }
40894
40895 jboolean  __attribute__((export_name("TS_InitFeatures_supports_channel_type"))) TS_InitFeatures_supports_channel_type(uint64_t this_arg) {
40896         LDKInitFeatures this_arg_conv;
40897         this_arg_conv.inner = untag_ptr(this_arg);
40898         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40900         this_arg_conv.is_owned = false;
40901         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
40902         return ret_conv;
40903 }
40904
40905 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_optional"))) TS_NodeFeatures_set_channel_type_optional(uint64_t this_arg) {
40906         LDKNodeFeatures this_arg_conv;
40907         this_arg_conv.inner = untag_ptr(this_arg);
40908         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40910         this_arg_conv.is_owned = false;
40911         NodeFeatures_set_channel_type_optional(&this_arg_conv);
40912 }
40913
40914 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_required"))) TS_NodeFeatures_set_channel_type_required(uint64_t this_arg) {
40915         LDKNodeFeatures this_arg_conv;
40916         this_arg_conv.inner = untag_ptr(this_arg);
40917         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40919         this_arg_conv.is_owned = false;
40920         NodeFeatures_set_channel_type_required(&this_arg_conv);
40921 }
40922
40923 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_channel_type"))) TS_NodeFeatures_supports_channel_type(uint64_t this_arg) {
40924         LDKNodeFeatures this_arg_conv;
40925         this_arg_conv.inner = untag_ptr(this_arg);
40926         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40928         this_arg_conv.is_owned = false;
40929         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
40930         return ret_conv;
40931 }
40932
40933 jboolean  __attribute__((export_name("TS_InitFeatures_requires_channel_type"))) TS_InitFeatures_requires_channel_type(uint64_t this_arg) {
40934         LDKInitFeatures this_arg_conv;
40935         this_arg_conv.inner = untag_ptr(this_arg);
40936         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40938         this_arg_conv.is_owned = false;
40939         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
40940         return ret_conv;
40941 }
40942
40943 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_channel_type"))) TS_NodeFeatures_requires_channel_type(uint64_t this_arg) {
40944         LDKNodeFeatures this_arg_conv;
40945         this_arg_conv.inner = untag_ptr(this_arg);
40946         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40948         this_arg_conv.is_owned = false;
40949         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
40950         return ret_conv;
40951 }
40952
40953 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_optional"))) TS_InitFeatures_set_scid_privacy_optional(uint64_t this_arg) {
40954         LDKInitFeatures this_arg_conv;
40955         this_arg_conv.inner = untag_ptr(this_arg);
40956         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40958         this_arg_conv.is_owned = false;
40959         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
40960 }
40961
40962 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_required"))) TS_InitFeatures_set_scid_privacy_required(uint64_t this_arg) {
40963         LDKInitFeatures this_arg_conv;
40964         this_arg_conv.inner = untag_ptr(this_arg);
40965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40967         this_arg_conv.is_owned = false;
40968         InitFeatures_set_scid_privacy_required(&this_arg_conv);
40969 }
40970
40971 jboolean  __attribute__((export_name("TS_InitFeatures_supports_scid_privacy"))) TS_InitFeatures_supports_scid_privacy(uint64_t this_arg) {
40972         LDKInitFeatures this_arg_conv;
40973         this_arg_conv.inner = untag_ptr(this_arg);
40974         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40976         this_arg_conv.is_owned = false;
40977         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
40978         return ret_conv;
40979 }
40980
40981 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_optional"))) TS_NodeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
40982         LDKNodeFeatures this_arg_conv;
40983         this_arg_conv.inner = untag_ptr(this_arg);
40984         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40986         this_arg_conv.is_owned = false;
40987         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
40988 }
40989
40990 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_required"))) TS_NodeFeatures_set_scid_privacy_required(uint64_t this_arg) {
40991         LDKNodeFeatures this_arg_conv;
40992         this_arg_conv.inner = untag_ptr(this_arg);
40993         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40995         this_arg_conv.is_owned = false;
40996         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
40997 }
40998
40999 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_scid_privacy"))) TS_NodeFeatures_supports_scid_privacy(uint64_t this_arg) {
41000         LDKNodeFeatures this_arg_conv;
41001         this_arg_conv.inner = untag_ptr(this_arg);
41002         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41004         this_arg_conv.is_owned = false;
41005         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
41006         return ret_conv;
41007 }
41008
41009 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_optional"))) TS_ChannelTypeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
41010         LDKChannelTypeFeatures this_arg_conv;
41011         this_arg_conv.inner = untag_ptr(this_arg);
41012         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41014         this_arg_conv.is_owned = false;
41015         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
41016 }
41017
41018 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_required"))) TS_ChannelTypeFeatures_set_scid_privacy_required(uint64_t this_arg) {
41019         LDKChannelTypeFeatures this_arg_conv;
41020         this_arg_conv.inner = untag_ptr(this_arg);
41021         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41023         this_arg_conv.is_owned = false;
41024         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
41025 }
41026
41027 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_scid_privacy"))) TS_ChannelTypeFeatures_supports_scid_privacy(uint64_t this_arg) {
41028         LDKChannelTypeFeatures this_arg_conv;
41029         this_arg_conv.inner = untag_ptr(this_arg);
41030         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41032         this_arg_conv.is_owned = false;
41033         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
41034         return ret_conv;
41035 }
41036
41037 jboolean  __attribute__((export_name("TS_InitFeatures_requires_scid_privacy"))) TS_InitFeatures_requires_scid_privacy(uint64_t this_arg) {
41038         LDKInitFeatures this_arg_conv;
41039         this_arg_conv.inner = untag_ptr(this_arg);
41040         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41042         this_arg_conv.is_owned = false;
41043         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
41044         return ret_conv;
41045 }
41046
41047 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_scid_privacy"))) TS_NodeFeatures_requires_scid_privacy(uint64_t this_arg) {
41048         LDKNodeFeatures this_arg_conv;
41049         this_arg_conv.inner = untag_ptr(this_arg);
41050         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41052         this_arg_conv.is_owned = false;
41053         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
41054         return ret_conv;
41055 }
41056
41057 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_scid_privacy"))) TS_ChannelTypeFeatures_requires_scid_privacy(uint64_t this_arg) {
41058         LDKChannelTypeFeatures this_arg_conv;
41059         this_arg_conv.inner = untag_ptr(this_arg);
41060         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41062         this_arg_conv.is_owned = false;
41063         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
41064         return ret_conv;
41065 }
41066
41067 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_optional"))) TS_InitFeatures_set_zero_conf_optional(uint64_t this_arg) {
41068         LDKInitFeatures this_arg_conv;
41069         this_arg_conv.inner = untag_ptr(this_arg);
41070         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41072         this_arg_conv.is_owned = false;
41073         InitFeatures_set_zero_conf_optional(&this_arg_conv);
41074 }
41075
41076 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_required"))) TS_InitFeatures_set_zero_conf_required(uint64_t this_arg) {
41077         LDKInitFeatures this_arg_conv;
41078         this_arg_conv.inner = untag_ptr(this_arg);
41079         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41081         this_arg_conv.is_owned = false;
41082         InitFeatures_set_zero_conf_required(&this_arg_conv);
41083 }
41084
41085 jboolean  __attribute__((export_name("TS_InitFeatures_supports_zero_conf"))) TS_InitFeatures_supports_zero_conf(uint64_t this_arg) {
41086         LDKInitFeatures this_arg_conv;
41087         this_arg_conv.inner = untag_ptr(this_arg);
41088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41090         this_arg_conv.is_owned = false;
41091         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
41092         return ret_conv;
41093 }
41094
41095 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_optional"))) TS_NodeFeatures_set_zero_conf_optional(uint64_t this_arg) {
41096         LDKNodeFeatures this_arg_conv;
41097         this_arg_conv.inner = untag_ptr(this_arg);
41098         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41100         this_arg_conv.is_owned = false;
41101         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
41102 }
41103
41104 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_required"))) TS_NodeFeatures_set_zero_conf_required(uint64_t this_arg) {
41105         LDKNodeFeatures this_arg_conv;
41106         this_arg_conv.inner = untag_ptr(this_arg);
41107         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41109         this_arg_conv.is_owned = false;
41110         NodeFeatures_set_zero_conf_required(&this_arg_conv);
41111 }
41112
41113 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_zero_conf"))) TS_NodeFeatures_supports_zero_conf(uint64_t this_arg) {
41114         LDKNodeFeatures this_arg_conv;
41115         this_arg_conv.inner = untag_ptr(this_arg);
41116         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41118         this_arg_conv.is_owned = false;
41119         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
41120         return ret_conv;
41121 }
41122
41123 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_optional"))) TS_ChannelTypeFeatures_set_zero_conf_optional(uint64_t this_arg) {
41124         LDKChannelTypeFeatures this_arg_conv;
41125         this_arg_conv.inner = untag_ptr(this_arg);
41126         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41128         this_arg_conv.is_owned = false;
41129         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
41130 }
41131
41132 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_required"))) TS_ChannelTypeFeatures_set_zero_conf_required(uint64_t this_arg) {
41133         LDKChannelTypeFeatures this_arg_conv;
41134         this_arg_conv.inner = untag_ptr(this_arg);
41135         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41137         this_arg_conv.is_owned = false;
41138         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
41139 }
41140
41141 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_zero_conf"))) TS_ChannelTypeFeatures_supports_zero_conf(uint64_t this_arg) {
41142         LDKChannelTypeFeatures this_arg_conv;
41143         this_arg_conv.inner = untag_ptr(this_arg);
41144         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41146         this_arg_conv.is_owned = false;
41147         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
41148         return ret_conv;
41149 }
41150
41151 jboolean  __attribute__((export_name("TS_InitFeatures_requires_zero_conf"))) TS_InitFeatures_requires_zero_conf(uint64_t this_arg) {
41152         LDKInitFeatures this_arg_conv;
41153         this_arg_conv.inner = untag_ptr(this_arg);
41154         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41156         this_arg_conv.is_owned = false;
41157         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
41158         return ret_conv;
41159 }
41160
41161 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_zero_conf"))) TS_NodeFeatures_requires_zero_conf(uint64_t this_arg) {
41162         LDKNodeFeatures this_arg_conv;
41163         this_arg_conv.inner = untag_ptr(this_arg);
41164         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41166         this_arg_conv.is_owned = false;
41167         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
41168         return ret_conv;
41169 }
41170
41171 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_zero_conf"))) TS_ChannelTypeFeatures_requires_zero_conf(uint64_t this_arg) {
41172         LDKChannelTypeFeatures this_arg_conv;
41173         this_arg_conv.inner = untag_ptr(this_arg);
41174         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41176         this_arg_conv.is_owned = false;
41177         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
41178         return ret_conv;
41179 }
41180
41181 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_optional"))) TS_NodeFeatures_set_keysend_optional(uint64_t this_arg) {
41182         LDKNodeFeatures this_arg_conv;
41183         this_arg_conv.inner = untag_ptr(this_arg);
41184         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41186         this_arg_conv.is_owned = false;
41187         NodeFeatures_set_keysend_optional(&this_arg_conv);
41188 }
41189
41190 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_required"))) TS_NodeFeatures_set_keysend_required(uint64_t this_arg) {
41191         LDKNodeFeatures this_arg_conv;
41192         this_arg_conv.inner = untag_ptr(this_arg);
41193         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41195         this_arg_conv.is_owned = false;
41196         NodeFeatures_set_keysend_required(&this_arg_conv);
41197 }
41198
41199 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_keysend"))) TS_NodeFeatures_supports_keysend(uint64_t this_arg) {
41200         LDKNodeFeatures this_arg_conv;
41201         this_arg_conv.inner = untag_ptr(this_arg);
41202         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41204         this_arg_conv.is_owned = false;
41205         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
41206         return ret_conv;
41207 }
41208
41209 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_keysend"))) TS_NodeFeatures_requires_keysend(uint64_t this_arg) {
41210         LDKNodeFeatures this_arg_conv;
41211         this_arg_conv.inner = untag_ptr(this_arg);
41212         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41214         this_arg_conv.is_owned = false;
41215         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
41216         return ret_conv;
41217 }
41218
41219 void  __attribute__((export_name("TS_ShutdownScript_free"))) TS_ShutdownScript_free(uint64_t this_obj) {
41220         LDKShutdownScript this_obj_conv;
41221         this_obj_conv.inner = untag_ptr(this_obj);
41222         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41224         ShutdownScript_free(this_obj_conv);
41225 }
41226
41227 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
41228         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
41229         uint64_t ret_ref = 0;
41230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41232         return ret_ref;
41233 }
41234 int64_t  __attribute__((export_name("TS_ShutdownScript_clone_ptr"))) TS_ShutdownScript_clone_ptr(uint64_t arg) {
41235         LDKShutdownScript arg_conv;
41236         arg_conv.inner = untag_ptr(arg);
41237         arg_conv.is_owned = ptr_is_owned(arg);
41238         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41239         arg_conv.is_owned = false;
41240         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
41241         return ret_conv;
41242 }
41243
41244 uint64_t  __attribute__((export_name("TS_ShutdownScript_clone"))) TS_ShutdownScript_clone(uint64_t orig) {
41245         LDKShutdownScript orig_conv;
41246         orig_conv.inner = untag_ptr(orig);
41247         orig_conv.is_owned = ptr_is_owned(orig);
41248         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41249         orig_conv.is_owned = false;
41250         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
41251         uint64_t ret_ref = 0;
41252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41254         return ret_ref;
41255 }
41256
41257 jboolean  __attribute__((export_name("TS_ShutdownScript_eq"))) TS_ShutdownScript_eq(uint64_t a, uint64_t b) {
41258         LDKShutdownScript a_conv;
41259         a_conv.inner = untag_ptr(a);
41260         a_conv.is_owned = ptr_is_owned(a);
41261         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41262         a_conv.is_owned = false;
41263         LDKShutdownScript b_conv;
41264         b_conv.inner = untag_ptr(b);
41265         b_conv.is_owned = ptr_is_owned(b);
41266         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41267         b_conv.is_owned = false;
41268         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
41269         return ret_conv;
41270 }
41271
41272 void  __attribute__((export_name("TS_InvalidShutdownScript_free"))) TS_InvalidShutdownScript_free(uint64_t this_obj) {
41273         LDKInvalidShutdownScript this_obj_conv;
41274         this_obj_conv.inner = untag_ptr(this_obj);
41275         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41277         InvalidShutdownScript_free(this_obj_conv);
41278 }
41279
41280 int8_tArray  __attribute__((export_name("TS_InvalidShutdownScript_get_script"))) TS_InvalidShutdownScript_get_script(uint64_t this_ptr) {
41281         LDKInvalidShutdownScript this_ptr_conv;
41282         this_ptr_conv.inner = untag_ptr(this_ptr);
41283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41285         this_ptr_conv.is_owned = false;
41286         LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
41287         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41288         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41289         return ret_arr;
41290 }
41291
41292 void  __attribute__((export_name("TS_InvalidShutdownScript_set_script"))) TS_InvalidShutdownScript_set_script(uint64_t this_ptr, int8_tArray val) {
41293         LDKInvalidShutdownScript this_ptr_conv;
41294         this_ptr_conv.inner = untag_ptr(this_ptr);
41295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41297         this_ptr_conv.is_owned = false;
41298         LDKCVec_u8Z val_ref;
41299         val_ref.datalen = val->arr_len;
41300         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
41301         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
41302         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
41303 }
41304
41305 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_new"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
41306         LDKCVec_u8Z script_arg_ref;
41307         script_arg_ref.datalen = script_arg->arr_len;
41308         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
41309         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
41310         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
41311         uint64_t ret_ref = 0;
41312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41314         return ret_ref;
41315 }
41316
41317 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
41318         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
41319         uint64_t ret_ref = 0;
41320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41322         return ret_ref;
41323 }
41324 int64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone_ptr"))) TS_InvalidShutdownScript_clone_ptr(uint64_t arg) {
41325         LDKInvalidShutdownScript arg_conv;
41326         arg_conv.inner = untag_ptr(arg);
41327         arg_conv.is_owned = ptr_is_owned(arg);
41328         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41329         arg_conv.is_owned = false;
41330         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
41331         return ret_conv;
41332 }
41333
41334 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone"))) TS_InvalidShutdownScript_clone(uint64_t orig) {
41335         LDKInvalidShutdownScript orig_conv;
41336         orig_conv.inner = untag_ptr(orig);
41337         orig_conv.is_owned = ptr_is_owned(orig);
41338         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41339         orig_conv.is_owned = false;
41340         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
41341         uint64_t ret_ref = 0;
41342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41344         return ret_ref;
41345 }
41346
41347 int8_tArray  __attribute__((export_name("TS_ShutdownScript_write"))) TS_ShutdownScript_write(uint64_t obj) {
41348         LDKShutdownScript obj_conv;
41349         obj_conv.inner = untag_ptr(obj);
41350         obj_conv.is_owned = ptr_is_owned(obj);
41351         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41352         obj_conv.is_owned = false;
41353         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
41354         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41355         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41356         CVec_u8Z_free(ret_var);
41357         return ret_arr;
41358 }
41359
41360 uint64_t  __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScript_read(int8_tArray ser) {
41361         LDKu8slice ser_ref;
41362         ser_ref.datalen = ser->arr_len;
41363         ser_ref.data = ser->elems;
41364         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
41365         *ret_conv = ShutdownScript_read(ser_ref);
41366         FREE(ser);
41367         return tag_ptr(ret_conv, true);
41368 }
41369
41370 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
41371         unsigned char pubkey_hash_arr[20];
41372         CHECK(pubkey_hash->arr_len == 20);
41373         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
41374         unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
41375         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
41376         uint64_t ret_ref = 0;
41377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41379         return ret_ref;
41380 }
41381
41382 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
41383         unsigned char script_hash_arr[32];
41384         CHECK(script_hash->arr_len == 32);
41385         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
41386         unsigned char (*script_hash_ref)[32] = &script_hash_arr;
41387         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
41388         uint64_t ret_ref = 0;
41389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41391         return ret_ref;
41392 }
41393
41394 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_witness_program"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
41395         
41396         LDKu8slice program_ref;
41397         program_ref.datalen = program->arr_len;
41398         program_ref.data = program->elems;
41399         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
41400         *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
41401         FREE(program);
41402         return tag_ptr(ret_conv, true);
41403 }
41404
41405 int8_tArray  __attribute__((export_name("TS_ShutdownScript_into_inner"))) TS_ShutdownScript_into_inner(uint64_t this_arg) {
41406         LDKShutdownScript this_arg_conv;
41407         this_arg_conv.inner = untag_ptr(this_arg);
41408         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41410         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
41411         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
41412         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41413         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41414         CVec_u8Z_free(ret_var);
41415         return ret_arr;
41416 }
41417
41418 int8_tArray  __attribute__((export_name("TS_ShutdownScript_as_legacy_pubkey"))) TS_ShutdownScript_as_legacy_pubkey(uint64_t this_arg) {
41419         LDKShutdownScript this_arg_conv;
41420         this_arg_conv.inner = untag_ptr(this_arg);
41421         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41423         this_arg_conv.is_owned = false;
41424         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41425         memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
41426         return ret_arr;
41427 }
41428
41429 jboolean  __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_ShutdownScript_is_compatible(uint64_t this_arg, uint64_t features) {
41430         LDKShutdownScript this_arg_conv;
41431         this_arg_conv.inner = untag_ptr(this_arg);
41432         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41434         this_arg_conv.is_owned = false;
41435         LDKInitFeatures features_conv;
41436         features_conv.inner = untag_ptr(features);
41437         features_conv.is_owned = ptr_is_owned(features);
41438         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
41439         features_conv.is_owned = false;
41440         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
41441         return ret_conv;
41442 }
41443
41444 void  __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint64_t this_ptr) {
41445         if (!ptr_is_owned(this_ptr)) return;
41446         void* this_ptr_ptr = untag_ptr(this_ptr);
41447         CHECK_ACCESS(this_ptr_ptr);
41448         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
41449         FREE(untag_ptr(this_ptr));
41450         CustomMessageReader_free(this_ptr_conv);
41451 }
41452
41453 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
41454         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
41455         *ret_ret = Type_clone(arg);
41456         return tag_ptr(ret_ret, true);
41457 }
41458 int64_t  __attribute__((export_name("TS_Type_clone_ptr"))) TS_Type_clone_ptr(uint64_t arg) {
41459         void* arg_ptr = untag_ptr(arg);
41460         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
41461         LDKType* arg_conv = (LDKType*)arg_ptr;
41462         int64_t ret_conv = Type_clone_ptr(arg_conv);
41463         return ret_conv;
41464 }
41465
41466 uint64_t  __attribute__((export_name("TS_Type_clone"))) TS_Type_clone(uint64_t orig) {
41467         void* orig_ptr = untag_ptr(orig);
41468         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
41469         LDKType* orig_conv = (LDKType*)orig_ptr;
41470         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
41471         *ret_ret = Type_clone(orig_conv);
41472         return tag_ptr(ret_ret, true);
41473 }
41474
41475 void  __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint64_t this_ptr) {
41476         if (!ptr_is_owned(this_ptr)) return;
41477         void* this_ptr_ptr = untag_ptr(this_ptr);
41478         CHECK_ACCESS(this_ptr_ptr);
41479         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
41480         FREE(untag_ptr(this_ptr));
41481         Type_free(this_ptr_conv);
41482 }
41483
41484 void  __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint64_t this_obj) {
41485         LDKNodeId this_obj_conv;
41486         this_obj_conv.inner = untag_ptr(this_obj);
41487         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41489         NodeId_free(this_obj_conv);
41490 }
41491
41492 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
41493         LDKNodeId ret_var = NodeId_clone(arg);
41494         uint64_t ret_ref = 0;
41495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41497         return ret_ref;
41498 }
41499 int64_t  __attribute__((export_name("TS_NodeId_clone_ptr"))) TS_NodeId_clone_ptr(uint64_t arg) {
41500         LDKNodeId arg_conv;
41501         arg_conv.inner = untag_ptr(arg);
41502         arg_conv.is_owned = ptr_is_owned(arg);
41503         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41504         arg_conv.is_owned = false;
41505         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
41506         return ret_conv;
41507 }
41508
41509 uint64_t  __attribute__((export_name("TS_NodeId_clone"))) TS_NodeId_clone(uint64_t orig) {
41510         LDKNodeId orig_conv;
41511         orig_conv.inner = untag_ptr(orig);
41512         orig_conv.is_owned = ptr_is_owned(orig);
41513         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41514         orig_conv.is_owned = false;
41515         LDKNodeId ret_var = NodeId_clone(&orig_conv);
41516         uint64_t ret_ref = 0;
41517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41519         return ret_ref;
41520 }
41521
41522 uint64_t  __attribute__((export_name("TS_NodeId_from_pubkey"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
41523         LDKPublicKey pubkey_ref;
41524         CHECK(pubkey->arr_len == 33);
41525         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
41526         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
41527         uint64_t ret_ref = 0;
41528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41530         return ret_ref;
41531 }
41532
41533 int8_tArray  __attribute__((export_name("TS_NodeId_as_slice"))) TS_NodeId_as_slice(uint64_t this_arg) {
41534         LDKNodeId this_arg_conv;
41535         this_arg_conv.inner = untag_ptr(this_arg);
41536         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41538         this_arg_conv.is_owned = false;
41539         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
41540         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41541         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41542         return ret_arr;
41543 }
41544
41545 int64_t  __attribute__((export_name("TS_NodeId_hash"))) TS_NodeId_hash(uint64_t o) {
41546         LDKNodeId o_conv;
41547         o_conv.inner = untag_ptr(o);
41548         o_conv.is_owned = ptr_is_owned(o);
41549         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41550         o_conv.is_owned = false;
41551         int64_t ret_conv = NodeId_hash(&o_conv);
41552         return ret_conv;
41553 }
41554
41555 int8_tArray  __attribute__((export_name("TS_NodeId_write"))) TS_NodeId_write(uint64_t obj) {
41556         LDKNodeId obj_conv;
41557         obj_conv.inner = untag_ptr(obj);
41558         obj_conv.is_owned = ptr_is_owned(obj);
41559         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41560         obj_conv.is_owned = false;
41561         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
41562         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41563         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41564         CVec_u8Z_free(ret_var);
41565         return ret_arr;
41566 }
41567
41568 uint64_t  __attribute__((export_name("TS_NodeId_read"))) TS_NodeId_read(int8_tArray ser) {
41569         LDKu8slice ser_ref;
41570         ser_ref.datalen = ser->arr_len;
41571         ser_ref.data = ser->elems;
41572         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
41573         *ret_conv = NodeId_read(ser_ref);
41574         FREE(ser);
41575         return tag_ptr(ret_conv, true);
41576 }
41577
41578 void  __attribute__((export_name("TS_NetworkGraph_free"))) TS_NetworkGraph_free(uint64_t this_obj) {
41579         LDKNetworkGraph this_obj_conv;
41580         this_obj_conv.inner = untag_ptr(this_obj);
41581         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41583         NetworkGraph_free(this_obj_conv);
41584 }
41585
41586 void  __attribute__((export_name("TS_ReadOnlyNetworkGraph_free"))) TS_ReadOnlyNetworkGraph_free(uint64_t this_obj) {
41587         LDKReadOnlyNetworkGraph this_obj_conv;
41588         this_obj_conv.inner = untag_ptr(this_obj);
41589         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41591         ReadOnlyNetworkGraph_free(this_obj_conv);
41592 }
41593
41594 void  __attribute__((export_name("TS_NetworkUpdate_free"))) TS_NetworkUpdate_free(uint64_t this_ptr) {
41595         if (!ptr_is_owned(this_ptr)) return;
41596         void* this_ptr_ptr = untag_ptr(this_ptr);
41597         CHECK_ACCESS(this_ptr_ptr);
41598         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
41599         FREE(untag_ptr(this_ptr));
41600         NetworkUpdate_free(this_ptr_conv);
41601 }
41602
41603 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
41604         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
41605         *ret_copy = NetworkUpdate_clone(arg);
41606         uint64_t ret_ref = tag_ptr(ret_copy, true);
41607         return ret_ref;
41608 }
41609 int64_t  __attribute__((export_name("TS_NetworkUpdate_clone_ptr"))) TS_NetworkUpdate_clone_ptr(uint64_t arg) {
41610         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
41611         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
41612         return ret_conv;
41613 }
41614
41615 uint64_t  __attribute__((export_name("TS_NetworkUpdate_clone"))) TS_NetworkUpdate_clone(uint64_t orig) {
41616         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
41617         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
41618         *ret_copy = NetworkUpdate_clone(orig_conv);
41619         uint64_t ret_ref = tag_ptr(ret_copy, true);
41620         return ret_ref;
41621 }
41622
41623 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_update_message"))) TS_NetworkUpdate_channel_update_message(uint64_t msg) {
41624         LDKChannelUpdate msg_conv;
41625         msg_conv.inner = untag_ptr(msg);
41626         msg_conv.is_owned = ptr_is_owned(msg);
41627         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41628         msg_conv = ChannelUpdate_clone(&msg_conv);
41629         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
41630         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
41631         uint64_t ret_ref = tag_ptr(ret_copy, true);
41632         return ret_ref;
41633 }
41634
41635 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_failure"))) TS_NetworkUpdate_channel_failure(int64_t short_channel_id, jboolean is_permanent) {
41636         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
41637         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
41638         uint64_t ret_ref = tag_ptr(ret_copy, true);
41639         return ret_ref;
41640 }
41641
41642 uint64_t  __attribute__((export_name("TS_NetworkUpdate_node_failure"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
41643         LDKPublicKey node_id_ref;
41644         CHECK(node_id->arr_len == 33);
41645         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
41646         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
41647         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
41648         uint64_t ret_ref = tag_ptr(ret_copy, true);
41649         return ret_ref;
41650 }
41651
41652 jboolean  __attribute__((export_name("TS_NetworkUpdate_eq"))) TS_NetworkUpdate_eq(uint64_t a, uint64_t b) {
41653         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
41654         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
41655         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
41656         return ret_conv;
41657 }
41658
41659 int8_tArray  __attribute__((export_name("TS_NetworkUpdate_write"))) TS_NetworkUpdate_write(uint64_t obj) {
41660         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
41661         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
41662         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41663         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41664         CVec_u8Z_free(ret_var);
41665         return ret_arr;
41666 }
41667
41668 uint64_t  __attribute__((export_name("TS_NetworkUpdate_read"))) TS_NetworkUpdate_read(int8_tArray ser) {
41669         LDKu8slice ser_ref;
41670         ser_ref.datalen = ser->arr_len;
41671         ser_ref.data = ser->elems;
41672         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
41673         *ret_conv = NetworkUpdate_read(ser_ref);
41674         FREE(ser);
41675         return tag_ptr(ret_conv, true);
41676 }
41677
41678 void  __attribute__((export_name("TS_P2PGossipSync_free"))) TS_P2PGossipSync_free(uint64_t this_obj) {
41679         LDKP2PGossipSync this_obj_conv;
41680         this_obj_conv.inner = untag_ptr(this_obj);
41681         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41683         P2PGossipSync_free(this_obj_conv);
41684 }
41685
41686 uint64_t  __attribute__((export_name("TS_P2PGossipSync_new"))) TS_P2PGossipSync_new(uint64_t network_graph, uint64_t chain_access, uint64_t logger) {
41687         LDKNetworkGraph network_graph_conv;
41688         network_graph_conv.inner = untag_ptr(network_graph);
41689         network_graph_conv.is_owned = ptr_is_owned(network_graph);
41690         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
41691         network_graph_conv.is_owned = false;
41692         void* chain_access_ptr = untag_ptr(chain_access);
41693         CHECK_ACCESS(chain_access_ptr);
41694         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
41695         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
41696         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
41697                 // Manually implement clone for Java trait instances
41698                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
41699                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41700                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
41701                 }
41702         }
41703         void* logger_ptr = untag_ptr(logger);
41704         CHECK_ACCESS(logger_ptr);
41705         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41706         if (logger_conv.free == LDKLogger_JCalls_free) {
41707                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41708                 LDKLogger_JCalls_cloned(&logger_conv);
41709         }
41710         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, chain_access_conv, logger_conv);
41711         uint64_t ret_ref = 0;
41712         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41713         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41714         return ret_ref;
41715 }
41716
41717 void  __attribute__((export_name("TS_P2PGossipSync_add_chain_access"))) TS_P2PGossipSync_add_chain_access(uint64_t this_arg, uint64_t chain_access) {
41718         LDKP2PGossipSync this_arg_conv;
41719         this_arg_conv.inner = untag_ptr(this_arg);
41720         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41722         this_arg_conv.is_owned = false;
41723         void* chain_access_ptr = untag_ptr(chain_access);
41724         CHECK_ACCESS(chain_access_ptr);
41725         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
41726         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
41727         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
41728                 // Manually implement clone for Java trait instances
41729                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
41730                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41731                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
41732                 }
41733         }
41734         P2PGossipSync_add_chain_access(&this_arg_conv, chain_access_conv);
41735 }
41736
41737 void  __attribute__((export_name("TS_NetworkGraph_handle_network_update"))) TS_NetworkGraph_handle_network_update(uint64_t this_arg, uint64_t network_update) {
41738         LDKNetworkGraph this_arg_conv;
41739         this_arg_conv.inner = untag_ptr(this_arg);
41740         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41742         this_arg_conv.is_owned = false;
41743         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
41744         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
41745 }
41746
41747 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_RoutingMessageHandler"))) TS_P2PGossipSync_as_RoutingMessageHandler(uint64_t this_arg) {
41748         LDKP2PGossipSync this_arg_conv;
41749         this_arg_conv.inner = untag_ptr(this_arg);
41750         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41752         this_arg_conv.is_owned = false;
41753         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
41754         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
41755         return tag_ptr(ret_ret, true);
41756 }
41757
41758 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_MessageSendEventsProvider"))) TS_P2PGossipSync_as_MessageSendEventsProvider(uint64_t this_arg) {
41759         LDKP2PGossipSync this_arg_conv;
41760         this_arg_conv.inner = untag_ptr(this_arg);
41761         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41763         this_arg_conv.is_owned = false;
41764         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
41765         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
41766         return tag_ptr(ret_ret, true);
41767 }
41768
41769 void  __attribute__((export_name("TS_ChannelUpdateInfo_free"))) TS_ChannelUpdateInfo_free(uint64_t this_obj) {
41770         LDKChannelUpdateInfo this_obj_conv;
41771         this_obj_conv.inner = untag_ptr(this_obj);
41772         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41774         ChannelUpdateInfo_free(this_obj_conv);
41775 }
41776
41777 int32_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update"))) TS_ChannelUpdateInfo_get_last_update(uint64_t this_ptr) {
41778         LDKChannelUpdateInfo this_ptr_conv;
41779         this_ptr_conv.inner = untag_ptr(this_ptr);
41780         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41782         this_ptr_conv.is_owned = false;
41783         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
41784         return ret_conv;
41785 }
41786
41787 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update"))) TS_ChannelUpdateInfo_set_last_update(uint64_t this_ptr, int32_t val) {
41788         LDKChannelUpdateInfo this_ptr_conv;
41789         this_ptr_conv.inner = untag_ptr(this_ptr);
41790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41792         this_ptr_conv.is_owned = false;
41793         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
41794 }
41795
41796 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_get_enabled"))) TS_ChannelUpdateInfo_get_enabled(uint64_t this_ptr) {
41797         LDKChannelUpdateInfo this_ptr_conv;
41798         this_ptr_conv.inner = untag_ptr(this_ptr);
41799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41801         this_ptr_conv.is_owned = false;
41802         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
41803         return ret_conv;
41804 }
41805
41806 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_enabled"))) TS_ChannelUpdateInfo_set_enabled(uint64_t this_ptr, jboolean val) {
41807         LDKChannelUpdateInfo this_ptr_conv;
41808         this_ptr_conv.inner = untag_ptr(this_ptr);
41809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41811         this_ptr_conv.is_owned = false;
41812         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
41813 }
41814
41815 int16_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_cltv_expiry_delta"))) TS_ChannelUpdateInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
41816         LDKChannelUpdateInfo this_ptr_conv;
41817         this_ptr_conv.inner = untag_ptr(this_ptr);
41818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41820         this_ptr_conv.is_owned = false;
41821         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
41822         return ret_conv;
41823 }
41824
41825 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_cltv_expiry_delta"))) TS_ChannelUpdateInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
41826         LDKChannelUpdateInfo this_ptr_conv;
41827         this_ptr_conv.inner = untag_ptr(this_ptr);
41828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41830         this_ptr_conv.is_owned = false;
41831         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
41832 }
41833
41834 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_minimum_msat"))) TS_ChannelUpdateInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
41835         LDKChannelUpdateInfo this_ptr_conv;
41836         this_ptr_conv.inner = untag_ptr(this_ptr);
41837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41839         this_ptr_conv.is_owned = false;
41840         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
41841         return ret_conv;
41842 }
41843
41844 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_minimum_msat"))) TS_ChannelUpdateInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
41845         LDKChannelUpdateInfo this_ptr_conv;
41846         this_ptr_conv.inner = untag_ptr(this_ptr);
41847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41849         this_ptr_conv.is_owned = false;
41850         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
41851 }
41852
41853 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_maximum_msat"))) TS_ChannelUpdateInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
41854         LDKChannelUpdateInfo this_ptr_conv;
41855         this_ptr_conv.inner = untag_ptr(this_ptr);
41856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41858         this_ptr_conv.is_owned = false;
41859         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
41860         return ret_conv;
41861 }
41862
41863 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_maximum_msat"))) TS_ChannelUpdateInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
41864         LDKChannelUpdateInfo this_ptr_conv;
41865         this_ptr_conv.inner = untag_ptr(this_ptr);
41866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41868         this_ptr_conv.is_owned = false;
41869         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
41870 }
41871
41872 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_fees"))) TS_ChannelUpdateInfo_get_fees(uint64_t this_ptr) {
41873         LDKChannelUpdateInfo this_ptr_conv;
41874         this_ptr_conv.inner = untag_ptr(this_ptr);
41875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41877         this_ptr_conv.is_owned = false;
41878         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
41879         uint64_t ret_ref = 0;
41880         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41881         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41882         return ret_ref;
41883 }
41884
41885 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_fees"))) TS_ChannelUpdateInfo_set_fees(uint64_t this_ptr, uint64_t val) {
41886         LDKChannelUpdateInfo this_ptr_conv;
41887         this_ptr_conv.inner = untag_ptr(this_ptr);
41888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41890         this_ptr_conv.is_owned = false;
41891         LDKRoutingFees val_conv;
41892         val_conv.inner = untag_ptr(val);
41893         val_conv.is_owned = ptr_is_owned(val);
41894         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41895         val_conv = RoutingFees_clone(&val_conv);
41896         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
41897 }
41898
41899 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update_message"))) TS_ChannelUpdateInfo_get_last_update_message(uint64_t this_ptr) {
41900         LDKChannelUpdateInfo this_ptr_conv;
41901         this_ptr_conv.inner = untag_ptr(this_ptr);
41902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41904         this_ptr_conv.is_owned = false;
41905         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
41906         uint64_t ret_ref = 0;
41907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41909         return ret_ref;
41910 }
41911
41912 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update_message"))) TS_ChannelUpdateInfo_set_last_update_message(uint64_t this_ptr, uint64_t val) {
41913         LDKChannelUpdateInfo this_ptr_conv;
41914         this_ptr_conv.inner = untag_ptr(this_ptr);
41915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41917         this_ptr_conv.is_owned = false;
41918         LDKChannelUpdate val_conv;
41919         val_conv.inner = untag_ptr(val);
41920         val_conv.is_owned = ptr_is_owned(val);
41921         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41922         val_conv = ChannelUpdate_clone(&val_conv);
41923         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
41924 }
41925
41926 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) {
41927         LDKRoutingFees fees_arg_conv;
41928         fees_arg_conv.inner = untag_ptr(fees_arg);
41929         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
41930         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
41931         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
41932         LDKChannelUpdate last_update_message_arg_conv;
41933         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
41934         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
41935         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
41936         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
41937         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);
41938         uint64_t ret_ref = 0;
41939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41941         return ret_ref;
41942 }
41943
41944 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
41945         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
41946         uint64_t ret_ref = 0;
41947         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41948         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41949         return ret_ref;
41950 }
41951 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone_ptr"))) TS_ChannelUpdateInfo_clone_ptr(uint64_t arg) {
41952         LDKChannelUpdateInfo arg_conv;
41953         arg_conv.inner = untag_ptr(arg);
41954         arg_conv.is_owned = ptr_is_owned(arg);
41955         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41956         arg_conv.is_owned = false;
41957         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
41958         return ret_conv;
41959 }
41960
41961 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone"))) TS_ChannelUpdateInfo_clone(uint64_t orig) {
41962         LDKChannelUpdateInfo orig_conv;
41963         orig_conv.inner = untag_ptr(orig);
41964         orig_conv.is_owned = ptr_is_owned(orig);
41965         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41966         orig_conv.is_owned = false;
41967         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
41968         uint64_t ret_ref = 0;
41969         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41970         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41971         return ret_ref;
41972 }
41973
41974 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_eq"))) TS_ChannelUpdateInfo_eq(uint64_t a, uint64_t b) {
41975         LDKChannelUpdateInfo a_conv;
41976         a_conv.inner = untag_ptr(a);
41977         a_conv.is_owned = ptr_is_owned(a);
41978         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41979         a_conv.is_owned = false;
41980         LDKChannelUpdateInfo b_conv;
41981         b_conv.inner = untag_ptr(b);
41982         b_conv.is_owned = ptr_is_owned(b);
41983         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41984         b_conv.is_owned = false;
41985         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
41986         return ret_conv;
41987 }
41988
41989 int8_tArray  __attribute__((export_name("TS_ChannelUpdateInfo_write"))) TS_ChannelUpdateInfo_write(uint64_t obj) {
41990         LDKChannelUpdateInfo obj_conv;
41991         obj_conv.inner = untag_ptr(obj);
41992         obj_conv.is_owned = ptr_is_owned(obj);
41993         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41994         obj_conv.is_owned = false;
41995         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
41996         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41997         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41998         CVec_u8Z_free(ret_var);
41999         return ret_arr;
42000 }
42001
42002 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_read"))) TS_ChannelUpdateInfo_read(int8_tArray ser) {
42003         LDKu8slice ser_ref;
42004         ser_ref.datalen = ser->arr_len;
42005         ser_ref.data = ser->elems;
42006         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
42007         *ret_conv = ChannelUpdateInfo_read(ser_ref);
42008         FREE(ser);
42009         return tag_ptr(ret_conv, true);
42010 }
42011
42012 void  __attribute__((export_name("TS_ChannelInfo_free"))) TS_ChannelInfo_free(uint64_t this_obj) {
42013         LDKChannelInfo this_obj_conv;
42014         this_obj_conv.inner = untag_ptr(this_obj);
42015         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42017         ChannelInfo_free(this_obj_conv);
42018 }
42019
42020 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_features"))) TS_ChannelInfo_get_features(uint64_t this_ptr) {
42021         LDKChannelInfo this_ptr_conv;
42022         this_ptr_conv.inner = untag_ptr(this_ptr);
42023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42025         this_ptr_conv.is_owned = false;
42026         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
42027         uint64_t ret_ref = 0;
42028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42030         return ret_ref;
42031 }
42032
42033 void  __attribute__((export_name("TS_ChannelInfo_set_features"))) TS_ChannelInfo_set_features(uint64_t this_ptr, uint64_t val) {
42034         LDKChannelInfo this_ptr_conv;
42035         this_ptr_conv.inner = untag_ptr(this_ptr);
42036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42038         this_ptr_conv.is_owned = false;
42039         LDKChannelFeatures val_conv;
42040         val_conv.inner = untag_ptr(val);
42041         val_conv.is_owned = ptr_is_owned(val);
42042         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42043         val_conv = ChannelFeatures_clone(&val_conv);
42044         ChannelInfo_set_features(&this_ptr_conv, val_conv);
42045 }
42046
42047 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_one"))) TS_ChannelInfo_get_node_one(uint64_t this_ptr) {
42048         LDKChannelInfo this_ptr_conv;
42049         this_ptr_conv.inner = untag_ptr(this_ptr);
42050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42052         this_ptr_conv.is_owned = false;
42053         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
42054         uint64_t ret_ref = 0;
42055         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42056         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42057         return ret_ref;
42058 }
42059
42060 void  __attribute__((export_name("TS_ChannelInfo_set_node_one"))) TS_ChannelInfo_set_node_one(uint64_t this_ptr, uint64_t val) {
42061         LDKChannelInfo this_ptr_conv;
42062         this_ptr_conv.inner = untag_ptr(this_ptr);
42063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42065         this_ptr_conv.is_owned = false;
42066         LDKNodeId val_conv;
42067         val_conv.inner = untag_ptr(val);
42068         val_conv.is_owned = ptr_is_owned(val);
42069         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42070         val_conv = NodeId_clone(&val_conv);
42071         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
42072 }
42073
42074 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_one_to_two"))) TS_ChannelInfo_get_one_to_two(uint64_t this_ptr) {
42075         LDKChannelInfo this_ptr_conv;
42076         this_ptr_conv.inner = untag_ptr(this_ptr);
42077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42079         this_ptr_conv.is_owned = false;
42080         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
42081         uint64_t ret_ref = 0;
42082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42084         return ret_ref;
42085 }
42086
42087 void  __attribute__((export_name("TS_ChannelInfo_set_one_to_two"))) TS_ChannelInfo_set_one_to_two(uint64_t this_ptr, uint64_t val) {
42088         LDKChannelInfo this_ptr_conv;
42089         this_ptr_conv.inner = untag_ptr(this_ptr);
42090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42092         this_ptr_conv.is_owned = false;
42093         LDKChannelUpdateInfo val_conv;
42094         val_conv.inner = untag_ptr(val);
42095         val_conv.is_owned = ptr_is_owned(val);
42096         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42097         val_conv = ChannelUpdateInfo_clone(&val_conv);
42098         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
42099 }
42100
42101 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_two"))) TS_ChannelInfo_get_node_two(uint64_t this_ptr) {
42102         LDKChannelInfo this_ptr_conv;
42103         this_ptr_conv.inner = untag_ptr(this_ptr);
42104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42106         this_ptr_conv.is_owned = false;
42107         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
42108         uint64_t ret_ref = 0;
42109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42110         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42111         return ret_ref;
42112 }
42113
42114 void  __attribute__((export_name("TS_ChannelInfo_set_node_two"))) TS_ChannelInfo_set_node_two(uint64_t this_ptr, uint64_t val) {
42115         LDKChannelInfo this_ptr_conv;
42116         this_ptr_conv.inner = untag_ptr(this_ptr);
42117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42119         this_ptr_conv.is_owned = false;
42120         LDKNodeId val_conv;
42121         val_conv.inner = untag_ptr(val);
42122         val_conv.is_owned = ptr_is_owned(val);
42123         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42124         val_conv = NodeId_clone(&val_conv);
42125         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
42126 }
42127
42128 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_two_to_one"))) TS_ChannelInfo_get_two_to_one(uint64_t this_ptr) {
42129         LDKChannelInfo this_ptr_conv;
42130         this_ptr_conv.inner = untag_ptr(this_ptr);
42131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42133         this_ptr_conv.is_owned = false;
42134         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
42135         uint64_t ret_ref = 0;
42136         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42137         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42138         return ret_ref;
42139 }
42140
42141 void  __attribute__((export_name("TS_ChannelInfo_set_two_to_one"))) TS_ChannelInfo_set_two_to_one(uint64_t this_ptr, uint64_t val) {
42142         LDKChannelInfo this_ptr_conv;
42143         this_ptr_conv.inner = untag_ptr(this_ptr);
42144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42146         this_ptr_conv.is_owned = false;
42147         LDKChannelUpdateInfo val_conv;
42148         val_conv.inner = untag_ptr(val);
42149         val_conv.is_owned = ptr_is_owned(val);
42150         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42151         val_conv = ChannelUpdateInfo_clone(&val_conv);
42152         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
42153 }
42154
42155 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_capacity_sats"))) TS_ChannelInfo_get_capacity_sats(uint64_t this_ptr) {
42156         LDKChannelInfo this_ptr_conv;
42157         this_ptr_conv.inner = untag_ptr(this_ptr);
42158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42160         this_ptr_conv.is_owned = false;
42161         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42162         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
42163         uint64_t ret_ref = tag_ptr(ret_copy, true);
42164         return ret_ref;
42165 }
42166
42167 void  __attribute__((export_name("TS_ChannelInfo_set_capacity_sats"))) TS_ChannelInfo_set_capacity_sats(uint64_t this_ptr, uint64_t val) {
42168         LDKChannelInfo this_ptr_conv;
42169         this_ptr_conv.inner = untag_ptr(this_ptr);
42170         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42172         this_ptr_conv.is_owned = false;
42173         void* val_ptr = untag_ptr(val);
42174         CHECK_ACCESS(val_ptr);
42175         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42176         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
42177         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
42178 }
42179
42180 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_announcement_message"))) TS_ChannelInfo_get_announcement_message(uint64_t this_ptr) {
42181         LDKChannelInfo this_ptr_conv;
42182         this_ptr_conv.inner = untag_ptr(this_ptr);
42183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42185         this_ptr_conv.is_owned = false;
42186         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
42187         uint64_t ret_ref = 0;
42188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42190         return ret_ref;
42191 }
42192
42193 void  __attribute__((export_name("TS_ChannelInfo_set_announcement_message"))) TS_ChannelInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
42194         LDKChannelInfo this_ptr_conv;
42195         this_ptr_conv.inner = untag_ptr(this_ptr);
42196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42198         this_ptr_conv.is_owned = false;
42199         LDKChannelAnnouncement val_conv;
42200         val_conv.inner = untag_ptr(val);
42201         val_conv.is_owned = ptr_is_owned(val);
42202         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42203         val_conv = ChannelAnnouncement_clone(&val_conv);
42204         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
42205 }
42206
42207 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
42208         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
42209         uint64_t ret_ref = 0;
42210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42211         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42212         return ret_ref;
42213 }
42214 int64_t  __attribute__((export_name("TS_ChannelInfo_clone_ptr"))) TS_ChannelInfo_clone_ptr(uint64_t arg) {
42215         LDKChannelInfo arg_conv;
42216         arg_conv.inner = untag_ptr(arg);
42217         arg_conv.is_owned = ptr_is_owned(arg);
42218         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42219         arg_conv.is_owned = false;
42220         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
42221         return ret_conv;
42222 }
42223
42224 uint64_t  __attribute__((export_name("TS_ChannelInfo_clone"))) TS_ChannelInfo_clone(uint64_t orig) {
42225         LDKChannelInfo orig_conv;
42226         orig_conv.inner = untag_ptr(orig);
42227         orig_conv.is_owned = ptr_is_owned(orig);
42228         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42229         orig_conv.is_owned = false;
42230         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
42231         uint64_t ret_ref = 0;
42232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42234         return ret_ref;
42235 }
42236
42237 jboolean  __attribute__((export_name("TS_ChannelInfo_eq"))) TS_ChannelInfo_eq(uint64_t a, uint64_t b) {
42238         LDKChannelInfo a_conv;
42239         a_conv.inner = untag_ptr(a);
42240         a_conv.is_owned = ptr_is_owned(a);
42241         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42242         a_conv.is_owned = false;
42243         LDKChannelInfo b_conv;
42244         b_conv.inner = untag_ptr(b);
42245         b_conv.is_owned = ptr_is_owned(b);
42246         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42247         b_conv.is_owned = false;
42248         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
42249         return ret_conv;
42250 }
42251
42252 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_directional_info"))) TS_ChannelInfo_get_directional_info(uint64_t this_arg, int8_t channel_flags) {
42253         LDKChannelInfo this_arg_conv;
42254         this_arg_conv.inner = untag_ptr(this_arg);
42255         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42257         this_arg_conv.is_owned = false;
42258         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
42259         uint64_t ret_ref = 0;
42260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42262         return ret_ref;
42263 }
42264
42265 int8_tArray  __attribute__((export_name("TS_ChannelInfo_write"))) TS_ChannelInfo_write(uint64_t obj) {
42266         LDKChannelInfo obj_conv;
42267         obj_conv.inner = untag_ptr(obj);
42268         obj_conv.is_owned = ptr_is_owned(obj);
42269         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42270         obj_conv.is_owned = false;
42271         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
42272         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42273         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42274         CVec_u8Z_free(ret_var);
42275         return ret_arr;
42276 }
42277
42278 uint64_t  __attribute__((export_name("TS_ChannelInfo_read"))) TS_ChannelInfo_read(int8_tArray ser) {
42279         LDKu8slice ser_ref;
42280         ser_ref.datalen = ser->arr_len;
42281         ser_ref.data = ser->elems;
42282         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
42283         *ret_conv = ChannelInfo_read(ser_ref);
42284         FREE(ser);
42285         return tag_ptr(ret_conv, true);
42286 }
42287
42288 void  __attribute__((export_name("TS_DirectedChannelInfo_free"))) TS_DirectedChannelInfo_free(uint64_t this_obj) {
42289         LDKDirectedChannelInfo this_obj_conv;
42290         this_obj_conv.inner = untag_ptr(this_obj);
42291         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42293         DirectedChannelInfo_free(this_obj_conv);
42294 }
42295
42296 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
42297         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
42298         uint64_t ret_ref = 0;
42299         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42300         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42301         return ret_ref;
42302 }
42303 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone_ptr"))) TS_DirectedChannelInfo_clone_ptr(uint64_t arg) {
42304         LDKDirectedChannelInfo arg_conv;
42305         arg_conv.inner = untag_ptr(arg);
42306         arg_conv.is_owned = ptr_is_owned(arg);
42307         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42308         arg_conv.is_owned = false;
42309         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
42310         return ret_conv;
42311 }
42312
42313 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone"))) TS_DirectedChannelInfo_clone(uint64_t orig) {
42314         LDKDirectedChannelInfo orig_conv;
42315         orig_conv.inner = untag_ptr(orig);
42316         orig_conv.is_owned = ptr_is_owned(orig);
42317         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42318         orig_conv.is_owned = false;
42319         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
42320         uint64_t ret_ref = 0;
42321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42323         return ret_ref;
42324 }
42325
42326 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_channel"))) TS_DirectedChannelInfo_channel(uint64_t this_arg) {
42327         LDKDirectedChannelInfo this_arg_conv;
42328         this_arg_conv.inner = untag_ptr(this_arg);
42329         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42331         this_arg_conv.is_owned = false;
42332         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
42333         uint64_t ret_ref = 0;
42334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42336         return ret_ref;
42337 }
42338
42339 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_htlc_maximum_msat"))) TS_DirectedChannelInfo_htlc_maximum_msat(uint64_t this_arg) {
42340         LDKDirectedChannelInfo this_arg_conv;
42341         this_arg_conv.inner = untag_ptr(this_arg);
42342         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42344         this_arg_conv.is_owned = false;
42345         int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
42346         return ret_conv;
42347 }
42348
42349 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_effective_capacity"))) TS_DirectedChannelInfo_effective_capacity(uint64_t this_arg) {
42350         LDKDirectedChannelInfo this_arg_conv;
42351         this_arg_conv.inner = untag_ptr(this_arg);
42352         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42354         this_arg_conv.is_owned = false;
42355         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42356         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
42357         uint64_t ret_ref = tag_ptr(ret_copy, true);
42358         return ret_ref;
42359 }
42360
42361 void  __attribute__((export_name("TS_EffectiveCapacity_free"))) TS_EffectiveCapacity_free(uint64_t this_ptr) {
42362         if (!ptr_is_owned(this_ptr)) return;
42363         void* this_ptr_ptr = untag_ptr(this_ptr);
42364         CHECK_ACCESS(this_ptr_ptr);
42365         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
42366         FREE(untag_ptr(this_ptr));
42367         EffectiveCapacity_free(this_ptr_conv);
42368 }
42369
42370 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
42371         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42372         *ret_copy = EffectiveCapacity_clone(arg);
42373         uint64_t ret_ref = tag_ptr(ret_copy, true);
42374         return ret_ref;
42375 }
42376 int64_t  __attribute__((export_name("TS_EffectiveCapacity_clone_ptr"))) TS_EffectiveCapacity_clone_ptr(uint64_t arg) {
42377         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
42378         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
42379         return ret_conv;
42380 }
42381
42382 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_clone"))) TS_EffectiveCapacity_clone(uint64_t orig) {
42383         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
42384         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42385         *ret_copy = EffectiveCapacity_clone(orig_conv);
42386         uint64_t ret_ref = tag_ptr(ret_copy, true);
42387         return ret_ref;
42388 }
42389
42390 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_exact_liquidity"))) TS_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
42391         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42392         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
42393         uint64_t ret_ref = tag_ptr(ret_copy, true);
42394         return ret_ref;
42395 }
42396
42397 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_maximum_htlc"))) TS_EffectiveCapacity_maximum_htlc(int64_t amount_msat) {
42398         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42399         *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat);
42400         uint64_t ret_ref = tag_ptr(ret_copy, true);
42401         return ret_ref;
42402 }
42403
42404 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_total"))) TS_EffectiveCapacity_total(int64_t capacity_msat, int64_t htlc_maximum_msat) {
42405         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42406         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
42407         uint64_t ret_ref = tag_ptr(ret_copy, true);
42408         return ret_ref;
42409 }
42410
42411 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_infinite"))) TS_EffectiveCapacity_infinite() {
42412         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42413         *ret_copy = EffectiveCapacity_infinite();
42414         uint64_t ret_ref = tag_ptr(ret_copy, true);
42415         return ret_ref;
42416 }
42417
42418 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_unknown"))) TS_EffectiveCapacity_unknown() {
42419         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42420         *ret_copy = EffectiveCapacity_unknown();
42421         uint64_t ret_ref = tag_ptr(ret_copy, true);
42422         return ret_ref;
42423 }
42424
42425 int64_t  __attribute__((export_name("TS_EffectiveCapacity_as_msat"))) TS_EffectiveCapacity_as_msat(uint64_t this_arg) {
42426         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
42427         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
42428         return ret_conv;
42429 }
42430
42431 void  __attribute__((export_name("TS_RoutingFees_free"))) TS_RoutingFees_free(uint64_t this_obj) {
42432         LDKRoutingFees this_obj_conv;
42433         this_obj_conv.inner = untag_ptr(this_obj);
42434         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42436         RoutingFees_free(this_obj_conv);
42437 }
42438
42439 int32_t  __attribute__((export_name("TS_RoutingFees_get_base_msat"))) TS_RoutingFees_get_base_msat(uint64_t this_ptr) {
42440         LDKRoutingFees this_ptr_conv;
42441         this_ptr_conv.inner = untag_ptr(this_ptr);
42442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42444         this_ptr_conv.is_owned = false;
42445         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
42446         return ret_conv;
42447 }
42448
42449 void  __attribute__((export_name("TS_RoutingFees_set_base_msat"))) TS_RoutingFees_set_base_msat(uint64_t this_ptr, int32_t val) {
42450         LDKRoutingFees this_ptr_conv;
42451         this_ptr_conv.inner = untag_ptr(this_ptr);
42452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42454         this_ptr_conv.is_owned = false;
42455         RoutingFees_set_base_msat(&this_ptr_conv, val);
42456 }
42457
42458 int32_t  __attribute__((export_name("TS_RoutingFees_get_proportional_millionths"))) TS_RoutingFees_get_proportional_millionths(uint64_t this_ptr) {
42459         LDKRoutingFees this_ptr_conv;
42460         this_ptr_conv.inner = untag_ptr(this_ptr);
42461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42463         this_ptr_conv.is_owned = false;
42464         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
42465         return ret_conv;
42466 }
42467
42468 void  __attribute__((export_name("TS_RoutingFees_set_proportional_millionths"))) TS_RoutingFees_set_proportional_millionths(uint64_t this_ptr, int32_t val) {
42469         LDKRoutingFees this_ptr_conv;
42470         this_ptr_conv.inner = untag_ptr(this_ptr);
42471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42473         this_ptr_conv.is_owned = false;
42474         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
42475 }
42476
42477 uint64_t  __attribute__((export_name("TS_RoutingFees_new"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
42478         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
42479         uint64_t ret_ref = 0;
42480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42482         return ret_ref;
42483 }
42484
42485 jboolean  __attribute__((export_name("TS_RoutingFees_eq"))) TS_RoutingFees_eq(uint64_t a, uint64_t b) {
42486         LDKRoutingFees a_conv;
42487         a_conv.inner = untag_ptr(a);
42488         a_conv.is_owned = ptr_is_owned(a);
42489         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42490         a_conv.is_owned = false;
42491         LDKRoutingFees b_conv;
42492         b_conv.inner = untag_ptr(b);
42493         b_conv.is_owned = ptr_is_owned(b);
42494         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42495         b_conv.is_owned = false;
42496         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
42497         return ret_conv;
42498 }
42499
42500 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
42501         LDKRoutingFees ret_var = RoutingFees_clone(arg);
42502         uint64_t ret_ref = 0;
42503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42505         return ret_ref;
42506 }
42507 int64_t  __attribute__((export_name("TS_RoutingFees_clone_ptr"))) TS_RoutingFees_clone_ptr(uint64_t arg) {
42508         LDKRoutingFees arg_conv;
42509         arg_conv.inner = untag_ptr(arg);
42510         arg_conv.is_owned = ptr_is_owned(arg);
42511         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42512         arg_conv.is_owned = false;
42513         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
42514         return ret_conv;
42515 }
42516
42517 uint64_t  __attribute__((export_name("TS_RoutingFees_clone"))) TS_RoutingFees_clone(uint64_t orig) {
42518         LDKRoutingFees orig_conv;
42519         orig_conv.inner = untag_ptr(orig);
42520         orig_conv.is_owned = ptr_is_owned(orig);
42521         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42522         orig_conv.is_owned = false;
42523         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
42524         uint64_t ret_ref = 0;
42525         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42526         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42527         return ret_ref;
42528 }
42529
42530 int64_t  __attribute__((export_name("TS_RoutingFees_hash"))) TS_RoutingFees_hash(uint64_t o) {
42531         LDKRoutingFees o_conv;
42532         o_conv.inner = untag_ptr(o);
42533         o_conv.is_owned = ptr_is_owned(o);
42534         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42535         o_conv.is_owned = false;
42536         int64_t ret_conv = RoutingFees_hash(&o_conv);
42537         return ret_conv;
42538 }
42539
42540 int8_tArray  __attribute__((export_name("TS_RoutingFees_write"))) TS_RoutingFees_write(uint64_t obj) {
42541         LDKRoutingFees obj_conv;
42542         obj_conv.inner = untag_ptr(obj);
42543         obj_conv.is_owned = ptr_is_owned(obj);
42544         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42545         obj_conv.is_owned = false;
42546         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
42547         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42548         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42549         CVec_u8Z_free(ret_var);
42550         return ret_arr;
42551 }
42552
42553 uint64_t  __attribute__((export_name("TS_RoutingFees_read"))) TS_RoutingFees_read(int8_tArray ser) {
42554         LDKu8slice ser_ref;
42555         ser_ref.datalen = ser->arr_len;
42556         ser_ref.data = ser->elems;
42557         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
42558         *ret_conv = RoutingFees_read(ser_ref);
42559         FREE(ser);
42560         return tag_ptr(ret_conv, true);
42561 }
42562
42563 void  __attribute__((export_name("TS_NodeAnnouncementInfo_free"))) TS_NodeAnnouncementInfo_free(uint64_t this_obj) {
42564         LDKNodeAnnouncementInfo this_obj_conv;
42565         this_obj_conv.inner = untag_ptr(this_obj);
42566         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42568         NodeAnnouncementInfo_free(this_obj_conv);
42569 }
42570
42571 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_features"))) TS_NodeAnnouncementInfo_get_features(uint64_t this_ptr) {
42572         LDKNodeAnnouncementInfo this_ptr_conv;
42573         this_ptr_conv.inner = untag_ptr(this_ptr);
42574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42576         this_ptr_conv.is_owned = false;
42577         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
42578         uint64_t ret_ref = 0;
42579         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42580         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42581         return ret_ref;
42582 }
42583
42584 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_features"))) TS_NodeAnnouncementInfo_set_features(uint64_t this_ptr, uint64_t val) {
42585         LDKNodeAnnouncementInfo this_ptr_conv;
42586         this_ptr_conv.inner = untag_ptr(this_ptr);
42587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42589         this_ptr_conv.is_owned = false;
42590         LDKNodeFeatures val_conv;
42591         val_conv.inner = untag_ptr(val);
42592         val_conv.is_owned = ptr_is_owned(val);
42593         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42594         val_conv = NodeFeatures_clone(&val_conv);
42595         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
42596 }
42597
42598 int32_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_last_update"))) TS_NodeAnnouncementInfo_get_last_update(uint64_t this_ptr) {
42599         LDKNodeAnnouncementInfo this_ptr_conv;
42600         this_ptr_conv.inner = untag_ptr(this_ptr);
42601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42603         this_ptr_conv.is_owned = false;
42604         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
42605         return ret_conv;
42606 }
42607
42608 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_last_update"))) TS_NodeAnnouncementInfo_set_last_update(uint64_t this_ptr, int32_t val) {
42609         LDKNodeAnnouncementInfo this_ptr_conv;
42610         this_ptr_conv.inner = untag_ptr(this_ptr);
42611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42613         this_ptr_conv.is_owned = false;
42614         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
42615 }
42616
42617 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_rgb"))) TS_NodeAnnouncementInfo_get_rgb(uint64_t this_ptr) {
42618         LDKNodeAnnouncementInfo this_ptr_conv;
42619         this_ptr_conv.inner = untag_ptr(this_ptr);
42620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42622         this_ptr_conv.is_owned = false;
42623         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
42624         memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
42625         return ret_arr;
42626 }
42627
42628 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_rgb"))) TS_NodeAnnouncementInfo_set_rgb(uint64_t this_ptr, int8_tArray val) {
42629         LDKNodeAnnouncementInfo this_ptr_conv;
42630         this_ptr_conv.inner = untag_ptr(this_ptr);
42631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42633         this_ptr_conv.is_owned = false;
42634         LDKThreeBytes val_ref;
42635         CHECK(val->arr_len == 3);
42636         memcpy(val_ref.data, val->elems, 3); FREE(val);
42637         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
42638 }
42639
42640 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_alias"))) TS_NodeAnnouncementInfo_get_alias(uint64_t this_ptr) {
42641         LDKNodeAnnouncementInfo this_ptr_conv;
42642         this_ptr_conv.inner = untag_ptr(this_ptr);
42643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42645         this_ptr_conv.is_owned = false;
42646         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
42647         uint64_t ret_ref = 0;
42648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42650         return ret_ref;
42651 }
42652
42653 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_alias"))) TS_NodeAnnouncementInfo_set_alias(uint64_t this_ptr, uint64_t val) {
42654         LDKNodeAnnouncementInfo this_ptr_conv;
42655         this_ptr_conv.inner = untag_ptr(this_ptr);
42656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42658         this_ptr_conv.is_owned = false;
42659         LDKNodeAlias val_conv;
42660         val_conv.inner = untag_ptr(val);
42661         val_conv.is_owned = ptr_is_owned(val);
42662         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42663         val_conv = NodeAlias_clone(&val_conv);
42664         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
42665 }
42666
42667 uint64_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_addresses"))) TS_NodeAnnouncementInfo_get_addresses(uint64_t this_ptr) {
42668         LDKNodeAnnouncementInfo this_ptr_conv;
42669         this_ptr_conv.inner = untag_ptr(this_ptr);
42670         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42672         this_ptr_conv.is_owned = false;
42673         LDKCVec_NetAddressZ ret_var = NodeAnnouncementInfo_get_addresses(&this_ptr_conv);
42674         uint64_tArray ret_arr = NULL;
42675         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
42676         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
42677         for (size_t m = 0; m < ret_var.datalen; m++) {
42678                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
42679                 *ret_conv_12_copy = ret_var.data[m];
42680                 uint64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
42681                 ret_arr_ptr[m] = ret_conv_12_ref;
42682         }
42683         
42684         FREE(ret_var.data);
42685         return ret_arr;
42686 }
42687
42688 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_addresses"))) TS_NodeAnnouncementInfo_set_addresses(uint64_t this_ptr, uint64_tArray val) {
42689         LDKNodeAnnouncementInfo this_ptr_conv;
42690         this_ptr_conv.inner = untag_ptr(this_ptr);
42691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42693         this_ptr_conv.is_owned = false;
42694         LDKCVec_NetAddressZ val_constr;
42695         val_constr.datalen = val->arr_len;
42696         if (val_constr.datalen > 0)
42697                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
42698         else
42699                 val_constr.data = NULL;
42700         uint64_t* val_vals = val->elems;
42701         for (size_t m = 0; m < val_constr.datalen; m++) {
42702                 uint64_t val_conv_12 = val_vals[m];
42703                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
42704                 CHECK_ACCESS(val_conv_12_ptr);
42705                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
42706                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
42707                 val_constr.data[m] = val_conv_12_conv;
42708         }
42709         FREE(val);
42710         NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
42711 }
42712
42713 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_announcement_message"))) TS_NodeAnnouncementInfo_get_announcement_message(uint64_t this_ptr) {
42714         LDKNodeAnnouncementInfo this_ptr_conv;
42715         this_ptr_conv.inner = untag_ptr(this_ptr);
42716         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42718         this_ptr_conv.is_owned = false;
42719         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
42720         uint64_t ret_ref = 0;
42721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42723         return ret_ref;
42724 }
42725
42726 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_announcement_message"))) TS_NodeAnnouncementInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
42727         LDKNodeAnnouncementInfo this_ptr_conv;
42728         this_ptr_conv.inner = untag_ptr(this_ptr);
42729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42731         this_ptr_conv.is_owned = false;
42732         LDKNodeAnnouncement val_conv;
42733         val_conv.inner = untag_ptr(val);
42734         val_conv.is_owned = ptr_is_owned(val);
42735         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42736         val_conv = NodeAnnouncement_clone(&val_conv);
42737         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
42738 }
42739
42740 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) {
42741         LDKNodeFeatures features_arg_conv;
42742         features_arg_conv.inner = untag_ptr(features_arg);
42743         features_arg_conv.is_owned = ptr_is_owned(features_arg);
42744         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
42745         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
42746         LDKThreeBytes rgb_arg_ref;
42747         CHECK(rgb_arg->arr_len == 3);
42748         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
42749         LDKNodeAlias alias_arg_conv;
42750         alias_arg_conv.inner = untag_ptr(alias_arg);
42751         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
42752         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
42753         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
42754         LDKCVec_NetAddressZ addresses_arg_constr;
42755         addresses_arg_constr.datalen = addresses_arg->arr_len;
42756         if (addresses_arg_constr.datalen > 0)
42757                 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
42758         else
42759                 addresses_arg_constr.data = NULL;
42760         uint64_t* addresses_arg_vals = addresses_arg->elems;
42761         for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
42762                 uint64_t addresses_arg_conv_12 = addresses_arg_vals[m];
42763                 void* addresses_arg_conv_12_ptr = untag_ptr(addresses_arg_conv_12);
42764                 CHECK_ACCESS(addresses_arg_conv_12_ptr);
42765                 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
42766                 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
42767         }
42768         FREE(addresses_arg);
42769         LDKNodeAnnouncement announcement_message_arg_conv;
42770         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
42771         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
42772         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
42773         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
42774         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, addresses_arg_constr, announcement_message_arg_conv);
42775         uint64_t ret_ref = 0;
42776         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42777         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42778         return ret_ref;
42779 }
42780
42781 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
42782         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
42783         uint64_t ret_ref = 0;
42784         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42785         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42786         return ret_ref;
42787 }
42788 int64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone_ptr"))) TS_NodeAnnouncementInfo_clone_ptr(uint64_t arg) {
42789         LDKNodeAnnouncementInfo arg_conv;
42790         arg_conv.inner = untag_ptr(arg);
42791         arg_conv.is_owned = ptr_is_owned(arg);
42792         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42793         arg_conv.is_owned = false;
42794         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
42795         return ret_conv;
42796 }
42797
42798 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone"))) TS_NodeAnnouncementInfo_clone(uint64_t orig) {
42799         LDKNodeAnnouncementInfo orig_conv;
42800         orig_conv.inner = untag_ptr(orig);
42801         orig_conv.is_owned = ptr_is_owned(orig);
42802         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42803         orig_conv.is_owned = false;
42804         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
42805         uint64_t ret_ref = 0;
42806         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42807         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42808         return ret_ref;
42809 }
42810
42811 jboolean  __attribute__((export_name("TS_NodeAnnouncementInfo_eq"))) TS_NodeAnnouncementInfo_eq(uint64_t a, uint64_t b) {
42812         LDKNodeAnnouncementInfo a_conv;
42813         a_conv.inner = untag_ptr(a);
42814         a_conv.is_owned = ptr_is_owned(a);
42815         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42816         a_conv.is_owned = false;
42817         LDKNodeAnnouncementInfo b_conv;
42818         b_conv.inner = untag_ptr(b);
42819         b_conv.is_owned = ptr_is_owned(b);
42820         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42821         b_conv.is_owned = false;
42822         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
42823         return ret_conv;
42824 }
42825
42826 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_write"))) TS_NodeAnnouncementInfo_write(uint64_t obj) {
42827         LDKNodeAnnouncementInfo obj_conv;
42828         obj_conv.inner = untag_ptr(obj);
42829         obj_conv.is_owned = ptr_is_owned(obj);
42830         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42831         obj_conv.is_owned = false;
42832         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
42833         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42834         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42835         CVec_u8Z_free(ret_var);
42836         return ret_arr;
42837 }
42838
42839 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_read"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
42840         LDKu8slice ser_ref;
42841         ser_ref.datalen = ser->arr_len;
42842         ser_ref.data = ser->elems;
42843         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
42844         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
42845         FREE(ser);
42846         return tag_ptr(ret_conv, true);
42847 }
42848
42849 void  __attribute__((export_name("TS_NodeAlias_free"))) TS_NodeAlias_free(uint64_t this_obj) {
42850         LDKNodeAlias this_obj_conv;
42851         this_obj_conv.inner = untag_ptr(this_obj);
42852         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42854         NodeAlias_free(this_obj_conv);
42855 }
42856
42857 int8_tArray  __attribute__((export_name("TS_NodeAlias_get_a"))) TS_NodeAlias_get_a(uint64_t this_ptr) {
42858         LDKNodeAlias this_ptr_conv;
42859         this_ptr_conv.inner = untag_ptr(this_ptr);
42860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42862         this_ptr_conv.is_owned = false;
42863         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42864         memcpy(ret_arr->elems, *NodeAlias_get_a(&this_ptr_conv), 32);
42865         return ret_arr;
42866 }
42867
42868 void  __attribute__((export_name("TS_NodeAlias_set_a"))) TS_NodeAlias_set_a(uint64_t this_ptr, int8_tArray val) {
42869         LDKNodeAlias this_ptr_conv;
42870         this_ptr_conv.inner = untag_ptr(this_ptr);
42871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42873         this_ptr_conv.is_owned = false;
42874         LDKThirtyTwoBytes val_ref;
42875         CHECK(val->arr_len == 32);
42876         memcpy(val_ref.data, val->elems, 32); FREE(val);
42877         NodeAlias_set_a(&this_ptr_conv, val_ref);
42878 }
42879
42880 uint64_t  __attribute__((export_name("TS_NodeAlias_new"))) TS_NodeAlias_new(int8_tArray a_arg) {
42881         LDKThirtyTwoBytes a_arg_ref;
42882         CHECK(a_arg->arr_len == 32);
42883         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
42884         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
42885         uint64_t ret_ref = 0;
42886         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42887         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42888         return ret_ref;
42889 }
42890
42891 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
42892         LDKNodeAlias ret_var = NodeAlias_clone(arg);
42893         uint64_t ret_ref = 0;
42894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42896         return ret_ref;
42897 }
42898 int64_t  __attribute__((export_name("TS_NodeAlias_clone_ptr"))) TS_NodeAlias_clone_ptr(uint64_t arg) {
42899         LDKNodeAlias arg_conv;
42900         arg_conv.inner = untag_ptr(arg);
42901         arg_conv.is_owned = ptr_is_owned(arg);
42902         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42903         arg_conv.is_owned = false;
42904         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
42905         return ret_conv;
42906 }
42907
42908 uint64_t  __attribute__((export_name("TS_NodeAlias_clone"))) TS_NodeAlias_clone(uint64_t orig) {
42909         LDKNodeAlias orig_conv;
42910         orig_conv.inner = untag_ptr(orig);
42911         orig_conv.is_owned = ptr_is_owned(orig);
42912         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42913         orig_conv.is_owned = false;
42914         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
42915         uint64_t ret_ref = 0;
42916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42918         return ret_ref;
42919 }
42920
42921 jboolean  __attribute__((export_name("TS_NodeAlias_eq"))) TS_NodeAlias_eq(uint64_t a, uint64_t b) {
42922         LDKNodeAlias a_conv;
42923         a_conv.inner = untag_ptr(a);
42924         a_conv.is_owned = ptr_is_owned(a);
42925         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42926         a_conv.is_owned = false;
42927         LDKNodeAlias b_conv;
42928         b_conv.inner = untag_ptr(b);
42929         b_conv.is_owned = ptr_is_owned(b);
42930         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42931         b_conv.is_owned = false;
42932         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
42933         return ret_conv;
42934 }
42935
42936 int8_tArray  __attribute__((export_name("TS_NodeAlias_write"))) TS_NodeAlias_write(uint64_t obj) {
42937         LDKNodeAlias obj_conv;
42938         obj_conv.inner = untag_ptr(obj);
42939         obj_conv.is_owned = ptr_is_owned(obj);
42940         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42941         obj_conv.is_owned = false;
42942         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
42943         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42944         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42945         CVec_u8Z_free(ret_var);
42946         return ret_arr;
42947 }
42948
42949 uint64_t  __attribute__((export_name("TS_NodeAlias_read"))) TS_NodeAlias_read(int8_tArray ser) {
42950         LDKu8slice ser_ref;
42951         ser_ref.datalen = ser->arr_len;
42952         ser_ref.data = ser->elems;
42953         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
42954         *ret_conv = NodeAlias_read(ser_ref);
42955         FREE(ser);
42956         return tag_ptr(ret_conv, true);
42957 }
42958
42959 void  __attribute__((export_name("TS_NodeInfo_free"))) TS_NodeInfo_free(uint64_t this_obj) {
42960         LDKNodeInfo this_obj_conv;
42961         this_obj_conv.inner = untag_ptr(this_obj);
42962         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42964         NodeInfo_free(this_obj_conv);
42965 }
42966
42967 int64_tArray  __attribute__((export_name("TS_NodeInfo_get_channels"))) TS_NodeInfo_get_channels(uint64_t this_ptr) {
42968         LDKNodeInfo this_ptr_conv;
42969         this_ptr_conv.inner = untag_ptr(this_ptr);
42970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42972         this_ptr_conv.is_owned = false;
42973         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
42974         int64_tArray ret_arr = NULL;
42975         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
42976         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
42977         for (size_t i = 0; i < ret_var.datalen; i++) {
42978                 int64_t ret_conv_8_conv = ret_var.data[i];
42979                 ret_arr_ptr[i] = ret_conv_8_conv;
42980         }
42981         
42982         FREE(ret_var.data);
42983         return ret_arr;
42984 }
42985
42986 void  __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_channels(uint64_t this_ptr, int64_tArray val) {
42987         LDKNodeInfo this_ptr_conv;
42988         this_ptr_conv.inner = untag_ptr(this_ptr);
42989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42991         this_ptr_conv.is_owned = false;
42992         LDKCVec_u64Z val_constr;
42993         val_constr.datalen = val->arr_len;
42994         if (val_constr.datalen > 0)
42995                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
42996         else
42997                 val_constr.data = NULL;
42998         int64_t* val_vals = val->elems;
42999         for (size_t i = 0; i < val_constr.datalen; i++) {
43000                 int64_t val_conv_8 = val_vals[i];
43001                 val_constr.data[i] = val_conv_8;
43002         }
43003         FREE(val);
43004         NodeInfo_set_channels(&this_ptr_conv, val_constr);
43005 }
43006
43007 uint64_t  __attribute__((export_name("TS_NodeInfo_get_lowest_inbound_channel_fees"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint64_t this_ptr) {
43008         LDKNodeInfo this_ptr_conv;
43009         this_ptr_conv.inner = untag_ptr(this_ptr);
43010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43012         this_ptr_conv.is_owned = false;
43013         LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
43014         uint64_t ret_ref = 0;
43015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43017         return ret_ref;
43018 }
43019
43020 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) {
43021         LDKNodeInfo this_ptr_conv;
43022         this_ptr_conv.inner = untag_ptr(this_ptr);
43023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43025         this_ptr_conv.is_owned = false;
43026         LDKRoutingFees val_conv;
43027         val_conv.inner = untag_ptr(val);
43028         val_conv.is_owned = ptr_is_owned(val);
43029         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43030         val_conv = RoutingFees_clone(&val_conv);
43031         NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
43032 }
43033
43034 uint64_t  __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint64_t this_ptr) {
43035         LDKNodeInfo this_ptr_conv;
43036         this_ptr_conv.inner = untag_ptr(this_ptr);
43037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43039         this_ptr_conv.is_owned = false;
43040         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
43041         uint64_t ret_ref = 0;
43042         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43043         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43044         return ret_ref;
43045 }
43046
43047 void  __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeInfo_set_announcement_info(uint64_t this_ptr, uint64_t val) {
43048         LDKNodeInfo this_ptr_conv;
43049         this_ptr_conv.inner = untag_ptr(this_ptr);
43050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43052         this_ptr_conv.is_owned = false;
43053         LDKNodeAnnouncementInfo val_conv;
43054         val_conv.inner = untag_ptr(val);
43055         val_conv.is_owned = ptr_is_owned(val);
43056         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43057         val_conv = NodeAnnouncementInfo_clone(&val_conv);
43058         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
43059 }
43060
43061 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) {
43062         LDKCVec_u64Z channels_arg_constr;
43063         channels_arg_constr.datalen = channels_arg->arr_len;
43064         if (channels_arg_constr.datalen > 0)
43065                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
43066         else
43067                 channels_arg_constr.data = NULL;
43068         int64_t* channels_arg_vals = channels_arg->elems;
43069         for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
43070                 int64_t channels_arg_conv_8 = channels_arg_vals[i];
43071                 channels_arg_constr.data[i] = channels_arg_conv_8;
43072         }
43073         FREE(channels_arg);
43074         LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
43075         lowest_inbound_channel_fees_arg_conv.inner = untag_ptr(lowest_inbound_channel_fees_arg);
43076         lowest_inbound_channel_fees_arg_conv.is_owned = ptr_is_owned(lowest_inbound_channel_fees_arg);
43077         CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
43078         lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
43079         LDKNodeAnnouncementInfo announcement_info_arg_conv;
43080         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
43081         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
43082         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
43083         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
43084         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
43085         uint64_t ret_ref = 0;
43086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43088         return ret_ref;
43089 }
43090
43091 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
43092         LDKNodeInfo ret_var = NodeInfo_clone(arg);
43093         uint64_t ret_ref = 0;
43094         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43095         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43096         return ret_ref;
43097 }
43098 int64_t  __attribute__((export_name("TS_NodeInfo_clone_ptr"))) TS_NodeInfo_clone_ptr(uint64_t arg) {
43099         LDKNodeInfo arg_conv;
43100         arg_conv.inner = untag_ptr(arg);
43101         arg_conv.is_owned = ptr_is_owned(arg);
43102         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43103         arg_conv.is_owned = false;
43104         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
43105         return ret_conv;
43106 }
43107
43108 uint64_t  __attribute__((export_name("TS_NodeInfo_clone"))) TS_NodeInfo_clone(uint64_t orig) {
43109         LDKNodeInfo orig_conv;
43110         orig_conv.inner = untag_ptr(orig);
43111         orig_conv.is_owned = ptr_is_owned(orig);
43112         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43113         orig_conv.is_owned = false;
43114         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
43115         uint64_t ret_ref = 0;
43116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43118         return ret_ref;
43119 }
43120
43121 jboolean  __attribute__((export_name("TS_NodeInfo_eq"))) TS_NodeInfo_eq(uint64_t a, uint64_t b) {
43122         LDKNodeInfo a_conv;
43123         a_conv.inner = untag_ptr(a);
43124         a_conv.is_owned = ptr_is_owned(a);
43125         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43126         a_conv.is_owned = false;
43127         LDKNodeInfo b_conv;
43128         b_conv.inner = untag_ptr(b);
43129         b_conv.is_owned = ptr_is_owned(b);
43130         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43131         b_conv.is_owned = false;
43132         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
43133         return ret_conv;
43134 }
43135
43136 int8_tArray  __attribute__((export_name("TS_NodeInfo_write"))) TS_NodeInfo_write(uint64_t obj) {
43137         LDKNodeInfo obj_conv;
43138         obj_conv.inner = untag_ptr(obj);
43139         obj_conv.is_owned = ptr_is_owned(obj);
43140         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43141         obj_conv.is_owned = false;
43142         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
43143         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43144         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43145         CVec_u8Z_free(ret_var);
43146         return ret_arr;
43147 }
43148
43149 uint64_t  __attribute__((export_name("TS_NodeInfo_read"))) TS_NodeInfo_read(int8_tArray ser) {
43150         LDKu8slice ser_ref;
43151         ser_ref.datalen = ser->arr_len;
43152         ser_ref.data = ser->elems;
43153         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
43154         *ret_conv = NodeInfo_read(ser_ref);
43155         FREE(ser);
43156         return tag_ptr(ret_conv, true);
43157 }
43158
43159 int8_tArray  __attribute__((export_name("TS_NetworkGraph_write"))) TS_NetworkGraph_write(uint64_t obj) {
43160         LDKNetworkGraph obj_conv;
43161         obj_conv.inner = untag_ptr(obj);
43162         obj_conv.is_owned = ptr_is_owned(obj);
43163         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43164         obj_conv.is_owned = false;
43165         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
43166         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43167         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43168         CVec_u8Z_free(ret_var);
43169         return ret_arr;
43170 }
43171
43172 uint64_t  __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_read(int8_tArray ser, uint64_t arg) {
43173         LDKu8slice ser_ref;
43174         ser_ref.datalen = ser->arr_len;
43175         ser_ref.data = ser->elems;
43176         void* arg_ptr = untag_ptr(arg);
43177         CHECK_ACCESS(arg_ptr);
43178         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
43179         if (arg_conv.free == LDKLogger_JCalls_free) {
43180                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43181                 LDKLogger_JCalls_cloned(&arg_conv);
43182         }
43183         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
43184         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
43185         FREE(ser);
43186         return tag_ptr(ret_conv, true);
43187 }
43188
43189 uint64_t  __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(int8_tArray genesis_hash, uint64_t logger) {
43190         LDKThirtyTwoBytes genesis_hash_ref;
43191         CHECK(genesis_hash->arr_len == 32);
43192         memcpy(genesis_hash_ref.data, genesis_hash->elems, 32); FREE(genesis_hash);
43193         void* logger_ptr = untag_ptr(logger);
43194         CHECK_ACCESS(logger_ptr);
43195         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43196         if (logger_conv.free == LDKLogger_JCalls_free) {
43197                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43198                 LDKLogger_JCalls_cloned(&logger_conv);
43199         }
43200         LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref, logger_conv);
43201         uint64_t ret_ref = 0;
43202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43204         return ret_ref;
43205 }
43206
43207 uint64_t  __attribute__((export_name("TS_NetworkGraph_read_only"))) TS_NetworkGraph_read_only(uint64_t this_arg) {
43208         LDKNetworkGraph this_arg_conv;
43209         this_arg_conv.inner = untag_ptr(this_arg);
43210         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43212         this_arg_conv.is_owned = false;
43213         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
43214         uint64_t ret_ref = 0;
43215         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43216         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43217         return ret_ref;
43218 }
43219
43220 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) {
43221         LDKNetworkGraph this_arg_conv;
43222         this_arg_conv.inner = untag_ptr(this_arg);
43223         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43225         this_arg_conv.is_owned = false;
43226         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
43227         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
43228         uint64_t ret_ref = tag_ptr(ret_copy, true);
43229         return ret_ref;
43230 }
43231
43232 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) {
43233         LDKNetworkGraph this_arg_conv;
43234         this_arg_conv.inner = untag_ptr(this_arg);
43235         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43237         this_arg_conv.is_owned = false;
43238         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
43239 }
43240
43241 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_node_from_announcement"))) TS_NetworkGraph_update_node_from_announcement(uint64_t this_arg, uint64_t msg) {
43242         LDKNetworkGraph this_arg_conv;
43243         this_arg_conv.inner = untag_ptr(this_arg);
43244         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43246         this_arg_conv.is_owned = false;
43247         LDKNodeAnnouncement msg_conv;
43248         msg_conv.inner = untag_ptr(msg);
43249         msg_conv.is_owned = ptr_is_owned(msg);
43250         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43251         msg_conv.is_owned = false;
43252         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43253         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
43254         return tag_ptr(ret_conv, true);
43255 }
43256
43257 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) {
43258         LDKNetworkGraph this_arg_conv;
43259         this_arg_conv.inner = untag_ptr(this_arg);
43260         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43262         this_arg_conv.is_owned = false;
43263         LDKUnsignedNodeAnnouncement msg_conv;
43264         msg_conv.inner = untag_ptr(msg);
43265         msg_conv.is_owned = ptr_is_owned(msg);
43266         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43267         msg_conv.is_owned = false;
43268         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43269         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
43270         return tag_ptr(ret_conv, true);
43271 }
43272
43273 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) {
43274         LDKNetworkGraph this_arg_conv;
43275         this_arg_conv.inner = untag_ptr(this_arg);
43276         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43278         this_arg_conv.is_owned = false;
43279         LDKChannelAnnouncement msg_conv;
43280         msg_conv.inner = untag_ptr(msg);
43281         msg_conv.is_owned = ptr_is_owned(msg);
43282         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43283         msg_conv.is_owned = false;
43284         void* chain_access_ptr = untag_ptr(chain_access);
43285         CHECK_ACCESS(chain_access_ptr);
43286         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
43287         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
43288         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
43289                 // Manually implement clone for Java trait instances
43290                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
43291                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43292                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
43293                 }
43294         }
43295         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43296         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
43297         return tag_ptr(ret_conv, true);
43298 }
43299
43300 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) {
43301         LDKNetworkGraph this_arg_conv;
43302         this_arg_conv.inner = untag_ptr(this_arg);
43303         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43305         this_arg_conv.is_owned = false;
43306         LDKUnsignedChannelAnnouncement msg_conv;
43307         msg_conv.inner = untag_ptr(msg);
43308         msg_conv.is_owned = ptr_is_owned(msg);
43309         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43310         msg_conv.is_owned = false;
43311         void* chain_access_ptr = untag_ptr(chain_access);
43312         CHECK_ACCESS(chain_access_ptr);
43313         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
43314         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
43315         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
43316                 // Manually implement clone for Java trait instances
43317                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
43318                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43319                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
43320                 }
43321         }
43322         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43323         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
43324         return tag_ptr(ret_conv, true);
43325 }
43326
43327 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) {
43328         LDKNetworkGraph this_arg_conv;
43329         this_arg_conv.inner = untag_ptr(this_arg);
43330         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43332         this_arg_conv.is_owned = false;
43333         LDKChannelFeatures features_conv;
43334         features_conv.inner = untag_ptr(features);
43335         features_conv.is_owned = ptr_is_owned(features);
43336         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
43337         features_conv = ChannelFeatures_clone(&features_conv);
43338         LDKPublicKey node_id_1_ref;
43339         CHECK(node_id_1->arr_len == 33);
43340         memcpy(node_id_1_ref.compressed_form, node_id_1->elems, 33); FREE(node_id_1);
43341         LDKPublicKey node_id_2_ref;
43342         CHECK(node_id_2->arr_len == 33);
43343         memcpy(node_id_2_ref.compressed_form, node_id_2->elems, 33); FREE(node_id_2);
43344         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43345         *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);
43346         return tag_ptr(ret_conv, true);
43347 }
43348
43349 void  __attribute__((export_name("TS_NetworkGraph_channel_failed"))) TS_NetworkGraph_channel_failed(uint64_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
43350         LDKNetworkGraph this_arg_conv;
43351         this_arg_conv.inner = untag_ptr(this_arg);
43352         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43354         this_arg_conv.is_owned = false;
43355         NetworkGraph_channel_failed(&this_arg_conv, short_channel_id, is_permanent);
43356 }
43357
43358 void  __attribute__((export_name("TS_NetworkGraph_node_failed_permanent"))) TS_NetworkGraph_node_failed_permanent(uint64_t this_arg, int8_tArray node_id) {
43359         LDKNetworkGraph this_arg_conv;
43360         this_arg_conv.inner = untag_ptr(this_arg);
43361         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43363         this_arg_conv.is_owned = false;
43364         LDKPublicKey node_id_ref;
43365         CHECK(node_id->arr_len == 33);
43366         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
43367         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
43368 }
43369
43370 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) {
43371         LDKNetworkGraph this_arg_conv;
43372         this_arg_conv.inner = untag_ptr(this_arg);
43373         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43375         this_arg_conv.is_owned = false;
43376         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
43377 }
43378
43379 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel"))) TS_NetworkGraph_update_channel(uint64_t this_arg, uint64_t msg) {
43380         LDKNetworkGraph this_arg_conv;
43381         this_arg_conv.inner = untag_ptr(this_arg);
43382         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43384         this_arg_conv.is_owned = false;
43385         LDKChannelUpdate msg_conv;
43386         msg_conv.inner = untag_ptr(msg);
43387         msg_conv.is_owned = ptr_is_owned(msg);
43388         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43389         msg_conv.is_owned = false;
43390         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43391         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
43392         return tag_ptr(ret_conv, true);
43393 }
43394
43395 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel_unsigned"))) TS_NetworkGraph_update_channel_unsigned(uint64_t this_arg, uint64_t msg) {
43396         LDKNetworkGraph this_arg_conv;
43397         this_arg_conv.inner = untag_ptr(this_arg);
43398         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43400         this_arg_conv.is_owned = false;
43401         LDKUnsignedChannelUpdate msg_conv;
43402         msg_conv.inner = untag_ptr(msg);
43403         msg_conv.is_owned = ptr_is_owned(msg);
43404         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
43405         msg_conv.is_owned = false;
43406         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
43407         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
43408         return tag_ptr(ret_conv, true);
43409 }
43410
43411 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_channel"))) TS_ReadOnlyNetworkGraph_channel(uint64_t this_arg, int64_t short_channel_id) {
43412         LDKReadOnlyNetworkGraph this_arg_conv;
43413         this_arg_conv.inner = untag_ptr(this_arg);
43414         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43416         this_arg_conv.is_owned = false;
43417         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
43418         uint64_t ret_ref = 0;
43419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43421         return ret_ref;
43422 }
43423
43424 int64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_channels"))) TS_ReadOnlyNetworkGraph_list_channels(uint64_t this_arg) {
43425         LDKReadOnlyNetworkGraph this_arg_conv;
43426         this_arg_conv.inner = untag_ptr(this_arg);
43427         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43429         this_arg_conv.is_owned = false;
43430         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
43431         int64_tArray ret_arr = NULL;
43432         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
43433         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
43434         for (size_t i = 0; i < ret_var.datalen; i++) {
43435                 int64_t ret_conv_8_conv = ret_var.data[i];
43436                 ret_arr_ptr[i] = ret_conv_8_conv;
43437         }
43438         
43439         FREE(ret_var.data);
43440         return ret_arr;
43441 }
43442
43443 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_node"))) TS_ReadOnlyNetworkGraph_node(uint64_t this_arg, uint64_t node_id) {
43444         LDKReadOnlyNetworkGraph this_arg_conv;
43445         this_arg_conv.inner = untag_ptr(this_arg);
43446         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43448         this_arg_conv.is_owned = false;
43449         LDKNodeId node_id_conv;
43450         node_id_conv.inner = untag_ptr(node_id);
43451         node_id_conv.is_owned = ptr_is_owned(node_id);
43452         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
43453         node_id_conv.is_owned = false;
43454         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
43455         uint64_t ret_ref = 0;
43456         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43457         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43458         return ret_ref;
43459 }
43460
43461 uint64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_nodes"))) TS_ReadOnlyNetworkGraph_list_nodes(uint64_t this_arg) {
43462         LDKReadOnlyNetworkGraph this_arg_conv;
43463         this_arg_conv.inner = untag_ptr(this_arg);
43464         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43466         this_arg_conv.is_owned = false;
43467         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
43468         uint64_tArray ret_arr = NULL;
43469         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
43470         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
43471         for (size_t i = 0; i < ret_var.datalen; i++) {
43472                 LDKNodeId ret_conv_8_var = ret_var.data[i];
43473                 uint64_t ret_conv_8_ref = 0;
43474                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
43475                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
43476                 ret_arr_ptr[i] = ret_conv_8_ref;
43477         }
43478         
43479         FREE(ret_var.data);
43480         return ret_arr;
43481 }
43482
43483 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) TS_ReadOnlyNetworkGraph_get_addresses(uint64_t this_arg, int8_tArray pubkey) {
43484         LDKReadOnlyNetworkGraph this_arg_conv;
43485         this_arg_conv.inner = untag_ptr(this_arg);
43486         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43488         this_arg_conv.is_owned = false;
43489         LDKPublicKey pubkey_ref;
43490         CHECK(pubkey->arr_len == 33);
43491         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
43492         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
43493         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
43494         uint64_t ret_ref = tag_ptr(ret_copy, true);
43495         return ret_ref;
43496 }
43497
43498 void  __attribute__((export_name("TS_DefaultRouter_free"))) TS_DefaultRouter_free(uint64_t this_obj) {
43499         LDKDefaultRouter this_obj_conv;
43500         this_obj_conv.inner = untag_ptr(this_obj);
43501         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43503         DefaultRouter_free(this_obj_conv);
43504 }
43505
43506 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) {
43507         LDKNetworkGraph network_graph_conv;
43508         network_graph_conv.inner = untag_ptr(network_graph);
43509         network_graph_conv.is_owned = ptr_is_owned(network_graph);
43510         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
43511         network_graph_conv.is_owned = false;
43512         void* logger_ptr = untag_ptr(logger);
43513         CHECK_ACCESS(logger_ptr);
43514         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43515         if (logger_conv.free == LDKLogger_JCalls_free) {
43516                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43517                 LDKLogger_JCalls_cloned(&logger_conv);
43518         }
43519         LDKThirtyTwoBytes random_seed_bytes_ref;
43520         CHECK(random_seed_bytes->arr_len == 32);
43521         memcpy(random_seed_bytes_ref.data, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
43522         void* scorer_ptr = untag_ptr(scorer);
43523         CHECK_ACCESS(scorer_ptr);
43524         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
43525         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
43526                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43527                 LDKLockableScore_JCalls_cloned(&scorer_conv);
43528         }
43529         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref, scorer_conv);
43530         uint64_t ret_ref = 0;
43531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43533         return ret_ref;
43534 }
43535
43536 uint64_t  __attribute__((export_name("TS_DefaultRouter_as_Router"))) TS_DefaultRouter_as_Router(uint64_t this_arg) {
43537         LDKDefaultRouter this_arg_conv;
43538         this_arg_conv.inner = untag_ptr(this_arg);
43539         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43541         this_arg_conv.is_owned = false;
43542         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
43543         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
43544         return tag_ptr(ret_ret, true);
43545 }
43546
43547 void  __attribute__((export_name("TS_Router_free"))) TS_Router_free(uint64_t this_ptr) {
43548         if (!ptr_is_owned(this_ptr)) return;
43549         void* this_ptr_ptr = untag_ptr(this_ptr);
43550         CHECK_ACCESS(this_ptr_ptr);
43551         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
43552         FREE(untag_ptr(this_ptr));
43553         Router_free(this_ptr_conv);
43554 }
43555
43556 void  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_free"))) TS_ScorerAccountingForInFlightHtlcs_free(uint64_t this_obj) {
43557         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
43558         this_obj_conv.inner = untag_ptr(this_obj);
43559         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43561         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
43562 }
43563
43564 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_new"))) TS_ScorerAccountingForInFlightHtlcs_new(uint64_t scorer, uint64_t inflight_htlcs) {
43565         void* scorer_ptr = untag_ptr(scorer);
43566         CHECK_ACCESS(scorer_ptr);
43567         LDKScore scorer_conv = *(LDKScore*)(scorer_ptr);
43568         if (scorer_conv.free == LDKScore_JCalls_free) {
43569                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43570                 LDKScore_JCalls_cloned(&scorer_conv);
43571         }
43572         LDKInFlightHtlcs inflight_htlcs_conv;
43573         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
43574         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
43575         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
43576         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
43577         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, inflight_htlcs_conv);
43578         uint64_t ret_ref = 0;
43579         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43580         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43581         return ret_ref;
43582 }
43583
43584 int8_tArray  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_write"))) TS_ScorerAccountingForInFlightHtlcs_write(uint64_t obj) {
43585         LDKScorerAccountingForInFlightHtlcs obj_conv;
43586         obj_conv.inner = untag_ptr(obj);
43587         obj_conv.is_owned = ptr_is_owned(obj);
43588         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43589         obj_conv.is_owned = false;
43590         LDKCVec_u8Z ret_var = ScorerAccountingForInFlightHtlcs_write(&obj_conv);
43591         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43592         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43593         CVec_u8Z_free(ret_var);
43594         return ret_arr;
43595 }
43596
43597 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_as_Score"))) TS_ScorerAccountingForInFlightHtlcs_as_Score(uint64_t this_arg) {
43598         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
43599         this_arg_conv.inner = untag_ptr(this_arg);
43600         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43602         this_arg_conv.is_owned = false;
43603         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
43604         *ret_ret = ScorerAccountingForInFlightHtlcs_as_Score(&this_arg_conv);
43605         return tag_ptr(ret_ret, true);
43606 }
43607
43608 void  __attribute__((export_name("TS_InFlightHtlcs_free"))) TS_InFlightHtlcs_free(uint64_t this_obj) {
43609         LDKInFlightHtlcs this_obj_conv;
43610         this_obj_conv.inner = untag_ptr(this_obj);
43611         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43613         InFlightHtlcs_free(this_obj_conv);
43614 }
43615
43616 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
43617         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
43618         uint64_t ret_ref = 0;
43619         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43620         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43621         return ret_ref;
43622 }
43623 int64_t  __attribute__((export_name("TS_InFlightHtlcs_clone_ptr"))) TS_InFlightHtlcs_clone_ptr(uint64_t arg) {
43624         LDKInFlightHtlcs arg_conv;
43625         arg_conv.inner = untag_ptr(arg);
43626         arg_conv.is_owned = ptr_is_owned(arg);
43627         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43628         arg_conv.is_owned = false;
43629         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
43630         return ret_conv;
43631 }
43632
43633 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_clone"))) TS_InFlightHtlcs_clone(uint64_t orig) {
43634         LDKInFlightHtlcs orig_conv;
43635         orig_conv.inner = untag_ptr(orig);
43636         orig_conv.is_owned = ptr_is_owned(orig);
43637         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43638         orig_conv.is_owned = false;
43639         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
43640         uint64_t ret_ref = 0;
43641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43643         return ret_ref;
43644 }
43645
43646 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_new"))) TS_InFlightHtlcs_new() {
43647         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
43648         uint64_t ret_ref = 0;
43649         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43650         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43651         return ret_ref;
43652 }
43653
43654 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) {
43655         LDKInFlightHtlcs this_arg_conv;
43656         this_arg_conv.inner = untag_ptr(this_arg);
43657         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43659         this_arg_conv.is_owned = false;
43660         LDKNodeId source_conv;
43661         source_conv.inner = untag_ptr(source);
43662         source_conv.is_owned = ptr_is_owned(source);
43663         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
43664         source_conv.is_owned = false;
43665         LDKNodeId target_conv;
43666         target_conv.inner = untag_ptr(target);
43667         target_conv.is_owned = ptr_is_owned(target);
43668         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
43669         target_conv.is_owned = false;
43670         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43671         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
43672         uint64_t ret_ref = tag_ptr(ret_copy, true);
43673         return ret_ref;
43674 }
43675
43676 int8_tArray  __attribute__((export_name("TS_InFlightHtlcs_write"))) TS_InFlightHtlcs_write(uint64_t obj) {
43677         LDKInFlightHtlcs obj_conv;
43678         obj_conv.inner = untag_ptr(obj);
43679         obj_conv.is_owned = ptr_is_owned(obj);
43680         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43681         obj_conv.is_owned = false;
43682         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
43683         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43684         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43685         CVec_u8Z_free(ret_var);
43686         return ret_arr;
43687 }
43688
43689 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_read"))) TS_InFlightHtlcs_read(int8_tArray ser) {
43690         LDKu8slice ser_ref;
43691         ser_ref.datalen = ser->arr_len;
43692         ser_ref.data = ser->elems;
43693         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
43694         *ret_conv = InFlightHtlcs_read(ser_ref);
43695         FREE(ser);
43696         return tag_ptr(ret_conv, true);
43697 }
43698
43699 void  __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint64_t this_obj) {
43700         LDKRouteHop this_obj_conv;
43701         this_obj_conv.inner = untag_ptr(this_obj);
43702         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43704         RouteHop_free(this_obj_conv);
43705 }
43706
43707 int8_tArray  __attribute__((export_name("TS_RouteHop_get_pubkey"))) TS_RouteHop_get_pubkey(uint64_t this_ptr) {
43708         LDKRouteHop this_ptr_conv;
43709         this_ptr_conv.inner = untag_ptr(this_ptr);
43710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43712         this_ptr_conv.is_owned = false;
43713         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
43714         memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
43715         return ret_arr;
43716 }
43717
43718 void  __attribute__((export_name("TS_RouteHop_set_pubkey"))) TS_RouteHop_set_pubkey(uint64_t this_ptr, int8_tArray val) {
43719         LDKRouteHop this_ptr_conv;
43720         this_ptr_conv.inner = untag_ptr(this_ptr);
43721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43723         this_ptr_conv.is_owned = false;
43724         LDKPublicKey val_ref;
43725         CHECK(val->arr_len == 33);
43726         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
43727         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
43728 }
43729
43730 uint64_t  __attribute__((export_name("TS_RouteHop_get_node_features"))) TS_RouteHop_get_node_features(uint64_t this_ptr) {
43731         LDKRouteHop this_ptr_conv;
43732         this_ptr_conv.inner = untag_ptr(this_ptr);
43733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43735         this_ptr_conv.is_owned = false;
43736         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
43737         uint64_t ret_ref = 0;
43738         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43739         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43740         return ret_ref;
43741 }
43742
43743 void  __attribute__((export_name("TS_RouteHop_set_node_features"))) TS_RouteHop_set_node_features(uint64_t this_ptr, uint64_t val) {
43744         LDKRouteHop this_ptr_conv;
43745         this_ptr_conv.inner = untag_ptr(this_ptr);
43746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43748         this_ptr_conv.is_owned = false;
43749         LDKNodeFeatures val_conv;
43750         val_conv.inner = untag_ptr(val);
43751         val_conv.is_owned = ptr_is_owned(val);
43752         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43753         val_conv = NodeFeatures_clone(&val_conv);
43754         RouteHop_set_node_features(&this_ptr_conv, val_conv);
43755 }
43756
43757 int64_t  __attribute__((export_name("TS_RouteHop_get_short_channel_id"))) TS_RouteHop_get_short_channel_id(uint64_t this_ptr) {
43758         LDKRouteHop this_ptr_conv;
43759         this_ptr_conv.inner = untag_ptr(this_ptr);
43760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43762         this_ptr_conv.is_owned = false;
43763         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
43764         return ret_conv;
43765 }
43766
43767 void  __attribute__((export_name("TS_RouteHop_set_short_channel_id"))) TS_RouteHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
43768         LDKRouteHop this_ptr_conv;
43769         this_ptr_conv.inner = untag_ptr(this_ptr);
43770         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43772         this_ptr_conv.is_owned = false;
43773         RouteHop_set_short_channel_id(&this_ptr_conv, val);
43774 }
43775
43776 uint64_t  __attribute__((export_name("TS_RouteHop_get_channel_features"))) TS_RouteHop_get_channel_features(uint64_t this_ptr) {
43777         LDKRouteHop this_ptr_conv;
43778         this_ptr_conv.inner = untag_ptr(this_ptr);
43779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43781         this_ptr_conv.is_owned = false;
43782         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
43783         uint64_t ret_ref = 0;
43784         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43785         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43786         return ret_ref;
43787 }
43788
43789 void  __attribute__((export_name("TS_RouteHop_set_channel_features"))) TS_RouteHop_set_channel_features(uint64_t this_ptr, uint64_t val) {
43790         LDKRouteHop this_ptr_conv;
43791         this_ptr_conv.inner = untag_ptr(this_ptr);
43792         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43793         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43794         this_ptr_conv.is_owned = false;
43795         LDKChannelFeatures val_conv;
43796         val_conv.inner = untag_ptr(val);
43797         val_conv.is_owned = ptr_is_owned(val);
43798         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43799         val_conv = ChannelFeatures_clone(&val_conv);
43800         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
43801 }
43802
43803 int64_t  __attribute__((export_name("TS_RouteHop_get_fee_msat"))) TS_RouteHop_get_fee_msat(uint64_t this_ptr) {
43804         LDKRouteHop this_ptr_conv;
43805         this_ptr_conv.inner = untag_ptr(this_ptr);
43806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43808         this_ptr_conv.is_owned = false;
43809         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
43810         return ret_conv;
43811 }
43812
43813 void  __attribute__((export_name("TS_RouteHop_set_fee_msat"))) TS_RouteHop_set_fee_msat(uint64_t this_ptr, int64_t val) {
43814         LDKRouteHop this_ptr_conv;
43815         this_ptr_conv.inner = untag_ptr(this_ptr);
43816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43818         this_ptr_conv.is_owned = false;
43819         RouteHop_set_fee_msat(&this_ptr_conv, val);
43820 }
43821
43822 int32_t  __attribute__((export_name("TS_RouteHop_get_cltv_expiry_delta"))) TS_RouteHop_get_cltv_expiry_delta(uint64_t this_ptr) {
43823         LDKRouteHop this_ptr_conv;
43824         this_ptr_conv.inner = untag_ptr(this_ptr);
43825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43827         this_ptr_conv.is_owned = false;
43828         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
43829         return ret_conv;
43830 }
43831
43832 void  __attribute__((export_name("TS_RouteHop_set_cltv_expiry_delta"))) TS_RouteHop_set_cltv_expiry_delta(uint64_t this_ptr, int32_t val) {
43833         LDKRouteHop this_ptr_conv;
43834         this_ptr_conv.inner = untag_ptr(this_ptr);
43835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43837         this_ptr_conv.is_owned = false;
43838         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
43839 }
43840
43841 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) {
43842         LDKPublicKey pubkey_arg_ref;
43843         CHECK(pubkey_arg->arr_len == 33);
43844         memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
43845         LDKNodeFeatures node_features_arg_conv;
43846         node_features_arg_conv.inner = untag_ptr(node_features_arg);
43847         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
43848         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
43849         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
43850         LDKChannelFeatures channel_features_arg_conv;
43851         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
43852         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
43853         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
43854         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
43855         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);
43856         uint64_t ret_ref = 0;
43857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43859         return ret_ref;
43860 }
43861
43862 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
43863         LDKRouteHop ret_var = RouteHop_clone(arg);
43864         uint64_t ret_ref = 0;
43865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43867         return ret_ref;
43868 }
43869 int64_t  __attribute__((export_name("TS_RouteHop_clone_ptr"))) TS_RouteHop_clone_ptr(uint64_t arg) {
43870         LDKRouteHop arg_conv;
43871         arg_conv.inner = untag_ptr(arg);
43872         arg_conv.is_owned = ptr_is_owned(arg);
43873         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43874         arg_conv.is_owned = false;
43875         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
43876         return ret_conv;
43877 }
43878
43879 uint64_t  __attribute__((export_name("TS_RouteHop_clone"))) TS_RouteHop_clone(uint64_t orig) {
43880         LDKRouteHop orig_conv;
43881         orig_conv.inner = untag_ptr(orig);
43882         orig_conv.is_owned = ptr_is_owned(orig);
43883         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43884         orig_conv.is_owned = false;
43885         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
43886         uint64_t ret_ref = 0;
43887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43889         return ret_ref;
43890 }
43891
43892 int64_t  __attribute__((export_name("TS_RouteHop_hash"))) TS_RouteHop_hash(uint64_t o) {
43893         LDKRouteHop o_conv;
43894         o_conv.inner = untag_ptr(o);
43895         o_conv.is_owned = ptr_is_owned(o);
43896         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43897         o_conv.is_owned = false;
43898         int64_t ret_conv = RouteHop_hash(&o_conv);
43899         return ret_conv;
43900 }
43901
43902 jboolean  __attribute__((export_name("TS_RouteHop_eq"))) TS_RouteHop_eq(uint64_t a, uint64_t b) {
43903         LDKRouteHop a_conv;
43904         a_conv.inner = untag_ptr(a);
43905         a_conv.is_owned = ptr_is_owned(a);
43906         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43907         a_conv.is_owned = false;
43908         LDKRouteHop b_conv;
43909         b_conv.inner = untag_ptr(b);
43910         b_conv.is_owned = ptr_is_owned(b);
43911         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43912         b_conv.is_owned = false;
43913         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
43914         return ret_conv;
43915 }
43916
43917 int8_tArray  __attribute__((export_name("TS_RouteHop_write"))) TS_RouteHop_write(uint64_t obj) {
43918         LDKRouteHop obj_conv;
43919         obj_conv.inner = untag_ptr(obj);
43920         obj_conv.is_owned = ptr_is_owned(obj);
43921         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43922         obj_conv.is_owned = false;
43923         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
43924         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43925         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43926         CVec_u8Z_free(ret_var);
43927         return ret_arr;
43928 }
43929
43930 uint64_t  __attribute__((export_name("TS_RouteHop_read"))) TS_RouteHop_read(int8_tArray ser) {
43931         LDKu8slice ser_ref;
43932         ser_ref.datalen = ser->arr_len;
43933         ser_ref.data = ser->elems;
43934         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
43935         *ret_conv = RouteHop_read(ser_ref);
43936         FREE(ser);
43937         return tag_ptr(ret_conv, true);
43938 }
43939
43940 void  __attribute__((export_name("TS_Route_free"))) TS_Route_free(uint64_t this_obj) {
43941         LDKRoute this_obj_conv;
43942         this_obj_conv.inner = untag_ptr(this_obj);
43943         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43945         Route_free(this_obj_conv);
43946 }
43947
43948 ptrArray  __attribute__((export_name("TS_Route_get_paths"))) TS_Route_get_paths(uint64_t this_ptr) {
43949         LDKRoute this_ptr_conv;
43950         this_ptr_conv.inner = untag_ptr(this_ptr);
43951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43953         this_ptr_conv.is_owned = false;
43954         LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
43955         ptrArray ret_arr = NULL;
43956         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
43957         uint64_tArray *ret_arr_ptr = (uint64_tArray*)(((uint8_t*)ret_arr) + 8);
43958         for (size_t m = 0; m < ret_var.datalen; m++) {
43959                 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
43960                 uint64_tArray ret_conv_12_arr = NULL;
43961                 ret_conv_12_arr = init_uint64_tArray(ret_conv_12_var.datalen, __LINE__);
43962                 uint64_t *ret_conv_12_arr_ptr = (uint64_t*)(((uint8_t*)ret_conv_12_arr) + 8);
43963                 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
43964                         LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
43965                         uint64_t ret_conv_12_conv_10_ref = 0;
43966                         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
43967                         ret_conv_12_conv_10_ref = tag_ptr(ret_conv_12_conv_10_var.inner, ret_conv_12_conv_10_var.is_owned);
43968                         ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
43969                 }
43970                 
43971                 FREE(ret_conv_12_var.data);
43972                 ret_arr_ptr[m] = ret_conv_12_arr;
43973         }
43974         
43975         FREE(ret_var.data);
43976         return ret_arr;
43977 }
43978
43979 void  __attribute__((export_name("TS_Route_set_paths"))) TS_Route_set_paths(uint64_t this_ptr, ptrArray val) {
43980         LDKRoute this_ptr_conv;
43981         this_ptr_conv.inner = untag_ptr(this_ptr);
43982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43984         this_ptr_conv.is_owned = false;
43985         LDKCVec_CVec_RouteHopZZ val_constr;
43986         val_constr.datalen = val->arr_len;
43987         if (val_constr.datalen > 0)
43988                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
43989         else
43990                 val_constr.data = NULL;
43991         uint64_tArray* val_vals = (void*) val->elems;
43992         for (size_t m = 0; m < val_constr.datalen; m++) {
43993                 uint64_tArray val_conv_12 = val_vals[m];
43994                 LDKCVec_RouteHopZ val_conv_12_constr;
43995                 val_conv_12_constr.datalen = val_conv_12->arr_len;
43996                 if (val_conv_12_constr.datalen > 0)
43997                         val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
43998                 else
43999                         val_conv_12_constr.data = NULL;
44000                 uint64_t* val_conv_12_vals = val_conv_12->elems;
44001                 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
44002                         uint64_t val_conv_12_conv_10 = val_conv_12_vals[k];
44003                         LDKRouteHop val_conv_12_conv_10_conv;
44004                         val_conv_12_conv_10_conv.inner = untag_ptr(val_conv_12_conv_10);
44005                         val_conv_12_conv_10_conv.is_owned = ptr_is_owned(val_conv_12_conv_10);
44006                         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
44007                         val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
44008                         val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
44009                 }
44010                 FREE(val_conv_12);
44011                 val_constr.data[m] = val_conv_12_constr;
44012         }
44013         FREE(val);
44014         Route_set_paths(&this_ptr_conv, val_constr);
44015 }
44016
44017 uint64_t  __attribute__((export_name("TS_Route_get_payment_params"))) TS_Route_get_payment_params(uint64_t this_ptr) {
44018         LDKRoute this_ptr_conv;
44019         this_ptr_conv.inner = untag_ptr(this_ptr);
44020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44022         this_ptr_conv.is_owned = false;
44023         LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
44024         uint64_t ret_ref = 0;
44025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44027         return ret_ref;
44028 }
44029
44030 void  __attribute__((export_name("TS_Route_set_payment_params"))) TS_Route_set_payment_params(uint64_t this_ptr, uint64_t val) {
44031         LDKRoute this_ptr_conv;
44032         this_ptr_conv.inner = untag_ptr(this_ptr);
44033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44035         this_ptr_conv.is_owned = false;
44036         LDKPaymentParameters val_conv;
44037         val_conv.inner = untag_ptr(val);
44038         val_conv.is_owned = ptr_is_owned(val);
44039         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44040         val_conv = PaymentParameters_clone(&val_conv);
44041         Route_set_payment_params(&this_ptr_conv, val_conv);
44042 }
44043
44044 uint64_t  __attribute__((export_name("TS_Route_new"))) TS_Route_new(ptrArray paths_arg, uint64_t payment_params_arg) {
44045         LDKCVec_CVec_RouteHopZZ paths_arg_constr;
44046         paths_arg_constr.datalen = paths_arg->arr_len;
44047         if (paths_arg_constr.datalen > 0)
44048                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
44049         else
44050                 paths_arg_constr.data = NULL;
44051         uint64_tArray* paths_arg_vals = (void*) paths_arg->elems;
44052         for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
44053                 uint64_tArray paths_arg_conv_12 = paths_arg_vals[m];
44054                 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
44055                 paths_arg_conv_12_constr.datalen = paths_arg_conv_12->arr_len;
44056                 if (paths_arg_conv_12_constr.datalen > 0)
44057                         paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
44058                 else
44059                         paths_arg_conv_12_constr.data = NULL;
44060                 uint64_t* paths_arg_conv_12_vals = paths_arg_conv_12->elems;
44061                 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
44062                         uint64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
44063                         LDKRouteHop paths_arg_conv_12_conv_10_conv;
44064                         paths_arg_conv_12_conv_10_conv.inner = untag_ptr(paths_arg_conv_12_conv_10);
44065                         paths_arg_conv_12_conv_10_conv.is_owned = ptr_is_owned(paths_arg_conv_12_conv_10);
44066                         CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
44067                         paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
44068                         paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
44069                 }
44070                 FREE(paths_arg_conv_12);
44071                 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
44072         }
44073         FREE(paths_arg);
44074         LDKPaymentParameters payment_params_arg_conv;
44075         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
44076         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
44077         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
44078         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
44079         LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
44080         uint64_t ret_ref = 0;
44081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44083         return ret_ref;
44084 }
44085
44086 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
44087         LDKRoute ret_var = Route_clone(arg);
44088         uint64_t ret_ref = 0;
44089         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44090         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44091         return ret_ref;
44092 }
44093 int64_t  __attribute__((export_name("TS_Route_clone_ptr"))) TS_Route_clone_ptr(uint64_t arg) {
44094         LDKRoute arg_conv;
44095         arg_conv.inner = untag_ptr(arg);
44096         arg_conv.is_owned = ptr_is_owned(arg);
44097         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44098         arg_conv.is_owned = false;
44099         int64_t ret_conv = Route_clone_ptr(&arg_conv);
44100         return ret_conv;
44101 }
44102
44103 uint64_t  __attribute__((export_name("TS_Route_clone"))) TS_Route_clone(uint64_t orig) {
44104         LDKRoute orig_conv;
44105         orig_conv.inner = untag_ptr(orig);
44106         orig_conv.is_owned = ptr_is_owned(orig);
44107         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44108         orig_conv.is_owned = false;
44109         LDKRoute ret_var = Route_clone(&orig_conv);
44110         uint64_t ret_ref = 0;
44111         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44112         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44113         return ret_ref;
44114 }
44115
44116 int64_t  __attribute__((export_name("TS_Route_hash"))) TS_Route_hash(uint64_t o) {
44117         LDKRoute o_conv;
44118         o_conv.inner = untag_ptr(o);
44119         o_conv.is_owned = ptr_is_owned(o);
44120         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44121         o_conv.is_owned = false;
44122         int64_t ret_conv = Route_hash(&o_conv);
44123         return ret_conv;
44124 }
44125
44126 jboolean  __attribute__((export_name("TS_Route_eq"))) TS_Route_eq(uint64_t a, uint64_t b) {
44127         LDKRoute a_conv;
44128         a_conv.inner = untag_ptr(a);
44129         a_conv.is_owned = ptr_is_owned(a);
44130         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44131         a_conv.is_owned = false;
44132         LDKRoute b_conv;
44133         b_conv.inner = untag_ptr(b);
44134         b_conv.is_owned = ptr_is_owned(b);
44135         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44136         b_conv.is_owned = false;
44137         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
44138         return ret_conv;
44139 }
44140
44141 int64_t  __attribute__((export_name("TS_Route_get_total_fees"))) TS_Route_get_total_fees(uint64_t this_arg) {
44142         LDKRoute this_arg_conv;
44143         this_arg_conv.inner = untag_ptr(this_arg);
44144         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44146         this_arg_conv.is_owned = false;
44147         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
44148         return ret_conv;
44149 }
44150
44151 int64_t  __attribute__((export_name("TS_Route_get_total_amount"))) TS_Route_get_total_amount(uint64_t this_arg) {
44152         LDKRoute this_arg_conv;
44153         this_arg_conv.inner = untag_ptr(this_arg);
44154         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44155         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44156         this_arg_conv.is_owned = false;
44157         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
44158         return ret_conv;
44159 }
44160
44161 int8_tArray  __attribute__((export_name("TS_Route_write"))) TS_Route_write(uint64_t obj) {
44162         LDKRoute obj_conv;
44163         obj_conv.inner = untag_ptr(obj);
44164         obj_conv.is_owned = ptr_is_owned(obj);
44165         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44166         obj_conv.is_owned = false;
44167         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
44168         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44169         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44170         CVec_u8Z_free(ret_var);
44171         return ret_arr;
44172 }
44173
44174 uint64_t  __attribute__((export_name("TS_Route_read"))) TS_Route_read(int8_tArray ser) {
44175         LDKu8slice ser_ref;
44176         ser_ref.datalen = ser->arr_len;
44177         ser_ref.data = ser->elems;
44178         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
44179         *ret_conv = Route_read(ser_ref);
44180         FREE(ser);
44181         return tag_ptr(ret_conv, true);
44182 }
44183
44184 void  __attribute__((export_name("TS_RouteParameters_free"))) TS_RouteParameters_free(uint64_t this_obj) {
44185         LDKRouteParameters this_obj_conv;
44186         this_obj_conv.inner = untag_ptr(this_obj);
44187         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44189         RouteParameters_free(this_obj_conv);
44190 }
44191
44192 uint64_t  __attribute__((export_name("TS_RouteParameters_get_payment_params"))) TS_RouteParameters_get_payment_params(uint64_t this_ptr) {
44193         LDKRouteParameters this_ptr_conv;
44194         this_ptr_conv.inner = untag_ptr(this_ptr);
44195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44197         this_ptr_conv.is_owned = false;
44198         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
44199         uint64_t ret_ref = 0;
44200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44202         return ret_ref;
44203 }
44204
44205 void  __attribute__((export_name("TS_RouteParameters_set_payment_params"))) TS_RouteParameters_set_payment_params(uint64_t this_ptr, uint64_t val) {
44206         LDKRouteParameters this_ptr_conv;
44207         this_ptr_conv.inner = untag_ptr(this_ptr);
44208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44210         this_ptr_conv.is_owned = false;
44211         LDKPaymentParameters val_conv;
44212         val_conv.inner = untag_ptr(val);
44213         val_conv.is_owned = ptr_is_owned(val);
44214         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44215         val_conv = PaymentParameters_clone(&val_conv);
44216         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
44217 }
44218
44219 int64_t  __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint64_t this_ptr) {
44220         LDKRouteParameters this_ptr_conv;
44221         this_ptr_conv.inner = untag_ptr(this_ptr);
44222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44224         this_ptr_conv.is_owned = false;
44225         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
44226         return ret_conv;
44227 }
44228
44229 void  __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint64_t this_ptr, int64_t val) {
44230         LDKRouteParameters this_ptr_conv;
44231         this_ptr_conv.inner = untag_ptr(this_ptr);
44232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44234         this_ptr_conv.is_owned = false;
44235         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
44236 }
44237
44238 int32_t  __attribute__((export_name("TS_RouteParameters_get_final_cltv_expiry_delta"))) TS_RouteParameters_get_final_cltv_expiry_delta(uint64_t this_ptr) {
44239         LDKRouteParameters this_ptr_conv;
44240         this_ptr_conv.inner = untag_ptr(this_ptr);
44241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44243         this_ptr_conv.is_owned = false;
44244         int32_t ret_conv = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
44245         return ret_conv;
44246 }
44247
44248 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) {
44249         LDKRouteParameters this_ptr_conv;
44250         this_ptr_conv.inner = untag_ptr(this_ptr);
44251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44253         this_ptr_conv.is_owned = false;
44254         RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
44255 }
44256
44257 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) {
44258         LDKPaymentParameters payment_params_arg_conv;
44259         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
44260         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
44261         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
44262         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
44263         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
44264         uint64_t ret_ref = 0;
44265         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44266         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44267         return ret_ref;
44268 }
44269
44270 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
44271         LDKRouteParameters ret_var = RouteParameters_clone(arg);
44272         uint64_t ret_ref = 0;
44273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44275         return ret_ref;
44276 }
44277 int64_t  __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint64_t arg) {
44278         LDKRouteParameters arg_conv;
44279         arg_conv.inner = untag_ptr(arg);
44280         arg_conv.is_owned = ptr_is_owned(arg);
44281         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44282         arg_conv.is_owned = false;
44283         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
44284         return ret_conv;
44285 }
44286
44287 uint64_t  __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint64_t orig) {
44288         LDKRouteParameters orig_conv;
44289         orig_conv.inner = untag_ptr(orig);
44290         orig_conv.is_owned = ptr_is_owned(orig);
44291         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44292         orig_conv.is_owned = false;
44293         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
44294         uint64_t ret_ref = 0;
44295         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44296         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44297         return ret_ref;
44298 }
44299
44300 int8_tArray  __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint64_t obj) {
44301         LDKRouteParameters obj_conv;
44302         obj_conv.inner = untag_ptr(obj);
44303         obj_conv.is_owned = ptr_is_owned(obj);
44304         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44305         obj_conv.is_owned = false;
44306         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
44307         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44308         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44309         CVec_u8Z_free(ret_var);
44310         return ret_arr;
44311 }
44312
44313 uint64_t  __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
44314         LDKu8slice ser_ref;
44315         ser_ref.datalen = ser->arr_len;
44316         ser_ref.data = ser->elems;
44317         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
44318         *ret_conv = RouteParameters_read(ser_ref);
44319         FREE(ser);
44320         return tag_ptr(ret_conv, true);
44321 }
44322
44323 void  __attribute__((export_name("TS_PaymentParameters_free"))) TS_PaymentParameters_free(uint64_t this_obj) {
44324         LDKPaymentParameters this_obj_conv;
44325         this_obj_conv.inner = untag_ptr(this_obj);
44326         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44328         PaymentParameters_free(this_obj_conv);
44329 }
44330
44331 int8_tArray  __attribute__((export_name("TS_PaymentParameters_get_payee_pubkey"))) TS_PaymentParameters_get_payee_pubkey(uint64_t this_ptr) {
44332         LDKPaymentParameters this_ptr_conv;
44333         this_ptr_conv.inner = untag_ptr(this_ptr);
44334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44336         this_ptr_conv.is_owned = false;
44337         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44338         memcpy(ret_arr->elems, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form, 33);
44339         return ret_arr;
44340 }
44341
44342 void  __attribute__((export_name("TS_PaymentParameters_set_payee_pubkey"))) TS_PaymentParameters_set_payee_pubkey(uint64_t this_ptr, int8_tArray val) {
44343         LDKPaymentParameters this_ptr_conv;
44344         this_ptr_conv.inner = untag_ptr(this_ptr);
44345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44347         this_ptr_conv.is_owned = false;
44348         LDKPublicKey val_ref;
44349         CHECK(val->arr_len == 33);
44350         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44351         PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
44352 }
44353
44354 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_features"))) TS_PaymentParameters_get_features(uint64_t this_ptr) {
44355         LDKPaymentParameters this_ptr_conv;
44356         this_ptr_conv.inner = untag_ptr(this_ptr);
44357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44359         this_ptr_conv.is_owned = false;
44360         LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv);
44361         uint64_t ret_ref = 0;
44362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44364         return ret_ref;
44365 }
44366
44367 void  __attribute__((export_name("TS_PaymentParameters_set_features"))) TS_PaymentParameters_set_features(uint64_t this_ptr, uint64_t val) {
44368         LDKPaymentParameters this_ptr_conv;
44369         this_ptr_conv.inner = untag_ptr(this_ptr);
44370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44372         this_ptr_conv.is_owned = false;
44373         LDKInvoiceFeatures val_conv;
44374         val_conv.inner = untag_ptr(val);
44375         val_conv.is_owned = ptr_is_owned(val);
44376         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44377         val_conv = InvoiceFeatures_clone(&val_conv);
44378         PaymentParameters_set_features(&this_ptr_conv, val_conv);
44379 }
44380
44381 uint64_tArray  __attribute__((export_name("TS_PaymentParameters_get_route_hints"))) TS_PaymentParameters_get_route_hints(uint64_t this_ptr) {
44382         LDKPaymentParameters this_ptr_conv;
44383         this_ptr_conv.inner = untag_ptr(this_ptr);
44384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44386         this_ptr_conv.is_owned = false;
44387         LDKCVec_RouteHintZ ret_var = PaymentParameters_get_route_hints(&this_ptr_conv);
44388         uint64_tArray ret_arr = NULL;
44389         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
44390         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
44391         for (size_t l = 0; l < ret_var.datalen; l++) {
44392                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
44393                 uint64_t ret_conv_11_ref = 0;
44394                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
44395                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
44396                 ret_arr_ptr[l] = ret_conv_11_ref;
44397         }
44398         
44399         FREE(ret_var.data);
44400         return ret_arr;
44401 }
44402
44403 void  __attribute__((export_name("TS_PaymentParameters_set_route_hints"))) TS_PaymentParameters_set_route_hints(uint64_t this_ptr, uint64_tArray val) {
44404         LDKPaymentParameters this_ptr_conv;
44405         this_ptr_conv.inner = untag_ptr(this_ptr);
44406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44408         this_ptr_conv.is_owned = false;
44409         LDKCVec_RouteHintZ val_constr;
44410         val_constr.datalen = val->arr_len;
44411         if (val_constr.datalen > 0)
44412                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
44413         else
44414                 val_constr.data = NULL;
44415         uint64_t* val_vals = val->elems;
44416         for (size_t l = 0; l < val_constr.datalen; l++) {
44417                 uint64_t val_conv_11 = val_vals[l];
44418                 LDKRouteHint val_conv_11_conv;
44419                 val_conv_11_conv.inner = untag_ptr(val_conv_11);
44420                 val_conv_11_conv.is_owned = ptr_is_owned(val_conv_11);
44421                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
44422                 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
44423                 val_constr.data[l] = val_conv_11_conv;
44424         }
44425         FREE(val);
44426         PaymentParameters_set_route_hints(&this_ptr_conv, val_constr);
44427 }
44428
44429 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_expiry_time"))) TS_PaymentParameters_get_expiry_time(uint64_t this_ptr) {
44430         LDKPaymentParameters this_ptr_conv;
44431         this_ptr_conv.inner = untag_ptr(this_ptr);
44432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44434         this_ptr_conv.is_owned = false;
44435         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44436         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
44437         uint64_t ret_ref = tag_ptr(ret_copy, true);
44438         return ret_ref;
44439 }
44440
44441 void  __attribute__((export_name("TS_PaymentParameters_set_expiry_time"))) TS_PaymentParameters_set_expiry_time(uint64_t this_ptr, uint64_t val) {
44442         LDKPaymentParameters this_ptr_conv;
44443         this_ptr_conv.inner = untag_ptr(this_ptr);
44444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44446         this_ptr_conv.is_owned = false;
44447         void* val_ptr = untag_ptr(val);
44448         CHECK_ACCESS(val_ptr);
44449         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44450         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
44451         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
44452 }
44453
44454 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) {
44455         LDKPaymentParameters this_ptr_conv;
44456         this_ptr_conv.inner = untag_ptr(this_ptr);
44457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44459         this_ptr_conv.is_owned = false;
44460         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
44461         return ret_conv;
44462 }
44463
44464 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) {
44465         LDKPaymentParameters this_ptr_conv;
44466         this_ptr_conv.inner = untag_ptr(this_ptr);
44467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44469         this_ptr_conv.is_owned = false;
44470         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
44471 }
44472
44473 int8_t  __attribute__((export_name("TS_PaymentParameters_get_max_path_count"))) TS_PaymentParameters_get_max_path_count(uint64_t this_ptr) {
44474         LDKPaymentParameters this_ptr_conv;
44475         this_ptr_conv.inner = untag_ptr(this_ptr);
44476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44478         this_ptr_conv.is_owned = false;
44479         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
44480         return ret_conv;
44481 }
44482
44483 void  __attribute__((export_name("TS_PaymentParameters_set_max_path_count"))) TS_PaymentParameters_set_max_path_count(uint64_t this_ptr, int8_t val) {
44484         LDKPaymentParameters this_ptr_conv;
44485         this_ptr_conv.inner = untag_ptr(this_ptr);
44486         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44488         this_ptr_conv.is_owned = false;
44489         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
44490 }
44491
44492 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) {
44493         LDKPaymentParameters this_ptr_conv;
44494         this_ptr_conv.inner = untag_ptr(this_ptr);
44495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44497         this_ptr_conv.is_owned = false;
44498         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
44499         return ret_conv;
44500 }
44501
44502 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) {
44503         LDKPaymentParameters this_ptr_conv;
44504         this_ptr_conv.inner = untag_ptr(this_ptr);
44505         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44507         this_ptr_conv.is_owned = false;
44508         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
44509 }
44510
44511 int64_tArray  __attribute__((export_name("TS_PaymentParameters_get_previously_failed_channels"))) TS_PaymentParameters_get_previously_failed_channels(uint64_t this_ptr) {
44512         LDKPaymentParameters this_ptr_conv;
44513         this_ptr_conv.inner = untag_ptr(this_ptr);
44514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44516         this_ptr_conv.is_owned = false;
44517         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
44518         int64_tArray ret_arr = NULL;
44519         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
44520         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
44521         for (size_t i = 0; i < ret_var.datalen; i++) {
44522                 int64_t ret_conv_8_conv = ret_var.data[i];
44523                 ret_arr_ptr[i] = ret_conv_8_conv;
44524         }
44525         
44526         FREE(ret_var.data);
44527         return ret_arr;
44528 }
44529
44530 void  __attribute__((export_name("TS_PaymentParameters_set_previously_failed_channels"))) TS_PaymentParameters_set_previously_failed_channels(uint64_t this_ptr, int64_tArray val) {
44531         LDKPaymentParameters this_ptr_conv;
44532         this_ptr_conv.inner = untag_ptr(this_ptr);
44533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44535         this_ptr_conv.is_owned = false;
44536         LDKCVec_u64Z val_constr;
44537         val_constr.datalen = val->arr_len;
44538         if (val_constr.datalen > 0)
44539                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
44540         else
44541                 val_constr.data = NULL;
44542         int64_t* val_vals = val->elems;
44543         for (size_t i = 0; i < val_constr.datalen; i++) {
44544                 int64_t val_conv_8 = val_vals[i];
44545                 val_constr.data[i] = val_conv_8;
44546         }
44547         FREE(val);
44548         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
44549 }
44550
44551 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) {
44552         LDKPublicKey payee_pubkey_arg_ref;
44553         CHECK(payee_pubkey_arg->arr_len == 33);
44554         memcpy(payee_pubkey_arg_ref.compressed_form, payee_pubkey_arg->elems, 33); FREE(payee_pubkey_arg);
44555         LDKInvoiceFeatures features_arg_conv;
44556         features_arg_conv.inner = untag_ptr(features_arg);
44557         features_arg_conv.is_owned = ptr_is_owned(features_arg);
44558         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
44559         features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
44560         LDKCVec_RouteHintZ route_hints_arg_constr;
44561         route_hints_arg_constr.datalen = route_hints_arg->arr_len;
44562         if (route_hints_arg_constr.datalen > 0)
44563                 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
44564         else
44565                 route_hints_arg_constr.data = NULL;
44566         uint64_t* route_hints_arg_vals = route_hints_arg->elems;
44567         for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
44568                 uint64_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
44569                 LDKRouteHint route_hints_arg_conv_11_conv;
44570                 route_hints_arg_conv_11_conv.inner = untag_ptr(route_hints_arg_conv_11);
44571                 route_hints_arg_conv_11_conv.is_owned = ptr_is_owned(route_hints_arg_conv_11);
44572                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
44573                 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
44574                 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
44575         }
44576         FREE(route_hints_arg);
44577         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
44578         CHECK_ACCESS(expiry_time_arg_ptr);
44579         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
44580         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
44581         LDKCVec_u64Z previously_failed_channels_arg_constr;
44582         previously_failed_channels_arg_constr.datalen = previously_failed_channels_arg->arr_len;
44583         if (previously_failed_channels_arg_constr.datalen > 0)
44584                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
44585         else
44586                 previously_failed_channels_arg_constr.data = NULL;
44587         int64_t* previously_failed_channels_arg_vals = previously_failed_channels_arg->elems;
44588         for (size_t i = 0; i < previously_failed_channels_arg_constr.datalen; i++) {
44589                 int64_t previously_failed_channels_arg_conv_8 = previously_failed_channels_arg_vals[i];
44590                 previously_failed_channels_arg_constr.data[i] = previously_failed_channels_arg_conv_8;
44591         }
44592         FREE(previously_failed_channels_arg);
44593         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);
44594         uint64_t ret_ref = 0;
44595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44597         return ret_ref;
44598 }
44599
44600 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
44601         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
44602         uint64_t ret_ref = 0;
44603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44604         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44605         return ret_ref;
44606 }
44607 int64_t  __attribute__((export_name("TS_PaymentParameters_clone_ptr"))) TS_PaymentParameters_clone_ptr(uint64_t arg) {
44608         LDKPaymentParameters arg_conv;
44609         arg_conv.inner = untag_ptr(arg);
44610         arg_conv.is_owned = ptr_is_owned(arg);
44611         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44612         arg_conv.is_owned = false;
44613         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
44614         return ret_conv;
44615 }
44616
44617 uint64_t  __attribute__((export_name("TS_PaymentParameters_clone"))) TS_PaymentParameters_clone(uint64_t orig) {
44618         LDKPaymentParameters orig_conv;
44619         orig_conv.inner = untag_ptr(orig);
44620         orig_conv.is_owned = ptr_is_owned(orig);
44621         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44622         orig_conv.is_owned = false;
44623         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
44624         uint64_t ret_ref = 0;
44625         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44626         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44627         return ret_ref;
44628 }
44629
44630 int64_t  __attribute__((export_name("TS_PaymentParameters_hash"))) TS_PaymentParameters_hash(uint64_t o) {
44631         LDKPaymentParameters o_conv;
44632         o_conv.inner = untag_ptr(o);
44633         o_conv.is_owned = ptr_is_owned(o);
44634         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44635         o_conv.is_owned = false;
44636         int64_t ret_conv = PaymentParameters_hash(&o_conv);
44637         return ret_conv;
44638 }
44639
44640 jboolean  __attribute__((export_name("TS_PaymentParameters_eq"))) TS_PaymentParameters_eq(uint64_t a, uint64_t b) {
44641         LDKPaymentParameters a_conv;
44642         a_conv.inner = untag_ptr(a);
44643         a_conv.is_owned = ptr_is_owned(a);
44644         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44645         a_conv.is_owned = false;
44646         LDKPaymentParameters b_conv;
44647         b_conv.inner = untag_ptr(b);
44648         b_conv.is_owned = ptr_is_owned(b);
44649         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44650         b_conv.is_owned = false;
44651         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
44652         return ret_conv;
44653 }
44654
44655 int8_tArray  __attribute__((export_name("TS_PaymentParameters_write"))) TS_PaymentParameters_write(uint64_t obj) {
44656         LDKPaymentParameters obj_conv;
44657         obj_conv.inner = untag_ptr(obj);
44658         obj_conv.is_owned = ptr_is_owned(obj);
44659         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44660         obj_conv.is_owned = false;
44661         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
44662         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44663         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44664         CVec_u8Z_free(ret_var);
44665         return ret_arr;
44666 }
44667
44668 uint64_t  __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser) {
44669         LDKu8slice ser_ref;
44670         ser_ref.datalen = ser->arr_len;
44671         ser_ref.data = ser->elems;
44672         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
44673         *ret_conv = PaymentParameters_read(ser_ref);
44674         FREE(ser);
44675         return tag_ptr(ret_conv, true);
44676 }
44677
44678 uint64_t  __attribute__((export_name("TS_PaymentParameters_from_node_id"))) TS_PaymentParameters_from_node_id(int8_tArray payee_pubkey) {
44679         LDKPublicKey payee_pubkey_ref;
44680         CHECK(payee_pubkey->arr_len == 33);
44681         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
44682         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref);
44683         uint64_t ret_ref = 0;
44684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44686         return ret_ref;
44687 }
44688
44689 uint64_t  __attribute__((export_name("TS_PaymentParameters_for_keysend"))) TS_PaymentParameters_for_keysend(int8_tArray payee_pubkey) {
44690         LDKPublicKey payee_pubkey_ref;
44691         CHECK(payee_pubkey->arr_len == 33);
44692         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
44693         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref);
44694         uint64_t ret_ref = 0;
44695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44697         return ret_ref;
44698 }
44699
44700 void  __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint64_t this_obj) {
44701         LDKRouteHint this_obj_conv;
44702         this_obj_conv.inner = untag_ptr(this_obj);
44703         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44705         RouteHint_free(this_obj_conv);
44706 }
44707
44708 uint64_tArray  __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint64_t this_ptr) {
44709         LDKRouteHint this_ptr_conv;
44710         this_ptr_conv.inner = untag_ptr(this_ptr);
44711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44713         this_ptr_conv.is_owned = false;
44714         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
44715         uint64_tArray ret_arr = NULL;
44716         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
44717         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
44718         for (size_t o = 0; o < ret_var.datalen; o++) {
44719                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
44720                 uint64_t ret_conv_14_ref = 0;
44721                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
44722                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
44723                 ret_arr_ptr[o] = ret_conv_14_ref;
44724         }
44725         
44726         FREE(ret_var.data);
44727         return ret_arr;
44728 }
44729
44730 void  __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint64_t this_ptr, uint64_tArray val) {
44731         LDKRouteHint this_ptr_conv;
44732         this_ptr_conv.inner = untag_ptr(this_ptr);
44733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44735         this_ptr_conv.is_owned = false;
44736         LDKCVec_RouteHintHopZ val_constr;
44737         val_constr.datalen = val->arr_len;
44738         if (val_constr.datalen > 0)
44739                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
44740         else
44741                 val_constr.data = NULL;
44742         uint64_t* val_vals = val->elems;
44743         for (size_t o = 0; o < val_constr.datalen; o++) {
44744                 uint64_t val_conv_14 = val_vals[o];
44745                 LDKRouteHintHop val_conv_14_conv;
44746                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
44747                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
44748                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
44749                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
44750                 val_constr.data[o] = val_conv_14_conv;
44751         }
44752         FREE(val);
44753         RouteHint_set_a(&this_ptr_conv, val_constr);
44754 }
44755
44756 uint64_t  __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint64_tArray a_arg) {
44757         LDKCVec_RouteHintHopZ a_arg_constr;
44758         a_arg_constr.datalen = a_arg->arr_len;
44759         if (a_arg_constr.datalen > 0)
44760                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
44761         else
44762                 a_arg_constr.data = NULL;
44763         uint64_t* a_arg_vals = a_arg->elems;
44764         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
44765                 uint64_t a_arg_conv_14 = a_arg_vals[o];
44766                 LDKRouteHintHop a_arg_conv_14_conv;
44767                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
44768                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
44769                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
44770                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
44771                 a_arg_constr.data[o] = a_arg_conv_14_conv;
44772         }
44773         FREE(a_arg);
44774         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
44775         uint64_t ret_ref = 0;
44776         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44777         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44778         return ret_ref;
44779 }
44780
44781 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
44782         LDKRouteHint ret_var = RouteHint_clone(arg);
44783         uint64_t ret_ref = 0;
44784         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44785         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44786         return ret_ref;
44787 }
44788 int64_t  __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint64_t arg) {
44789         LDKRouteHint arg_conv;
44790         arg_conv.inner = untag_ptr(arg);
44791         arg_conv.is_owned = ptr_is_owned(arg);
44792         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44793         arg_conv.is_owned = false;
44794         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
44795         return ret_conv;
44796 }
44797
44798 uint64_t  __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint64_t orig) {
44799         LDKRouteHint orig_conv;
44800         orig_conv.inner = untag_ptr(orig);
44801         orig_conv.is_owned = ptr_is_owned(orig);
44802         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44803         orig_conv.is_owned = false;
44804         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
44805         uint64_t ret_ref = 0;
44806         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44807         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44808         return ret_ref;
44809 }
44810
44811 int64_t  __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint64_t o) {
44812         LDKRouteHint o_conv;
44813         o_conv.inner = untag_ptr(o);
44814         o_conv.is_owned = ptr_is_owned(o);
44815         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44816         o_conv.is_owned = false;
44817         int64_t ret_conv = RouteHint_hash(&o_conv);
44818         return ret_conv;
44819 }
44820
44821 jboolean  __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint64_t a, uint64_t b) {
44822         LDKRouteHint a_conv;
44823         a_conv.inner = untag_ptr(a);
44824         a_conv.is_owned = ptr_is_owned(a);
44825         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44826         a_conv.is_owned = false;
44827         LDKRouteHint b_conv;
44828         b_conv.inner = untag_ptr(b);
44829         b_conv.is_owned = ptr_is_owned(b);
44830         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44831         b_conv.is_owned = false;
44832         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
44833         return ret_conv;
44834 }
44835
44836 int8_tArray  __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint64_t obj) {
44837         LDKRouteHint obj_conv;
44838         obj_conv.inner = untag_ptr(obj);
44839         obj_conv.is_owned = ptr_is_owned(obj);
44840         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44841         obj_conv.is_owned = false;
44842         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
44843         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44844         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44845         CVec_u8Z_free(ret_var);
44846         return ret_arr;
44847 }
44848
44849 uint64_t  __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
44850         LDKu8slice ser_ref;
44851         ser_ref.datalen = ser->arr_len;
44852         ser_ref.data = ser->elems;
44853         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
44854         *ret_conv = RouteHint_read(ser_ref);
44855         FREE(ser);
44856         return tag_ptr(ret_conv, true);
44857 }
44858
44859 void  __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint64_t this_obj) {
44860         LDKRouteHintHop this_obj_conv;
44861         this_obj_conv.inner = untag_ptr(this_obj);
44862         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44864         RouteHintHop_free(this_obj_conv);
44865 }
44866
44867 int8_tArray  __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint64_t this_ptr) {
44868         LDKRouteHintHop this_ptr_conv;
44869         this_ptr_conv.inner = untag_ptr(this_ptr);
44870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44872         this_ptr_conv.is_owned = false;
44873         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44874         memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
44875         return ret_arr;
44876 }
44877
44878 void  __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint64_t this_ptr, int8_tArray val) {
44879         LDKRouteHintHop this_ptr_conv;
44880         this_ptr_conv.inner = untag_ptr(this_ptr);
44881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44883         this_ptr_conv.is_owned = false;
44884         LDKPublicKey val_ref;
44885         CHECK(val->arr_len == 33);
44886         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44887         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
44888 }
44889
44890 int64_t  __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint64_t this_ptr) {
44891         LDKRouteHintHop this_ptr_conv;
44892         this_ptr_conv.inner = untag_ptr(this_ptr);
44893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44895         this_ptr_conv.is_owned = false;
44896         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
44897         return ret_conv;
44898 }
44899
44900 void  __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
44901         LDKRouteHintHop this_ptr_conv;
44902         this_ptr_conv.inner = untag_ptr(this_ptr);
44903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44905         this_ptr_conv.is_owned = false;
44906         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
44907 }
44908
44909 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint64_t this_ptr) {
44910         LDKRouteHintHop this_ptr_conv;
44911         this_ptr_conv.inner = untag_ptr(this_ptr);
44912         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44914         this_ptr_conv.is_owned = false;
44915         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
44916         uint64_t ret_ref = 0;
44917         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44918         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44919         return ret_ref;
44920 }
44921
44922 void  __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint64_t this_ptr, uint64_t val) {
44923         LDKRouteHintHop this_ptr_conv;
44924         this_ptr_conv.inner = untag_ptr(this_ptr);
44925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44927         this_ptr_conv.is_owned = false;
44928         LDKRoutingFees val_conv;
44929         val_conv.inner = untag_ptr(val);
44930         val_conv.is_owned = ptr_is_owned(val);
44931         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44932         val_conv = RoutingFees_clone(&val_conv);
44933         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
44934 }
44935
44936 int16_t  __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint64_t this_ptr) {
44937         LDKRouteHintHop this_ptr_conv;
44938         this_ptr_conv.inner = untag_ptr(this_ptr);
44939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44941         this_ptr_conv.is_owned = false;
44942         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
44943         return ret_conv;
44944 }
44945
44946 void  __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
44947         LDKRouteHintHop this_ptr_conv;
44948         this_ptr_conv.inner = untag_ptr(this_ptr);
44949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44951         this_ptr_conv.is_owned = false;
44952         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
44953 }
44954
44955 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint64_t this_ptr) {
44956         LDKRouteHintHop this_ptr_conv;
44957         this_ptr_conv.inner = untag_ptr(this_ptr);
44958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44960         this_ptr_conv.is_owned = false;
44961         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44962         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
44963         uint64_t ret_ref = tag_ptr(ret_copy, true);
44964         return ret_ref;
44965 }
44966
44967 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint64_t this_ptr, uint64_t val) {
44968         LDKRouteHintHop this_ptr_conv;
44969         this_ptr_conv.inner = untag_ptr(this_ptr);
44970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44972         this_ptr_conv.is_owned = false;
44973         void* val_ptr = untag_ptr(val);
44974         CHECK_ACCESS(val_ptr);
44975         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
44976         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
44977         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
44978 }
44979
44980 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint64_t this_ptr) {
44981         LDKRouteHintHop this_ptr_conv;
44982         this_ptr_conv.inner = untag_ptr(this_ptr);
44983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44985         this_ptr_conv.is_owned = false;
44986         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
44987         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
44988         uint64_t ret_ref = tag_ptr(ret_copy, true);
44989         return ret_ref;
44990 }
44991
44992 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint64_t this_ptr, uint64_t val) {
44993         LDKRouteHintHop this_ptr_conv;
44994         this_ptr_conv.inner = untag_ptr(this_ptr);
44995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44997         this_ptr_conv.is_owned = false;
44998         void* val_ptr = untag_ptr(val);
44999         CHECK_ACCESS(val_ptr);
45000         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
45001         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
45002         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
45003 }
45004
45005 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) {
45006         LDKPublicKey src_node_id_arg_ref;
45007         CHECK(src_node_id_arg->arr_len == 33);
45008         memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
45009         LDKRoutingFees fees_arg_conv;
45010         fees_arg_conv.inner = untag_ptr(fees_arg);
45011         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
45012         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
45013         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
45014         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
45015         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
45016         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
45017         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
45018         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
45019         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
45020         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
45021         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
45022         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);
45023         uint64_t ret_ref = 0;
45024         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45025         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45026         return ret_ref;
45027 }
45028
45029 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
45030         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
45031         uint64_t ret_ref = 0;
45032         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45033         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45034         return ret_ref;
45035 }
45036 int64_t  __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint64_t arg) {
45037         LDKRouteHintHop arg_conv;
45038         arg_conv.inner = untag_ptr(arg);
45039         arg_conv.is_owned = ptr_is_owned(arg);
45040         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45041         arg_conv.is_owned = false;
45042         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
45043         return ret_conv;
45044 }
45045
45046 uint64_t  __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint64_t orig) {
45047         LDKRouteHintHop orig_conv;
45048         orig_conv.inner = untag_ptr(orig);
45049         orig_conv.is_owned = ptr_is_owned(orig);
45050         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45051         orig_conv.is_owned = false;
45052         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
45053         uint64_t ret_ref = 0;
45054         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45055         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45056         return ret_ref;
45057 }
45058
45059 int64_t  __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint64_t o) {
45060         LDKRouteHintHop o_conv;
45061         o_conv.inner = untag_ptr(o);
45062         o_conv.is_owned = ptr_is_owned(o);
45063         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45064         o_conv.is_owned = false;
45065         int64_t ret_conv = RouteHintHop_hash(&o_conv);
45066         return ret_conv;
45067 }
45068
45069 jboolean  __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint64_t a, uint64_t b) {
45070         LDKRouteHintHop a_conv;
45071         a_conv.inner = untag_ptr(a);
45072         a_conv.is_owned = ptr_is_owned(a);
45073         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45074         a_conv.is_owned = false;
45075         LDKRouteHintHop b_conv;
45076         b_conv.inner = untag_ptr(b);
45077         b_conv.is_owned = ptr_is_owned(b);
45078         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45079         b_conv.is_owned = false;
45080         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
45081         return ret_conv;
45082 }
45083
45084 int8_tArray  __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint64_t obj) {
45085         LDKRouteHintHop obj_conv;
45086         obj_conv.inner = untag_ptr(obj);
45087         obj_conv.is_owned = ptr_is_owned(obj);
45088         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45089         obj_conv.is_owned = false;
45090         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
45091         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45092         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45093         CVec_u8Z_free(ret_var);
45094         return ret_arr;
45095 }
45096
45097 uint64_t  __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
45098         LDKu8slice ser_ref;
45099         ser_ref.datalen = ser->arr_len;
45100         ser_ref.data = ser->elems;
45101         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
45102         *ret_conv = RouteHintHop_read(ser_ref);
45103         FREE(ser);
45104         return tag_ptr(ret_conv, true);
45105 }
45106
45107 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) {
45108         LDKPublicKey our_node_pubkey_ref;
45109         CHECK(our_node_pubkey->arr_len == 33);
45110         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
45111         LDKRouteParameters route_params_conv;
45112         route_params_conv.inner = untag_ptr(route_params);
45113         route_params_conv.is_owned = ptr_is_owned(route_params);
45114         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
45115         route_params_conv.is_owned = false;
45116         LDKNetworkGraph network_graph_conv;
45117         network_graph_conv.inner = untag_ptr(network_graph);
45118         network_graph_conv.is_owned = ptr_is_owned(network_graph);
45119         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
45120         network_graph_conv.is_owned = false;
45121         LDKCVec_ChannelDetailsZ first_hops_constr;
45122         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
45123         if (first_hops != 0) {
45124                 first_hops_constr.datalen = first_hops->arr_len;
45125                 if (first_hops_constr.datalen > 0)
45126                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
45127                 else
45128                         first_hops_constr.data = NULL;
45129                 uint64_t* first_hops_vals = first_hops->elems;
45130                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
45131                         uint64_t first_hops_conv_16 = first_hops_vals[q];
45132                         LDKChannelDetails first_hops_conv_16_conv;
45133                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
45134                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
45135                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
45136                         first_hops_conv_16_conv.is_owned = false;
45137                         first_hops_constr.data[q] = first_hops_conv_16_conv;
45138                 }
45139                 FREE(first_hops);
45140                 first_hops_ptr = &first_hops_constr;
45141         }
45142         void* logger_ptr = untag_ptr(logger);
45143         CHECK_ACCESS(logger_ptr);
45144         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45145         if (logger_conv.free == LDKLogger_JCalls_free) {
45146                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45147                 LDKLogger_JCalls_cloned(&logger_conv);
45148         }
45149         void* scorer_ptr = untag_ptr(scorer);
45150         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
45151         LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
45152         unsigned char random_seed_bytes_arr[32];
45153         CHECK(random_seed_bytes->arr_len == 32);
45154         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
45155         unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
45156         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
45157         *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);
45158         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
45159         return tag_ptr(ret_conv, true);
45160 }
45161
45162 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) {
45163         LDKPublicKey our_node_pubkey_ref;
45164         CHECK(our_node_pubkey->arr_len == 33);
45165         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
45166         LDKCVec_PublicKeyZ hops_constr;
45167         hops_constr.datalen = hops->arr_len;
45168         if (hops_constr.datalen > 0)
45169                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
45170         else
45171                 hops_constr.data = NULL;
45172         int8_tArray* hops_vals = (void*) hops->elems;
45173         for (size_t m = 0; m < hops_constr.datalen; m++) {
45174                 int8_tArray hops_conv_12 = hops_vals[m];
45175                 LDKPublicKey hops_conv_12_ref;
45176                 CHECK(hops_conv_12->arr_len == 33);
45177                 memcpy(hops_conv_12_ref.compressed_form, hops_conv_12->elems, 33); FREE(hops_conv_12);
45178                 hops_constr.data[m] = hops_conv_12_ref;
45179         }
45180         FREE(hops);
45181         LDKRouteParameters route_params_conv;
45182         route_params_conv.inner = untag_ptr(route_params);
45183         route_params_conv.is_owned = ptr_is_owned(route_params);
45184         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
45185         route_params_conv.is_owned = false;
45186         LDKNetworkGraph network_graph_conv;
45187         network_graph_conv.inner = untag_ptr(network_graph);
45188         network_graph_conv.is_owned = ptr_is_owned(network_graph);
45189         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
45190         network_graph_conv.is_owned = false;
45191         void* logger_ptr = untag_ptr(logger);
45192         CHECK_ACCESS(logger_ptr);
45193         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45194         if (logger_conv.free == LDKLogger_JCalls_free) {
45195                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45196                 LDKLogger_JCalls_cloned(&logger_conv);
45197         }
45198         unsigned char random_seed_bytes_arr[32];
45199         CHECK(random_seed_bytes->arr_len == 32);
45200         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
45201         unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
45202         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
45203         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
45204         return tag_ptr(ret_conv, true);
45205 }
45206
45207 void  __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint64_t this_ptr) {
45208         if (!ptr_is_owned(this_ptr)) return;
45209         void* this_ptr_ptr = untag_ptr(this_ptr);
45210         CHECK_ACCESS(this_ptr_ptr);
45211         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
45212         FREE(untag_ptr(this_ptr));
45213         Score_free(this_ptr_conv);
45214 }
45215
45216 void  __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint64_t this_ptr) {
45217         if (!ptr_is_owned(this_ptr)) return;
45218         void* this_ptr_ptr = untag_ptr(this_ptr);
45219         CHECK_ACCESS(this_ptr_ptr);
45220         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
45221         FREE(untag_ptr(this_ptr));
45222         LockableScore_free(this_ptr_conv);
45223 }
45224
45225 void  __attribute__((export_name("TS_WriteableScore_free"))) TS_WriteableScore_free(uint64_t this_ptr) {
45226         if (!ptr_is_owned(this_ptr)) return;
45227         void* this_ptr_ptr = untag_ptr(this_ptr);
45228         CHECK_ACCESS(this_ptr_ptr);
45229         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
45230         FREE(untag_ptr(this_ptr));
45231         WriteableScore_free(this_ptr_conv);
45232 }
45233
45234 void  __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint64_t this_obj) {
45235         LDKMultiThreadedLockableScore this_obj_conv;
45236         this_obj_conv.inner = untag_ptr(this_obj);
45237         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45239         MultiThreadedLockableScore_free(this_obj_conv);
45240 }
45241
45242 void  __attribute__((export_name("TS_MultiThreadedScoreLock_free"))) TS_MultiThreadedScoreLock_free(uint64_t this_obj) {
45243         LDKMultiThreadedScoreLock this_obj_conv;
45244         this_obj_conv.inner = untag_ptr(this_obj);
45245         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45247         MultiThreadedScoreLock_free(this_obj_conv);
45248 }
45249
45250 uint64_t  __attribute__((export_name("TS_MultiThreadedScoreLock_as_Score"))) TS_MultiThreadedScoreLock_as_Score(uint64_t this_arg) {
45251         LDKMultiThreadedScoreLock this_arg_conv;
45252         this_arg_conv.inner = untag_ptr(this_arg);
45253         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45255         this_arg_conv.is_owned = false;
45256         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
45257         *ret_ret = MultiThreadedScoreLock_as_Score(&this_arg_conv);
45258         return tag_ptr(ret_ret, true);
45259 }
45260
45261 int8_tArray  __attribute__((export_name("TS_MultiThreadedScoreLock_write"))) TS_MultiThreadedScoreLock_write(uint64_t obj) {
45262         LDKMultiThreadedScoreLock obj_conv;
45263         obj_conv.inner = untag_ptr(obj);
45264         obj_conv.is_owned = ptr_is_owned(obj);
45265         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45266         obj_conv.is_owned = false;
45267         LDKCVec_u8Z ret_var = MultiThreadedScoreLock_write(&obj_conv);
45268         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45269         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45270         CVec_u8Z_free(ret_var);
45271         return ret_arr;
45272 }
45273
45274 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_LockableScore"))) TS_MultiThreadedLockableScore_as_LockableScore(uint64_t this_arg) {
45275         LDKMultiThreadedLockableScore this_arg_conv;
45276         this_arg_conv.inner = untag_ptr(this_arg);
45277         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45279         this_arg_conv.is_owned = false;
45280         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
45281         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
45282         return tag_ptr(ret_ret, true);
45283 }
45284
45285 int8_tArray  __attribute__((export_name("TS_MultiThreadedLockableScore_write"))) TS_MultiThreadedLockableScore_write(uint64_t obj) {
45286         LDKMultiThreadedLockableScore obj_conv;
45287         obj_conv.inner = untag_ptr(obj);
45288         obj_conv.is_owned = ptr_is_owned(obj);
45289         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45290         obj_conv.is_owned = false;
45291         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
45292         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45293         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45294         CVec_u8Z_free(ret_var);
45295         return ret_arr;
45296 }
45297
45298 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_WriteableScore"))) TS_MultiThreadedLockableScore_as_WriteableScore(uint64_t this_arg) {
45299         LDKMultiThreadedLockableScore this_arg_conv;
45300         this_arg_conv.inner = untag_ptr(this_arg);
45301         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45303         this_arg_conv.is_owned = false;
45304         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
45305         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
45306         return tag_ptr(ret_ret, true);
45307 }
45308
45309 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint64_t score) {
45310         void* score_ptr = untag_ptr(score);
45311         CHECK_ACCESS(score_ptr);
45312         LDKScore score_conv = *(LDKScore*)(score_ptr);
45313         if (score_conv.free == LDKScore_JCalls_free) {
45314                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45315                 LDKScore_JCalls_cloned(&score_conv);
45316         }
45317         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
45318         uint64_t ret_ref = 0;
45319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45321         return ret_ref;
45322 }
45323
45324 void  __attribute__((export_name("TS_ChannelUsage_free"))) TS_ChannelUsage_free(uint64_t this_obj) {
45325         LDKChannelUsage this_obj_conv;
45326         this_obj_conv.inner = untag_ptr(this_obj);
45327         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45329         ChannelUsage_free(this_obj_conv);
45330 }
45331
45332 int64_t  __attribute__((export_name("TS_ChannelUsage_get_amount_msat"))) TS_ChannelUsage_get_amount_msat(uint64_t this_ptr) {
45333         LDKChannelUsage this_ptr_conv;
45334         this_ptr_conv.inner = untag_ptr(this_ptr);
45335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45337         this_ptr_conv.is_owned = false;
45338         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
45339         return ret_conv;
45340 }
45341
45342 void  __attribute__((export_name("TS_ChannelUsage_set_amount_msat"))) TS_ChannelUsage_set_amount_msat(uint64_t this_ptr, int64_t val) {
45343         LDKChannelUsage this_ptr_conv;
45344         this_ptr_conv.inner = untag_ptr(this_ptr);
45345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45347         this_ptr_conv.is_owned = false;
45348         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
45349 }
45350
45351 int64_t  __attribute__((export_name("TS_ChannelUsage_get_inflight_htlc_msat"))) TS_ChannelUsage_get_inflight_htlc_msat(uint64_t this_ptr) {
45352         LDKChannelUsage this_ptr_conv;
45353         this_ptr_conv.inner = untag_ptr(this_ptr);
45354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45356         this_ptr_conv.is_owned = false;
45357         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
45358         return ret_conv;
45359 }
45360
45361 void  __attribute__((export_name("TS_ChannelUsage_set_inflight_htlc_msat"))) TS_ChannelUsage_set_inflight_htlc_msat(uint64_t this_ptr, int64_t val) {
45362         LDKChannelUsage this_ptr_conv;
45363         this_ptr_conv.inner = untag_ptr(this_ptr);
45364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45366         this_ptr_conv.is_owned = false;
45367         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
45368 }
45369
45370 uint64_t  __attribute__((export_name("TS_ChannelUsage_get_effective_capacity"))) TS_ChannelUsage_get_effective_capacity(uint64_t this_ptr) {
45371         LDKChannelUsage this_ptr_conv;
45372         this_ptr_conv.inner = untag_ptr(this_ptr);
45373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45375         this_ptr_conv.is_owned = false;
45376         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
45377         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
45378         uint64_t ret_ref = tag_ptr(ret_copy, true);
45379         return ret_ref;
45380 }
45381
45382 void  __attribute__((export_name("TS_ChannelUsage_set_effective_capacity"))) TS_ChannelUsage_set_effective_capacity(uint64_t this_ptr, uint64_t val) {
45383         LDKChannelUsage this_ptr_conv;
45384         this_ptr_conv.inner = untag_ptr(this_ptr);
45385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45387         this_ptr_conv.is_owned = false;
45388         void* val_ptr = untag_ptr(val);
45389         CHECK_ACCESS(val_ptr);
45390         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
45391         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
45392         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
45393 }
45394
45395 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) {
45396         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
45397         CHECK_ACCESS(effective_capacity_arg_ptr);
45398         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
45399         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
45400         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
45401         uint64_t ret_ref = 0;
45402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45404         return ret_ref;
45405 }
45406
45407 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
45408         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
45409         uint64_t ret_ref = 0;
45410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45412         return ret_ref;
45413 }
45414 int64_t  __attribute__((export_name("TS_ChannelUsage_clone_ptr"))) TS_ChannelUsage_clone_ptr(uint64_t arg) {
45415         LDKChannelUsage arg_conv;
45416         arg_conv.inner = untag_ptr(arg);
45417         arg_conv.is_owned = ptr_is_owned(arg);
45418         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45419         arg_conv.is_owned = false;
45420         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
45421         return ret_conv;
45422 }
45423
45424 uint64_t  __attribute__((export_name("TS_ChannelUsage_clone"))) TS_ChannelUsage_clone(uint64_t orig) {
45425         LDKChannelUsage orig_conv;
45426         orig_conv.inner = untag_ptr(orig);
45427         orig_conv.is_owned = ptr_is_owned(orig);
45428         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45429         orig_conv.is_owned = false;
45430         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
45431         uint64_t ret_ref = 0;
45432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45434         return ret_ref;
45435 }
45436
45437 void  __attribute__((export_name("TS_FixedPenaltyScorer_free"))) TS_FixedPenaltyScorer_free(uint64_t this_obj) {
45438         LDKFixedPenaltyScorer this_obj_conv;
45439         this_obj_conv.inner = untag_ptr(this_obj);
45440         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45442         FixedPenaltyScorer_free(this_obj_conv);
45443 }
45444
45445 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
45446         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
45447         uint64_t ret_ref = 0;
45448         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45449         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45450         return ret_ref;
45451 }
45452 int64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone_ptr"))) TS_FixedPenaltyScorer_clone_ptr(uint64_t arg) {
45453         LDKFixedPenaltyScorer arg_conv;
45454         arg_conv.inner = untag_ptr(arg);
45455         arg_conv.is_owned = ptr_is_owned(arg);
45456         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45457         arg_conv.is_owned = false;
45458         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
45459         return ret_conv;
45460 }
45461
45462 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone"))) TS_FixedPenaltyScorer_clone(uint64_t orig) {
45463         LDKFixedPenaltyScorer orig_conv;
45464         orig_conv.inner = untag_ptr(orig);
45465         orig_conv.is_owned = ptr_is_owned(orig);
45466         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45467         orig_conv.is_owned = false;
45468         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
45469         uint64_t ret_ref = 0;
45470         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45471         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45472         return ret_ref;
45473 }
45474
45475 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_with_penalty"))) TS_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
45476         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
45477         uint64_t ret_ref = 0;
45478         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45479         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45480         return ret_ref;
45481 }
45482
45483 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_Score"))) TS_FixedPenaltyScorer_as_Score(uint64_t this_arg) {
45484         LDKFixedPenaltyScorer this_arg_conv;
45485         this_arg_conv.inner = untag_ptr(this_arg);
45486         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45488         this_arg_conv.is_owned = false;
45489         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
45490         *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
45491         return tag_ptr(ret_ret, true);
45492 }
45493
45494 int8_tArray  __attribute__((export_name("TS_FixedPenaltyScorer_write"))) TS_FixedPenaltyScorer_write(uint64_t obj) {
45495         LDKFixedPenaltyScorer obj_conv;
45496         obj_conv.inner = untag_ptr(obj);
45497         obj_conv.is_owned = ptr_is_owned(obj);
45498         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45499         obj_conv.is_owned = false;
45500         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
45501         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45502         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45503         CVec_u8Z_free(ret_var);
45504         return ret_arr;
45505 }
45506
45507 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_read"))) TS_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
45508         LDKu8slice ser_ref;
45509         ser_ref.datalen = ser->arr_len;
45510         ser_ref.data = ser->elems;
45511         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
45512         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
45513         FREE(ser);
45514         return tag_ptr(ret_conv, true);
45515 }
45516
45517 void  __attribute__((export_name("TS_ProbabilisticScorer_free"))) TS_ProbabilisticScorer_free(uint64_t this_obj) {
45518         LDKProbabilisticScorer this_obj_conv;
45519         this_obj_conv.inner = untag_ptr(this_obj);
45520         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45522         ProbabilisticScorer_free(this_obj_conv);
45523 }
45524
45525 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_free"))) TS_ProbabilisticScoringParameters_free(uint64_t this_obj) {
45526         LDKProbabilisticScoringParameters this_obj_conv;
45527         this_obj_conv.inner = untag_ptr(this_obj);
45528         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45530         ProbabilisticScoringParameters_free(this_obj_conv);
45531 }
45532
45533 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_base_penalty_msat"))) TS_ProbabilisticScoringParameters_get_base_penalty_msat(uint64_t this_ptr) {
45534         LDKProbabilisticScoringParameters this_ptr_conv;
45535         this_ptr_conv.inner = untag_ptr(this_ptr);
45536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45538         this_ptr_conv.is_owned = false;
45539         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_msat(&this_ptr_conv);
45540         return ret_conv;
45541 }
45542
45543 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_set_base_penalty_msat"))) TS_ProbabilisticScoringParameters_set_base_penalty_msat(uint64_t this_ptr, int64_t val) {
45544         LDKProbabilisticScoringParameters this_ptr_conv;
45545         this_ptr_conv.inner = untag_ptr(this_ptr);
45546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45548         this_ptr_conv.is_owned = false;
45549         ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
45550 }
45551
45552 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) {
45553         LDKProbabilisticScoringParameters this_ptr_conv;
45554         this_ptr_conv.inner = untag_ptr(this_ptr);
45555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45557         this_ptr_conv.is_owned = false;
45558         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
45559         return ret_conv;
45560 }
45561
45562 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) {
45563         LDKProbabilisticScoringParameters this_ptr_conv;
45564         this_ptr_conv.inner = untag_ptr(this_ptr);
45565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45567         this_ptr_conv.is_owned = false;
45568         ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
45569 }
45570
45571 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(uint64_t this_ptr) {
45572         LDKProbabilisticScoringParameters this_ptr_conv;
45573         this_ptr_conv.inner = untag_ptr(this_ptr);
45574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45576         this_ptr_conv.is_owned = false;
45577         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
45578         return ret_conv;
45579 }
45580
45581 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) {
45582         LDKProbabilisticScoringParameters this_ptr_conv;
45583         this_ptr_conv.inner = untag_ptr(this_ptr);
45584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45586         this_ptr_conv.is_owned = false;
45587         ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
45588 }
45589
45590 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life"))) TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life(uint64_t this_ptr) {
45591         LDKProbabilisticScoringParameters this_ptr_conv;
45592         this_ptr_conv.inner = untag_ptr(this_ptr);
45593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45595         this_ptr_conv.is_owned = false;
45596         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
45597         return ret_conv;
45598 }
45599
45600 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) {
45601         LDKProbabilisticScoringParameters this_ptr_conv;
45602         this_ptr_conv.inner = untag_ptr(this_ptr);
45603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45605         this_ptr_conv.is_owned = false;
45606         ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
45607 }
45608
45609 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) {
45610         LDKProbabilisticScoringParameters this_ptr_conv;
45611         this_ptr_conv.inner = untag_ptr(this_ptr);
45612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45614         this_ptr_conv.is_owned = false;
45615         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
45616         return ret_conv;
45617 }
45618
45619 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) {
45620         LDKProbabilisticScoringParameters this_ptr_conv;
45621         this_ptr_conv.inner = untag_ptr(this_ptr);
45622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45624         this_ptr_conv.is_owned = false;
45625         ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
45626 }
45627
45628 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) {
45629         LDKProbabilisticScoringParameters this_ptr_conv;
45630         this_ptr_conv.inner = untag_ptr(this_ptr);
45631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45633         this_ptr_conv.is_owned = false;
45634         int64_t ret_conv = ProbabilisticScoringParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
45635         return ret_conv;
45636 }
45637
45638 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) {
45639         LDKProbabilisticScoringParameters this_ptr_conv;
45640         this_ptr_conv.inner = untag_ptr(this_ptr);
45641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45643         this_ptr_conv.is_owned = false;
45644         ProbabilisticScoringParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
45645 }
45646
45647 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) {
45648         LDKProbabilisticScoringParameters this_ptr_conv;
45649         this_ptr_conv.inner = untag_ptr(this_ptr);
45650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45652         this_ptr_conv.is_owned = false;
45653         int64_t ret_conv = ProbabilisticScoringParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
45654         return ret_conv;
45655 }
45656
45657 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) {
45658         LDKProbabilisticScoringParameters this_ptr_conv;
45659         this_ptr_conv.inner = untag_ptr(this_ptr);
45660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45662         this_ptr_conv.is_owned = false;
45663         ProbabilisticScoringParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
45664 }
45665
45666 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) {
45667         LDKProbabilisticScoringParameters this_ptr_conv;
45668         this_ptr_conv.inner = untag_ptr(this_ptr);
45669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45671         this_ptr_conv.is_owned = false;
45672         int64_t ret_conv = ProbabilisticScoringParameters_get_historical_no_updates_half_life(&this_ptr_conv);
45673         return ret_conv;
45674 }
45675
45676 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) {
45677         LDKProbabilisticScoringParameters this_ptr_conv;
45678         this_ptr_conv.inner = untag_ptr(this_ptr);
45679         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45681         this_ptr_conv.is_owned = false;
45682         ProbabilisticScoringParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
45683 }
45684
45685 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_anti_probing_penalty_msat"))) TS_ProbabilisticScoringParameters_get_anti_probing_penalty_msat(uint64_t this_ptr) {
45686         LDKProbabilisticScoringParameters this_ptr_conv;
45687         this_ptr_conv.inner = untag_ptr(this_ptr);
45688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45690         this_ptr_conv.is_owned = false;
45691         int64_t ret_conv = ProbabilisticScoringParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
45692         return ret_conv;
45693 }
45694
45695 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) {
45696         LDKProbabilisticScoringParameters this_ptr_conv;
45697         this_ptr_conv.inner = untag_ptr(this_ptr);
45698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45700         this_ptr_conv.is_owned = false;
45701         ProbabilisticScoringParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
45702 }
45703
45704 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_considered_impossible_penalty_msat"))) TS_ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(uint64_t this_ptr) {
45705         LDKProbabilisticScoringParameters this_ptr_conv;
45706         this_ptr_conv.inner = untag_ptr(this_ptr);
45707         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45709         this_ptr_conv.is_owned = false;
45710         int64_t ret_conv = ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
45711         return ret_conv;
45712 }
45713
45714 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) {
45715         LDKProbabilisticScoringParameters this_ptr_conv;
45716         this_ptr_conv.inner = untag_ptr(this_ptr);
45717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45719         this_ptr_conv.is_owned = false;
45720         ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
45721 }
45722
45723 static inline uint64_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
45724         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
45725         uint64_t ret_ref = 0;
45726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45728         return ret_ref;
45729 }
45730 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_clone_ptr"))) TS_ProbabilisticScoringParameters_clone_ptr(uint64_t arg) {
45731         LDKProbabilisticScoringParameters arg_conv;
45732         arg_conv.inner = untag_ptr(arg);
45733         arg_conv.is_owned = ptr_is_owned(arg);
45734         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45735         arg_conv.is_owned = false;
45736         int64_t ret_conv = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
45737         return ret_conv;
45738 }
45739
45740 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_clone"))) TS_ProbabilisticScoringParameters_clone(uint64_t orig) {
45741         LDKProbabilisticScoringParameters orig_conv;
45742         orig_conv.inner = untag_ptr(orig);
45743         orig_conv.is_owned = ptr_is_owned(orig);
45744         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45745         orig_conv.is_owned = false;
45746         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
45747         uint64_t ret_ref = 0;
45748         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45749         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45750         return ret_ref;
45751 }
45752
45753 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_new"))) TS_ProbabilisticScorer_new(uint64_t params, uint64_t network_graph, uint64_t logger) {
45754         LDKProbabilisticScoringParameters params_conv;
45755         params_conv.inner = untag_ptr(params);
45756         params_conv.is_owned = ptr_is_owned(params);
45757         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
45758         params_conv = ProbabilisticScoringParameters_clone(&params_conv);
45759         LDKNetworkGraph network_graph_conv;
45760         network_graph_conv.inner = untag_ptr(network_graph);
45761         network_graph_conv.is_owned = ptr_is_owned(network_graph);
45762         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
45763         network_graph_conv.is_owned = false;
45764         void* logger_ptr = untag_ptr(logger);
45765         CHECK_ACCESS(logger_ptr);
45766         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45767         if (logger_conv.free == LDKLogger_JCalls_free) {
45768                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45769                 LDKLogger_JCalls_cloned(&logger_conv);
45770         }
45771         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv, logger_conv);
45772         uint64_t ret_ref = 0;
45773         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45774         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45775         return ret_ref;
45776 }
45777
45778 void  __attribute__((export_name("TS_ProbabilisticScorer_debug_log_liquidity_stats"))) TS_ProbabilisticScorer_debug_log_liquidity_stats(uint64_t this_arg) {
45779         LDKProbabilisticScorer this_arg_conv;
45780         this_arg_conv.inner = untag_ptr(this_arg);
45781         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45783         this_arg_conv.is_owned = false;
45784         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
45785 }
45786
45787 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) {
45788         LDKProbabilisticScorer this_arg_conv;
45789         this_arg_conv.inner = untag_ptr(this_arg);
45790         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45792         this_arg_conv.is_owned = false;
45793         LDKNodeId target_conv;
45794         target_conv.inner = untag_ptr(target);
45795         target_conv.is_owned = ptr_is_owned(target);
45796         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
45797         target_conv.is_owned = false;
45798         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
45799         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
45800         uint64_t ret_ref = tag_ptr(ret_copy, true);
45801         return ret_ref;
45802 }
45803
45804 void  __attribute__((export_name("TS_ProbabilisticScorer_add_banned"))) TS_ProbabilisticScorer_add_banned(uint64_t this_arg, uint64_t node_id) {
45805         LDKProbabilisticScorer this_arg_conv;
45806         this_arg_conv.inner = untag_ptr(this_arg);
45807         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45809         this_arg_conv.is_owned = false;
45810         LDKNodeId node_id_conv;
45811         node_id_conv.inner = untag_ptr(node_id);
45812         node_id_conv.is_owned = ptr_is_owned(node_id);
45813         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
45814         node_id_conv.is_owned = false;
45815         ProbabilisticScorer_add_banned(&this_arg_conv, &node_id_conv);
45816 }
45817
45818 void  __attribute__((export_name("TS_ProbabilisticScorer_remove_banned"))) TS_ProbabilisticScorer_remove_banned(uint64_t this_arg, uint64_t node_id) {
45819         LDKProbabilisticScorer this_arg_conv;
45820         this_arg_conv.inner = untag_ptr(this_arg);
45821         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45823         this_arg_conv.is_owned = false;
45824         LDKNodeId node_id_conv;
45825         node_id_conv.inner = untag_ptr(node_id);
45826         node_id_conv.is_owned = ptr_is_owned(node_id);
45827         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
45828         node_id_conv.is_owned = false;
45829         ProbabilisticScorer_remove_banned(&this_arg_conv, &node_id_conv);
45830 }
45831
45832 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) {
45833         LDKProbabilisticScorer this_arg_conv;
45834         this_arg_conv.inner = untag_ptr(this_arg);
45835         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45837         this_arg_conv.is_owned = false;
45838         LDKNodeId node_id_conv;
45839         node_id_conv.inner = untag_ptr(node_id);
45840         node_id_conv.is_owned = ptr_is_owned(node_id);
45841         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
45842         node_id_conv.is_owned = false;
45843         ProbabilisticScorer_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
45844 }
45845
45846 void  __attribute__((export_name("TS_ProbabilisticScorer_remove_manual_penalty"))) TS_ProbabilisticScorer_remove_manual_penalty(uint64_t this_arg, uint64_t node_id) {
45847         LDKProbabilisticScorer this_arg_conv;
45848         this_arg_conv.inner = untag_ptr(this_arg);
45849         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45851         this_arg_conv.is_owned = false;
45852         LDKNodeId node_id_conv;
45853         node_id_conv.inner = untag_ptr(node_id);
45854         node_id_conv.is_owned = ptr_is_owned(node_id);
45855         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
45856         node_id_conv.is_owned = false;
45857         ProbabilisticScorer_remove_manual_penalty(&this_arg_conv, &node_id_conv);
45858 }
45859
45860 void  __attribute__((export_name("TS_ProbabilisticScorer_clear_manual_penalties"))) TS_ProbabilisticScorer_clear_manual_penalties(uint64_t this_arg) {
45861         LDKProbabilisticScorer this_arg_conv;
45862         this_arg_conv.inner = untag_ptr(this_arg);
45863         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45865         this_arg_conv.is_owned = false;
45866         ProbabilisticScorer_clear_manual_penalties(&this_arg_conv);
45867 }
45868
45869 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_add_banned_from_list"))) TS_ProbabilisticScoringParameters_add_banned_from_list(uint64_t this_arg, uint64_tArray node_ids) {
45870         LDKProbabilisticScoringParameters this_arg_conv;
45871         this_arg_conv.inner = untag_ptr(this_arg);
45872         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45874         this_arg_conv.is_owned = false;
45875         LDKCVec_NodeIdZ node_ids_constr;
45876         node_ids_constr.datalen = node_ids->arr_len;
45877         if (node_ids_constr.datalen > 0)
45878                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
45879         else
45880                 node_ids_constr.data = NULL;
45881         uint64_t* node_ids_vals = node_ids->elems;
45882         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
45883                 uint64_t node_ids_conv_8 = node_ids_vals[i];
45884                 LDKNodeId node_ids_conv_8_conv;
45885                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
45886                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
45887                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
45888                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
45889                 node_ids_constr.data[i] = node_ids_conv_8_conv;
45890         }
45891         FREE(node_ids);
45892         ProbabilisticScoringParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
45893 }
45894
45895 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_default"))) TS_ProbabilisticScoringParameters_default() {
45896         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
45897         uint64_t ret_ref = 0;
45898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45900         return ret_ref;
45901 }
45902
45903 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_Score"))) TS_ProbabilisticScorer_as_Score(uint64_t this_arg) {
45904         LDKProbabilisticScorer this_arg_conv;
45905         this_arg_conv.inner = untag_ptr(this_arg);
45906         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45908         this_arg_conv.is_owned = false;
45909         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
45910         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
45911         return tag_ptr(ret_ret, true);
45912 }
45913
45914 int8_tArray  __attribute__((export_name("TS_ProbabilisticScorer_write"))) TS_ProbabilisticScorer_write(uint64_t obj) {
45915         LDKProbabilisticScorer obj_conv;
45916         obj_conv.inner = untag_ptr(obj);
45917         obj_conv.is_owned = ptr_is_owned(obj);
45918         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45919         obj_conv.is_owned = false;
45920         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
45921         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45922         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45923         CVec_u8Z_free(ret_var);
45924         return ret_arr;
45925 }
45926
45927 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) {
45928         LDKu8slice ser_ref;
45929         ser_ref.datalen = ser->arr_len;
45930         ser_ref.data = ser->elems;
45931         LDKProbabilisticScoringParameters arg_a_conv;
45932         arg_a_conv.inner = untag_ptr(arg_a);
45933         arg_a_conv.is_owned = ptr_is_owned(arg_a);
45934         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
45935         arg_a_conv = ProbabilisticScoringParameters_clone(&arg_a_conv);
45936         LDKNetworkGraph arg_b_conv;
45937         arg_b_conv.inner = untag_ptr(arg_b);
45938         arg_b_conv.is_owned = ptr_is_owned(arg_b);
45939         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
45940         arg_b_conv.is_owned = false;
45941         void* arg_c_ptr = untag_ptr(arg_c);
45942         CHECK_ACCESS(arg_c_ptr);
45943         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
45944         if (arg_c_conv.free == LDKLogger_JCalls_free) {
45945                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45946                 LDKLogger_JCalls_cloned(&arg_c_conv);
45947         }
45948         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
45949         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
45950         FREE(ser);
45951         return tag_ptr(ret_conv, true);
45952 }
45953
45954 void  __attribute__((export_name("TS_BlindedPath_free"))) TS_BlindedPath_free(uint64_t this_obj) {
45955         LDKBlindedPath this_obj_conv;
45956         this_obj_conv.inner = untag_ptr(this_obj);
45957         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45959         BlindedPath_free(this_obj_conv);
45960 }
45961
45962 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
45963         LDKBlindedPath ret_var = BlindedPath_clone(arg);
45964         uint64_t ret_ref = 0;
45965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45967         return ret_ref;
45968 }
45969 int64_t  __attribute__((export_name("TS_BlindedPath_clone_ptr"))) TS_BlindedPath_clone_ptr(uint64_t arg) {
45970         LDKBlindedPath arg_conv;
45971         arg_conv.inner = untag_ptr(arg);
45972         arg_conv.is_owned = ptr_is_owned(arg);
45973         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45974         arg_conv.is_owned = false;
45975         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
45976         return ret_conv;
45977 }
45978
45979 uint64_t  __attribute__((export_name("TS_BlindedPath_clone"))) TS_BlindedPath_clone(uint64_t orig) {
45980         LDKBlindedPath orig_conv;
45981         orig_conv.inner = untag_ptr(orig);
45982         orig_conv.is_owned = ptr_is_owned(orig);
45983         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45984         orig_conv.is_owned = false;
45985         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
45986         uint64_t ret_ref = 0;
45987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45989         return ret_ref;
45990 }
45991
45992 void  __attribute__((export_name("TS_BlindedHop_free"))) TS_BlindedHop_free(uint64_t this_obj) {
45993         LDKBlindedHop this_obj_conv;
45994         this_obj_conv.inner = untag_ptr(this_obj);
45995         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45997         BlindedHop_free(this_obj_conv);
45998 }
45999
46000 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
46001         LDKBlindedHop ret_var = BlindedHop_clone(arg);
46002         uint64_t ret_ref = 0;
46003         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46004         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46005         return ret_ref;
46006 }
46007 int64_t  __attribute__((export_name("TS_BlindedHop_clone_ptr"))) TS_BlindedHop_clone_ptr(uint64_t arg) {
46008         LDKBlindedHop arg_conv;
46009         arg_conv.inner = untag_ptr(arg);
46010         arg_conv.is_owned = ptr_is_owned(arg);
46011         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46012         arg_conv.is_owned = false;
46013         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
46014         return ret_conv;
46015 }
46016
46017 uint64_t  __attribute__((export_name("TS_BlindedHop_clone"))) TS_BlindedHop_clone(uint64_t orig) {
46018         LDKBlindedHop orig_conv;
46019         orig_conv.inner = untag_ptr(orig);
46020         orig_conv.is_owned = ptr_is_owned(orig);
46021         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46022         orig_conv.is_owned = false;
46023         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
46024         uint64_t ret_ref = 0;
46025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46027         return ret_ref;
46028 }
46029
46030 uint64_t  __attribute__((export_name("TS_BlindedPath_new"))) TS_BlindedPath_new(ptrArray node_pks, uint64_t keys_manager) {
46031         LDKCVec_PublicKeyZ node_pks_constr;
46032         node_pks_constr.datalen = node_pks->arr_len;
46033         if (node_pks_constr.datalen > 0)
46034                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
46035         else
46036                 node_pks_constr.data = NULL;
46037         int8_tArray* node_pks_vals = (void*) node_pks->elems;
46038         for (size_t m = 0; m < node_pks_constr.datalen; m++) {
46039                 int8_tArray node_pks_conv_12 = node_pks_vals[m];
46040                 LDKPublicKey node_pks_conv_12_ref;
46041                 CHECK(node_pks_conv_12->arr_len == 33);
46042                 memcpy(node_pks_conv_12_ref.compressed_form, node_pks_conv_12->elems, 33); FREE(node_pks_conv_12);
46043                 node_pks_constr.data[m] = node_pks_conv_12_ref;
46044         }
46045         FREE(node_pks);
46046         void* keys_manager_ptr = untag_ptr(keys_manager);
46047         if (ptr_is_owned(keys_manager)) { CHECK_ACCESS(keys_manager_ptr); }
46048         LDKKeysInterface* keys_manager_conv = (LDKKeysInterface*)keys_manager_ptr;
46049         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
46050         *ret_conv = BlindedPath_new(node_pks_constr, keys_manager_conv);
46051         return tag_ptr(ret_conv, true);
46052 }
46053
46054 int8_tArray  __attribute__((export_name("TS_BlindedPath_write"))) TS_BlindedPath_write(uint64_t obj) {
46055         LDKBlindedPath obj_conv;
46056         obj_conv.inner = untag_ptr(obj);
46057         obj_conv.is_owned = ptr_is_owned(obj);
46058         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46059         obj_conv.is_owned = false;
46060         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
46061         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46062         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46063         CVec_u8Z_free(ret_var);
46064         return ret_arr;
46065 }
46066
46067 uint64_t  __attribute__((export_name("TS_BlindedPath_read"))) TS_BlindedPath_read(int8_tArray ser) {
46068         LDKu8slice ser_ref;
46069         ser_ref.datalen = ser->arr_len;
46070         ser_ref.data = ser->elems;
46071         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
46072         *ret_conv = BlindedPath_read(ser_ref);
46073         FREE(ser);
46074         return tag_ptr(ret_conv, true);
46075 }
46076
46077 int8_tArray  __attribute__((export_name("TS_BlindedHop_write"))) TS_BlindedHop_write(uint64_t obj) {
46078         LDKBlindedHop obj_conv;
46079         obj_conv.inner = untag_ptr(obj);
46080         obj_conv.is_owned = ptr_is_owned(obj);
46081         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46082         obj_conv.is_owned = false;
46083         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
46084         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46085         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46086         CVec_u8Z_free(ret_var);
46087         return ret_arr;
46088 }
46089
46090 uint64_t  __attribute__((export_name("TS_BlindedHop_read"))) TS_BlindedHop_read(int8_tArray ser) {
46091         LDKu8slice ser_ref;
46092         ser_ref.datalen = ser->arr_len;
46093         ser_ref.data = ser->elems;
46094         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
46095         *ret_conv = BlindedHop_read(ser_ref);
46096         FREE(ser);
46097         return tag_ptr(ret_conv, true);
46098 }
46099
46100 void  __attribute__((export_name("TS_OnionMessenger_free"))) TS_OnionMessenger_free(uint64_t this_obj) {
46101         LDKOnionMessenger this_obj_conv;
46102         this_obj_conv.inner = untag_ptr(this_obj);
46103         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46105         OnionMessenger_free(this_obj_conv);
46106 }
46107
46108 void  __attribute__((export_name("TS_Destination_free"))) TS_Destination_free(uint64_t this_ptr) {
46109         if (!ptr_is_owned(this_ptr)) return;
46110         void* this_ptr_ptr = untag_ptr(this_ptr);
46111         CHECK_ACCESS(this_ptr_ptr);
46112         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
46113         FREE(untag_ptr(this_ptr));
46114         Destination_free(this_ptr_conv);
46115 }
46116
46117 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
46118         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
46119         *ret_copy = Destination_clone(arg);
46120         uint64_t ret_ref = tag_ptr(ret_copy, true);
46121         return ret_ref;
46122 }
46123 int64_t  __attribute__((export_name("TS_Destination_clone_ptr"))) TS_Destination_clone_ptr(uint64_t arg) {
46124         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
46125         int64_t ret_conv = Destination_clone_ptr(arg_conv);
46126         return ret_conv;
46127 }
46128
46129 uint64_t  __attribute__((export_name("TS_Destination_clone"))) TS_Destination_clone(uint64_t orig) {
46130         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
46131         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
46132         *ret_copy = Destination_clone(orig_conv);
46133         uint64_t ret_ref = tag_ptr(ret_copy, true);
46134         return ret_ref;
46135 }
46136
46137 uint64_t  __attribute__((export_name("TS_Destination_node"))) TS_Destination_node(int8_tArray a) {
46138         LDKPublicKey a_ref;
46139         CHECK(a->arr_len == 33);
46140         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
46141         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
46142         *ret_copy = Destination_node(a_ref);
46143         uint64_t ret_ref = tag_ptr(ret_copy, true);
46144         return ret_ref;
46145 }
46146
46147 uint64_t  __attribute__((export_name("TS_Destination_blinded_path"))) TS_Destination_blinded_path(uint64_t a) {
46148         LDKBlindedPath a_conv;
46149         a_conv.inner = untag_ptr(a);
46150         a_conv.is_owned = ptr_is_owned(a);
46151         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46152         a_conv = BlindedPath_clone(&a_conv);
46153         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
46154         *ret_copy = Destination_blinded_path(a_conv);
46155         uint64_t ret_ref = tag_ptr(ret_copy, true);
46156         return ret_ref;
46157 }
46158
46159 void  __attribute__((export_name("TS_SendError_free"))) TS_SendError_free(uint64_t this_ptr) {
46160         if (!ptr_is_owned(this_ptr)) return;
46161         void* this_ptr_ptr = untag_ptr(this_ptr);
46162         CHECK_ACCESS(this_ptr_ptr);
46163         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
46164         FREE(untag_ptr(this_ptr));
46165         SendError_free(this_ptr_conv);
46166 }
46167
46168 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
46169         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
46170         *ret_copy = SendError_clone(arg);
46171         uint64_t ret_ref = tag_ptr(ret_copy, true);
46172         return ret_ref;
46173 }
46174 int64_t  __attribute__((export_name("TS_SendError_clone_ptr"))) TS_SendError_clone_ptr(uint64_t arg) {
46175         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
46176         int64_t ret_conv = SendError_clone_ptr(arg_conv);
46177         return ret_conv;
46178 }
46179
46180 uint64_t  __attribute__((export_name("TS_SendError_clone"))) TS_SendError_clone(uint64_t orig) {
46181         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
46182         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
46183         *ret_copy = SendError_clone(orig_conv);
46184         uint64_t ret_ref = tag_ptr(ret_copy, true);
46185         return ret_ref;
46186 }
46187
46188 uint64_t  __attribute__((export_name("TS_SendError_secp256k1"))) TS_SendError_secp256k1(uint32_t a) {
46189         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
46190         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
46191         *ret_copy = SendError_secp256k1(a_conv);
46192         uint64_t ret_ref = tag_ptr(ret_copy, true);
46193         return ret_ref;
46194 }
46195
46196 uint64_t  __attribute__((export_name("TS_SendError_too_big_packet"))) TS_SendError_too_big_packet() {
46197         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
46198         *ret_copy = SendError_too_big_packet();
46199         uint64_t ret_ref = tag_ptr(ret_copy, true);
46200         return ret_ref;
46201 }
46202
46203 uint64_t  __attribute__((export_name("TS_SendError_too_few_blinded_hops"))) TS_SendError_too_few_blinded_hops() {
46204         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
46205         *ret_copy = SendError_too_few_blinded_hops();
46206         uint64_t ret_ref = tag_ptr(ret_copy, true);
46207         return ret_ref;
46208 }
46209
46210 uint64_t  __attribute__((export_name("TS_SendError_invalid_first_hop"))) TS_SendError_invalid_first_hop() {
46211         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
46212         *ret_copy = SendError_invalid_first_hop();
46213         uint64_t ret_ref = tag_ptr(ret_copy, true);
46214         return ret_ref;
46215 }
46216
46217 uint64_t  __attribute__((export_name("TS_SendError_invalid_message"))) TS_SendError_invalid_message() {
46218         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
46219         *ret_copy = SendError_invalid_message();
46220         uint64_t ret_ref = tag_ptr(ret_copy, true);
46221         return ret_ref;
46222 }
46223
46224 uint64_t  __attribute__((export_name("TS_SendError_buffer_full"))) TS_SendError_buffer_full() {
46225         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
46226         *ret_copy = SendError_buffer_full();
46227         uint64_t ret_ref = tag_ptr(ret_copy, true);
46228         return ret_ref;
46229 }
46230
46231 uint64_t  __attribute__((export_name("TS_SendError_get_node_id_failed"))) TS_SendError_get_node_id_failed() {
46232         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
46233         *ret_copy = SendError_get_node_id_failed();
46234         uint64_t ret_ref = tag_ptr(ret_copy, true);
46235         return ret_ref;
46236 }
46237
46238 uint64_t  __attribute__((export_name("TS_SendError_blinded_path_advance_failed"))) TS_SendError_blinded_path_advance_failed() {
46239         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
46240         *ret_copy = SendError_blinded_path_advance_failed();
46241         uint64_t ret_ref = tag_ptr(ret_copy, true);
46242         return ret_ref;
46243 }
46244
46245 jboolean  __attribute__((export_name("TS_SendError_eq"))) TS_SendError_eq(uint64_t a, uint64_t b) {
46246         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
46247         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
46248         jboolean ret_conv = SendError_eq(a_conv, b_conv);
46249         return ret_conv;
46250 }
46251
46252 void  __attribute__((export_name("TS_CustomOnionMessageHandler_free"))) TS_CustomOnionMessageHandler_free(uint64_t this_ptr) {
46253         if (!ptr_is_owned(this_ptr)) return;
46254         void* this_ptr_ptr = untag_ptr(this_ptr);
46255         CHECK_ACCESS(this_ptr_ptr);
46256         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
46257         FREE(untag_ptr(this_ptr));
46258         CustomOnionMessageHandler_free(this_ptr_conv);
46259 }
46260
46261 uint64_t  __attribute__((export_name("TS_OnionMessenger_new"))) TS_OnionMessenger_new(uint64_t keys_manager, uint64_t logger, uint64_t custom_handler) {
46262         void* keys_manager_ptr = untag_ptr(keys_manager);
46263         CHECK_ACCESS(keys_manager_ptr);
46264         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
46265         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
46266                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46267                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
46268         }
46269         void* logger_ptr = untag_ptr(logger);
46270         CHECK_ACCESS(logger_ptr);
46271         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
46272         if (logger_conv.free == LDKLogger_JCalls_free) {
46273                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46274                 LDKLogger_JCalls_cloned(&logger_conv);
46275         }
46276         void* custom_handler_ptr = untag_ptr(custom_handler);
46277         CHECK_ACCESS(custom_handler_ptr);
46278         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
46279         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
46280                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46281                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
46282         }
46283         LDKOnionMessenger ret_var = OnionMessenger_new(keys_manager_conv, logger_conv, custom_handler_conv);
46284         uint64_t ret_ref = 0;
46285         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46286         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46287         return ret_ref;
46288 }
46289
46290 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) {
46291         LDKOnionMessenger this_arg_conv;
46292         this_arg_conv.inner = untag_ptr(this_arg);
46293         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46295         this_arg_conv.is_owned = false;
46296         LDKCVec_PublicKeyZ intermediate_nodes_constr;
46297         intermediate_nodes_constr.datalen = intermediate_nodes->arr_len;
46298         if (intermediate_nodes_constr.datalen > 0)
46299                 intermediate_nodes_constr.data = MALLOC(intermediate_nodes_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
46300         else
46301                 intermediate_nodes_constr.data = NULL;
46302         int8_tArray* intermediate_nodes_vals = (void*) intermediate_nodes->elems;
46303         for (size_t m = 0; m < intermediate_nodes_constr.datalen; m++) {
46304                 int8_tArray intermediate_nodes_conv_12 = intermediate_nodes_vals[m];
46305                 LDKPublicKey intermediate_nodes_conv_12_ref;
46306                 CHECK(intermediate_nodes_conv_12->arr_len == 33);
46307                 memcpy(intermediate_nodes_conv_12_ref.compressed_form, intermediate_nodes_conv_12->elems, 33); FREE(intermediate_nodes_conv_12);
46308                 intermediate_nodes_constr.data[m] = intermediate_nodes_conv_12_ref;
46309         }
46310         FREE(intermediate_nodes);
46311         void* destination_ptr = untag_ptr(destination);
46312         CHECK_ACCESS(destination_ptr);
46313         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
46314         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
46315         void* message_ptr = untag_ptr(message);
46316         CHECK_ACCESS(message_ptr);
46317         LDKOnionMessageContents message_conv = *(LDKOnionMessageContents*)(message_ptr);
46318         message_conv = OnionMessageContents_clone((LDKOnionMessageContents*)untag_ptr(message));
46319         LDKBlindedPath reply_path_conv;
46320         reply_path_conv.inner = untag_ptr(reply_path);
46321         reply_path_conv.is_owned = ptr_is_owned(reply_path);
46322         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
46323         reply_path_conv = BlindedPath_clone(&reply_path_conv);
46324         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
46325         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, intermediate_nodes_constr, destination_conv, message_conv, reply_path_conv);
46326         return tag_ptr(ret_conv, true);
46327 }
46328
46329 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageHandler"))) TS_OnionMessenger_as_OnionMessageHandler(uint64_t this_arg) {
46330         LDKOnionMessenger this_arg_conv;
46331         this_arg_conv.inner = untag_ptr(this_arg);
46332         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46334         this_arg_conv.is_owned = false;
46335         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
46336         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
46337         return tag_ptr(ret_ret, true);
46338 }
46339
46340 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageProvider"))) TS_OnionMessenger_as_OnionMessageProvider(uint64_t this_arg) {
46341         LDKOnionMessenger this_arg_conv;
46342         this_arg_conv.inner = untag_ptr(this_arg);
46343         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46345         this_arg_conv.is_owned = false;
46346         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
46347         *ret_ret = OnionMessenger_as_OnionMessageProvider(&this_arg_conv);
46348         return tag_ptr(ret_ret, true);
46349 }
46350
46351 void  __attribute__((export_name("TS_OnionMessageContents_free"))) TS_OnionMessageContents_free(uint64_t this_ptr) {
46352         if (!ptr_is_owned(this_ptr)) return;
46353         void* this_ptr_ptr = untag_ptr(this_ptr);
46354         CHECK_ACCESS(this_ptr_ptr);
46355         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
46356         FREE(untag_ptr(this_ptr));
46357         OnionMessageContents_free(this_ptr_conv);
46358 }
46359
46360 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
46361         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
46362         *ret_copy = OnionMessageContents_clone(arg);
46363         uint64_t ret_ref = tag_ptr(ret_copy, true);
46364         return ret_ref;
46365 }
46366 int64_t  __attribute__((export_name("TS_OnionMessageContents_clone_ptr"))) TS_OnionMessageContents_clone_ptr(uint64_t arg) {
46367         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)untag_ptr(arg);
46368         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
46369         return ret_conv;
46370 }
46371
46372 uint64_t  __attribute__((export_name("TS_OnionMessageContents_clone"))) TS_OnionMessageContents_clone(uint64_t orig) {
46373         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)untag_ptr(orig);
46374         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
46375         *ret_copy = OnionMessageContents_clone(orig_conv);
46376         uint64_t ret_ref = tag_ptr(ret_copy, true);
46377         return ret_ref;
46378 }
46379
46380 uint64_t  __attribute__((export_name("TS_OnionMessageContents_custom"))) TS_OnionMessageContents_custom(uint64_t a) {
46381         void* a_ptr = untag_ptr(a);
46382         CHECK_ACCESS(a_ptr);
46383         LDKCustomOnionMessageContents a_conv = *(LDKCustomOnionMessageContents*)(a_ptr);
46384         if (a_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
46385                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46386                 LDKCustomOnionMessageContents_JCalls_cloned(&a_conv);
46387         }
46388         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
46389         *ret_copy = OnionMessageContents_custom(a_conv);
46390         uint64_t ret_ref = tag_ptr(ret_copy, true);
46391         return ret_ref;
46392 }
46393
46394 static inline uint64_t CustomOnionMessageContents_clone_ptr(LDKCustomOnionMessageContents *NONNULL_PTR arg) {
46395         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
46396         *ret_ret = CustomOnionMessageContents_clone(arg);
46397         return tag_ptr(ret_ret, true);
46398 }
46399 int64_t  __attribute__((export_name("TS_CustomOnionMessageContents_clone_ptr"))) TS_CustomOnionMessageContents_clone_ptr(uint64_t arg) {
46400         void* arg_ptr = untag_ptr(arg);
46401         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
46402         LDKCustomOnionMessageContents* arg_conv = (LDKCustomOnionMessageContents*)arg_ptr;
46403         int64_t ret_conv = CustomOnionMessageContents_clone_ptr(arg_conv);
46404         return ret_conv;
46405 }
46406
46407 uint64_t  __attribute__((export_name("TS_CustomOnionMessageContents_clone"))) TS_CustomOnionMessageContents_clone(uint64_t orig) {
46408         void* orig_ptr = untag_ptr(orig);
46409         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
46410         LDKCustomOnionMessageContents* orig_conv = (LDKCustomOnionMessageContents*)orig_ptr;
46411         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
46412         *ret_ret = CustomOnionMessageContents_clone(orig_conv);
46413         return tag_ptr(ret_ret, true);
46414 }
46415
46416 void  __attribute__((export_name("TS_CustomOnionMessageContents_free"))) TS_CustomOnionMessageContents_free(uint64_t this_ptr) {
46417         if (!ptr_is_owned(this_ptr)) return;
46418         void* this_ptr_ptr = untag_ptr(this_ptr);
46419         CHECK_ACCESS(this_ptr_ptr);
46420         LDKCustomOnionMessageContents this_ptr_conv = *(LDKCustomOnionMessageContents*)(this_ptr_ptr);
46421         FREE(untag_ptr(this_ptr));
46422         CustomOnionMessageContents_free(this_ptr_conv);
46423 }
46424
46425 void  __attribute__((export_name("TS_RapidGossipSync_free"))) TS_RapidGossipSync_free(uint64_t this_obj) {
46426         LDKRapidGossipSync this_obj_conv;
46427         this_obj_conv.inner = untag_ptr(this_obj);
46428         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46430         RapidGossipSync_free(this_obj_conv);
46431 }
46432
46433 uint64_t  __attribute__((export_name("TS_RapidGossipSync_new"))) TS_RapidGossipSync_new(uint64_t network_graph) {
46434         LDKNetworkGraph network_graph_conv;
46435         network_graph_conv.inner = untag_ptr(network_graph);
46436         network_graph_conv.is_owned = ptr_is_owned(network_graph);
46437         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
46438         network_graph_conv.is_owned = false;
46439         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv);
46440         uint64_t ret_ref = 0;
46441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46443         return ret_ref;
46444 }
46445
46446 uint64_t  __attribute__((export_name("TS_RapidGossipSync_update_network_graph"))) TS_RapidGossipSync_update_network_graph(uint64_t this_arg, int8_tArray update_data) {
46447         LDKRapidGossipSync this_arg_conv;
46448         this_arg_conv.inner = untag_ptr(this_arg);
46449         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46451         this_arg_conv.is_owned = false;
46452         LDKu8slice update_data_ref;
46453         update_data_ref.datalen = update_data->arr_len;
46454         update_data_ref.data = update_data->elems;
46455         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
46456         *ret_conv = RapidGossipSync_update_network_graph(&this_arg_conv, update_data_ref);
46457         FREE(update_data);
46458         return tag_ptr(ret_conv, true);
46459 }
46460
46461 jboolean  __attribute__((export_name("TS_RapidGossipSync_is_initial_sync_complete"))) TS_RapidGossipSync_is_initial_sync_complete(uint64_t this_arg) {
46462         LDKRapidGossipSync this_arg_conv;
46463         this_arg_conv.inner = untag_ptr(this_arg);
46464         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46466         this_arg_conv.is_owned = false;
46467         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
46468         return ret_conv;
46469 }
46470
46471 void  __attribute__((export_name("TS_GraphSyncError_free"))) TS_GraphSyncError_free(uint64_t this_ptr) {
46472         if (!ptr_is_owned(this_ptr)) return;
46473         void* this_ptr_ptr = untag_ptr(this_ptr);
46474         CHECK_ACCESS(this_ptr_ptr);
46475         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
46476         FREE(untag_ptr(this_ptr));
46477         GraphSyncError_free(this_ptr_conv);
46478 }
46479
46480 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
46481         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
46482         *ret_copy = GraphSyncError_clone(arg);
46483         uint64_t ret_ref = tag_ptr(ret_copy, true);
46484         return ret_ref;
46485 }
46486 int64_t  __attribute__((export_name("TS_GraphSyncError_clone_ptr"))) TS_GraphSyncError_clone_ptr(uint64_t arg) {
46487         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
46488         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
46489         return ret_conv;
46490 }
46491
46492 uint64_t  __attribute__((export_name("TS_GraphSyncError_clone"))) TS_GraphSyncError_clone(uint64_t orig) {
46493         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
46494         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
46495         *ret_copy = GraphSyncError_clone(orig_conv);
46496         uint64_t ret_ref = tag_ptr(ret_copy, true);
46497         return ret_ref;
46498 }
46499
46500 uint64_t  __attribute__((export_name("TS_GraphSyncError_decode_error"))) TS_GraphSyncError_decode_error(uint64_t a) {
46501         void* a_ptr = untag_ptr(a);
46502         CHECK_ACCESS(a_ptr);
46503         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
46504         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
46505         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
46506         *ret_copy = GraphSyncError_decode_error(a_conv);
46507         uint64_t ret_ref = tag_ptr(ret_copy, true);
46508         return ret_ref;
46509 }
46510
46511 uint64_t  __attribute__((export_name("TS_GraphSyncError_lightning_error"))) TS_GraphSyncError_lightning_error(uint64_t a) {
46512         LDKLightningError a_conv;
46513         a_conv.inner = untag_ptr(a);
46514         a_conv.is_owned = ptr_is_owned(a);
46515         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46516         a_conv = LightningError_clone(&a_conv);
46517         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
46518         *ret_copy = GraphSyncError_lightning_error(a_conv);
46519         uint64_t ret_ref = tag_ptr(ret_copy, true);
46520         return ret_ref;
46521 }
46522
46523 void  __attribute__((export_name("TS_ParseError_free"))) TS_ParseError_free(uint64_t this_ptr) {
46524         if (!ptr_is_owned(this_ptr)) return;
46525         void* this_ptr_ptr = untag_ptr(this_ptr);
46526         CHECK_ACCESS(this_ptr_ptr);
46527         LDKParseError this_ptr_conv = *(LDKParseError*)(this_ptr_ptr);
46528         FREE(untag_ptr(this_ptr));
46529         ParseError_free(this_ptr_conv);
46530 }
46531
46532 static inline uint64_t ParseError_clone_ptr(LDKParseError *NONNULL_PTR arg) {
46533         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46534         *ret_copy = ParseError_clone(arg);
46535         uint64_t ret_ref = tag_ptr(ret_copy, true);
46536         return ret_ref;
46537 }
46538 int64_t  __attribute__((export_name("TS_ParseError_clone_ptr"))) TS_ParseError_clone_ptr(uint64_t arg) {
46539         LDKParseError* arg_conv = (LDKParseError*)untag_ptr(arg);
46540         int64_t ret_conv = ParseError_clone_ptr(arg_conv);
46541         return ret_conv;
46542 }
46543
46544 uint64_t  __attribute__((export_name("TS_ParseError_clone"))) TS_ParseError_clone(uint64_t orig) {
46545         LDKParseError* orig_conv = (LDKParseError*)untag_ptr(orig);
46546         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46547         *ret_copy = ParseError_clone(orig_conv);
46548         uint64_t ret_ref = tag_ptr(ret_copy, true);
46549         return ret_ref;
46550 }
46551
46552 uint64_t  __attribute__((export_name("TS_ParseError_bech32_error"))) TS_ParseError_bech32_error(uint64_t a) {
46553         void* a_ptr = untag_ptr(a);
46554         CHECK_ACCESS(a_ptr);
46555         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
46556         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
46557         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46558         *ret_copy = ParseError_bech32_error(a_conv);
46559         uint64_t ret_ref = tag_ptr(ret_copy, true);
46560         return ret_ref;
46561 }
46562
46563 uint64_t  __attribute__((export_name("TS_ParseError_parse_amount_error"))) TS_ParseError_parse_amount_error(int32_t a) {
46564         
46565         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46566         *ret_copy = ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
46567         uint64_t ret_ref = tag_ptr(ret_copy, true);
46568         return ret_ref;
46569 }
46570
46571 uint64_t  __attribute__((export_name("TS_ParseError_malformed_signature"))) TS_ParseError_malformed_signature(uint32_t a) {
46572         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
46573         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46574         *ret_copy = ParseError_malformed_signature(a_conv);
46575         uint64_t ret_ref = tag_ptr(ret_copy, true);
46576         return ret_ref;
46577 }
46578
46579 uint64_t  __attribute__((export_name("TS_ParseError_bad_prefix"))) TS_ParseError_bad_prefix() {
46580         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46581         *ret_copy = ParseError_bad_prefix();
46582         uint64_t ret_ref = tag_ptr(ret_copy, true);
46583         return ret_ref;
46584 }
46585
46586 uint64_t  __attribute__((export_name("TS_ParseError_unknown_currency"))) TS_ParseError_unknown_currency() {
46587         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46588         *ret_copy = ParseError_unknown_currency();
46589         uint64_t ret_ref = tag_ptr(ret_copy, true);
46590         return ret_ref;
46591 }
46592
46593 uint64_t  __attribute__((export_name("TS_ParseError_unknown_si_prefix"))) TS_ParseError_unknown_si_prefix() {
46594         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46595         *ret_copy = ParseError_unknown_si_prefix();
46596         uint64_t ret_ref = tag_ptr(ret_copy, true);
46597         return ret_ref;
46598 }
46599
46600 uint64_t  __attribute__((export_name("TS_ParseError_malformed_hrp"))) TS_ParseError_malformed_hrp() {
46601         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46602         *ret_copy = ParseError_malformed_hrp();
46603         uint64_t ret_ref = tag_ptr(ret_copy, true);
46604         return ret_ref;
46605 }
46606
46607 uint64_t  __attribute__((export_name("TS_ParseError_too_short_data_part"))) TS_ParseError_too_short_data_part() {
46608         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46609         *ret_copy = ParseError_too_short_data_part();
46610         uint64_t ret_ref = tag_ptr(ret_copy, true);
46611         return ret_ref;
46612 }
46613
46614 uint64_t  __attribute__((export_name("TS_ParseError_unexpected_end_of_tagged_fields"))) TS_ParseError_unexpected_end_of_tagged_fields() {
46615         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46616         *ret_copy = ParseError_unexpected_end_of_tagged_fields();
46617         uint64_t ret_ref = tag_ptr(ret_copy, true);
46618         return ret_ref;
46619 }
46620
46621 uint64_t  __attribute__((export_name("TS_ParseError_description_decode_error"))) TS_ParseError_description_decode_error(int32_t a) {
46622         
46623         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46624         *ret_copy = ParseError_description_decode_error((LDKError){ ._dummy = 0 });
46625         uint64_t ret_ref = tag_ptr(ret_copy, true);
46626         return ret_ref;
46627 }
46628
46629 uint64_t  __attribute__((export_name("TS_ParseError_padding_error"))) TS_ParseError_padding_error() {
46630         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46631         *ret_copy = ParseError_padding_error();
46632         uint64_t ret_ref = tag_ptr(ret_copy, true);
46633         return ret_ref;
46634 }
46635
46636 uint64_t  __attribute__((export_name("TS_ParseError_integer_overflow_error"))) TS_ParseError_integer_overflow_error() {
46637         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46638         *ret_copy = ParseError_integer_overflow_error();
46639         uint64_t ret_ref = tag_ptr(ret_copy, true);
46640         return ret_ref;
46641 }
46642
46643 uint64_t  __attribute__((export_name("TS_ParseError_invalid_seg_wit_program_length"))) TS_ParseError_invalid_seg_wit_program_length() {
46644         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46645         *ret_copy = ParseError_invalid_seg_wit_program_length();
46646         uint64_t ret_ref = tag_ptr(ret_copy, true);
46647         return ret_ref;
46648 }
46649
46650 uint64_t  __attribute__((export_name("TS_ParseError_invalid_pub_key_hash_length"))) TS_ParseError_invalid_pub_key_hash_length() {
46651         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46652         *ret_copy = ParseError_invalid_pub_key_hash_length();
46653         uint64_t ret_ref = tag_ptr(ret_copy, true);
46654         return ret_ref;
46655 }
46656
46657 uint64_t  __attribute__((export_name("TS_ParseError_invalid_script_hash_length"))) TS_ParseError_invalid_script_hash_length() {
46658         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46659         *ret_copy = ParseError_invalid_script_hash_length();
46660         uint64_t ret_ref = tag_ptr(ret_copy, true);
46661         return ret_ref;
46662 }
46663
46664 uint64_t  __attribute__((export_name("TS_ParseError_invalid_recovery_id"))) TS_ParseError_invalid_recovery_id() {
46665         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46666         *ret_copy = ParseError_invalid_recovery_id();
46667         uint64_t ret_ref = tag_ptr(ret_copy, true);
46668         return ret_ref;
46669 }
46670
46671 uint64_t  __attribute__((export_name("TS_ParseError_invalid_slice_length"))) TS_ParseError_invalid_slice_length(jstring a) {
46672         LDKStr a_conv = str_ref_to_owned_c(a);
46673         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46674         *ret_copy = ParseError_invalid_slice_length(a_conv);
46675         uint64_t ret_ref = tag_ptr(ret_copy, true);
46676         return ret_ref;
46677 }
46678
46679 uint64_t  __attribute__((export_name("TS_ParseError_skip"))) TS_ParseError_skip() {
46680         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
46681         *ret_copy = ParseError_skip();
46682         uint64_t ret_ref = tag_ptr(ret_copy, true);
46683         return ret_ref;
46684 }
46685
46686 jboolean  __attribute__((export_name("TS_ParseError_eq"))) TS_ParseError_eq(uint64_t a, uint64_t b) {
46687         LDKParseError* a_conv = (LDKParseError*)untag_ptr(a);
46688         LDKParseError* b_conv = (LDKParseError*)untag_ptr(b);
46689         jboolean ret_conv = ParseError_eq(a_conv, b_conv);
46690         return ret_conv;
46691 }
46692
46693 void  __attribute__((export_name("TS_ParseOrSemanticError_free"))) TS_ParseOrSemanticError_free(uint64_t this_ptr) {
46694         if (!ptr_is_owned(this_ptr)) return;
46695         void* this_ptr_ptr = untag_ptr(this_ptr);
46696         CHECK_ACCESS(this_ptr_ptr);
46697         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
46698         FREE(untag_ptr(this_ptr));
46699         ParseOrSemanticError_free(this_ptr_conv);
46700 }
46701
46702 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
46703         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
46704         *ret_copy = ParseOrSemanticError_clone(arg);
46705         uint64_t ret_ref = tag_ptr(ret_copy, true);
46706         return ret_ref;
46707 }
46708 int64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone_ptr"))) TS_ParseOrSemanticError_clone_ptr(uint64_t arg) {
46709         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
46710         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
46711         return ret_conv;
46712 }
46713
46714 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone"))) TS_ParseOrSemanticError_clone(uint64_t orig) {
46715         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
46716         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
46717         *ret_copy = ParseOrSemanticError_clone(orig_conv);
46718         uint64_t ret_ref = tag_ptr(ret_copy, true);
46719         return ret_ref;
46720 }
46721
46722 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_parse_error"))) TS_ParseOrSemanticError_parse_error(uint64_t a) {
46723         void* a_ptr = untag_ptr(a);
46724         CHECK_ACCESS(a_ptr);
46725         LDKParseError a_conv = *(LDKParseError*)(a_ptr);
46726         a_conv = ParseError_clone((LDKParseError*)untag_ptr(a));
46727         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
46728         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
46729         uint64_t ret_ref = tag_ptr(ret_copy, true);
46730         return ret_ref;
46731 }
46732
46733 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_semantic_error"))) TS_ParseOrSemanticError_semantic_error(uint32_t a) {
46734         LDKSemanticError a_conv = LDKSemanticError_from_js(a);
46735         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
46736         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
46737         uint64_t ret_ref = tag_ptr(ret_copy, true);
46738         return ret_ref;
46739 }
46740
46741 jboolean  __attribute__((export_name("TS_ParseOrSemanticError_eq"))) TS_ParseOrSemanticError_eq(uint64_t a, uint64_t b) {
46742         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
46743         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
46744         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
46745         return ret_conv;
46746 }
46747
46748 void  __attribute__((export_name("TS_Invoice_free"))) TS_Invoice_free(uint64_t this_obj) {
46749         LDKInvoice this_obj_conv;
46750         this_obj_conv.inner = untag_ptr(this_obj);
46751         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46753         Invoice_free(this_obj_conv);
46754 }
46755
46756 jboolean  __attribute__((export_name("TS_Invoice_eq"))) TS_Invoice_eq(uint64_t a, uint64_t b) {
46757         LDKInvoice a_conv;
46758         a_conv.inner = untag_ptr(a);
46759         a_conv.is_owned = ptr_is_owned(a);
46760         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46761         a_conv.is_owned = false;
46762         LDKInvoice b_conv;
46763         b_conv.inner = untag_ptr(b);
46764         b_conv.is_owned = ptr_is_owned(b);
46765         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46766         b_conv.is_owned = false;
46767         jboolean ret_conv = Invoice_eq(&a_conv, &b_conv);
46768         return ret_conv;
46769 }
46770
46771 static inline uint64_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
46772         LDKInvoice ret_var = Invoice_clone(arg);
46773         uint64_t ret_ref = 0;
46774         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46775         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46776         return ret_ref;
46777 }
46778 int64_t  __attribute__((export_name("TS_Invoice_clone_ptr"))) TS_Invoice_clone_ptr(uint64_t arg) {
46779         LDKInvoice arg_conv;
46780         arg_conv.inner = untag_ptr(arg);
46781         arg_conv.is_owned = ptr_is_owned(arg);
46782         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46783         arg_conv.is_owned = false;
46784         int64_t ret_conv = Invoice_clone_ptr(&arg_conv);
46785         return ret_conv;
46786 }
46787
46788 uint64_t  __attribute__((export_name("TS_Invoice_clone"))) TS_Invoice_clone(uint64_t orig) {
46789         LDKInvoice orig_conv;
46790         orig_conv.inner = untag_ptr(orig);
46791         orig_conv.is_owned = ptr_is_owned(orig);
46792         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46793         orig_conv.is_owned = false;
46794         LDKInvoice ret_var = Invoice_clone(&orig_conv);
46795         uint64_t ret_ref = 0;
46796         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46797         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46798         return ret_ref;
46799 }
46800
46801 int64_t  __attribute__((export_name("TS_Invoice_hash"))) TS_Invoice_hash(uint64_t o) {
46802         LDKInvoice o_conv;
46803         o_conv.inner = untag_ptr(o);
46804         o_conv.is_owned = ptr_is_owned(o);
46805         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46806         o_conv.is_owned = false;
46807         int64_t ret_conv = Invoice_hash(&o_conv);
46808         return ret_conv;
46809 }
46810
46811 void  __attribute__((export_name("TS_SignedRawInvoice_free"))) TS_SignedRawInvoice_free(uint64_t this_obj) {
46812         LDKSignedRawInvoice this_obj_conv;
46813         this_obj_conv.inner = untag_ptr(this_obj);
46814         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46816         SignedRawInvoice_free(this_obj_conv);
46817 }
46818
46819 jboolean  __attribute__((export_name("TS_SignedRawInvoice_eq"))) TS_SignedRawInvoice_eq(uint64_t a, uint64_t b) {
46820         LDKSignedRawInvoice a_conv;
46821         a_conv.inner = untag_ptr(a);
46822         a_conv.is_owned = ptr_is_owned(a);
46823         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46824         a_conv.is_owned = false;
46825         LDKSignedRawInvoice b_conv;
46826         b_conv.inner = untag_ptr(b);
46827         b_conv.is_owned = ptr_is_owned(b);
46828         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46829         b_conv.is_owned = false;
46830         jboolean ret_conv = SignedRawInvoice_eq(&a_conv, &b_conv);
46831         return ret_conv;
46832 }
46833
46834 static inline uint64_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
46835         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
46836         uint64_t ret_ref = 0;
46837         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46838         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46839         return ret_ref;
46840 }
46841 int64_t  __attribute__((export_name("TS_SignedRawInvoice_clone_ptr"))) TS_SignedRawInvoice_clone_ptr(uint64_t arg) {
46842         LDKSignedRawInvoice arg_conv;
46843         arg_conv.inner = untag_ptr(arg);
46844         arg_conv.is_owned = ptr_is_owned(arg);
46845         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46846         arg_conv.is_owned = false;
46847         int64_t ret_conv = SignedRawInvoice_clone_ptr(&arg_conv);
46848         return ret_conv;
46849 }
46850
46851 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_clone"))) TS_SignedRawInvoice_clone(uint64_t orig) {
46852         LDKSignedRawInvoice orig_conv;
46853         orig_conv.inner = untag_ptr(orig);
46854         orig_conv.is_owned = ptr_is_owned(orig);
46855         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46856         orig_conv.is_owned = false;
46857         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
46858         uint64_t ret_ref = 0;
46859         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46860         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46861         return ret_ref;
46862 }
46863
46864 int64_t  __attribute__((export_name("TS_SignedRawInvoice_hash"))) TS_SignedRawInvoice_hash(uint64_t o) {
46865         LDKSignedRawInvoice o_conv;
46866         o_conv.inner = untag_ptr(o);
46867         o_conv.is_owned = ptr_is_owned(o);
46868         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46869         o_conv.is_owned = false;
46870         int64_t ret_conv = SignedRawInvoice_hash(&o_conv);
46871         return ret_conv;
46872 }
46873
46874 void  __attribute__((export_name("TS_RawInvoice_free"))) TS_RawInvoice_free(uint64_t this_obj) {
46875         LDKRawInvoice this_obj_conv;
46876         this_obj_conv.inner = untag_ptr(this_obj);
46877         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46879         RawInvoice_free(this_obj_conv);
46880 }
46881
46882 uint64_t  __attribute__((export_name("TS_RawInvoice_get_data"))) TS_RawInvoice_get_data(uint64_t this_ptr) {
46883         LDKRawInvoice this_ptr_conv;
46884         this_ptr_conv.inner = untag_ptr(this_ptr);
46885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46887         this_ptr_conv.is_owned = false;
46888         LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
46889         uint64_t ret_ref = 0;
46890         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46891         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46892         return ret_ref;
46893 }
46894
46895 void  __attribute__((export_name("TS_RawInvoice_set_data"))) TS_RawInvoice_set_data(uint64_t this_ptr, uint64_t val) {
46896         LDKRawInvoice this_ptr_conv;
46897         this_ptr_conv.inner = untag_ptr(this_ptr);
46898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46900         this_ptr_conv.is_owned = false;
46901         LDKRawDataPart val_conv;
46902         val_conv.inner = untag_ptr(val);
46903         val_conv.is_owned = ptr_is_owned(val);
46904         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46905         val_conv = RawDataPart_clone(&val_conv);
46906         RawInvoice_set_data(&this_ptr_conv, val_conv);
46907 }
46908
46909 jboolean  __attribute__((export_name("TS_RawInvoice_eq"))) TS_RawInvoice_eq(uint64_t a, uint64_t b) {
46910         LDKRawInvoice a_conv;
46911         a_conv.inner = untag_ptr(a);
46912         a_conv.is_owned = ptr_is_owned(a);
46913         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46914         a_conv.is_owned = false;
46915         LDKRawInvoice b_conv;
46916         b_conv.inner = untag_ptr(b);
46917         b_conv.is_owned = ptr_is_owned(b);
46918         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46919         b_conv.is_owned = false;
46920         jboolean ret_conv = RawInvoice_eq(&a_conv, &b_conv);
46921         return ret_conv;
46922 }
46923
46924 static inline uint64_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
46925         LDKRawInvoice ret_var = RawInvoice_clone(arg);
46926         uint64_t ret_ref = 0;
46927         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46928         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46929         return ret_ref;
46930 }
46931 int64_t  __attribute__((export_name("TS_RawInvoice_clone_ptr"))) TS_RawInvoice_clone_ptr(uint64_t arg) {
46932         LDKRawInvoice arg_conv;
46933         arg_conv.inner = untag_ptr(arg);
46934         arg_conv.is_owned = ptr_is_owned(arg);
46935         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46936         arg_conv.is_owned = false;
46937         int64_t ret_conv = RawInvoice_clone_ptr(&arg_conv);
46938         return ret_conv;
46939 }
46940
46941 uint64_t  __attribute__((export_name("TS_RawInvoice_clone"))) TS_RawInvoice_clone(uint64_t orig) {
46942         LDKRawInvoice orig_conv;
46943         orig_conv.inner = untag_ptr(orig);
46944         orig_conv.is_owned = ptr_is_owned(orig);
46945         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46946         orig_conv.is_owned = false;
46947         LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
46948         uint64_t ret_ref = 0;
46949         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46950         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46951         return ret_ref;
46952 }
46953
46954 int64_t  __attribute__((export_name("TS_RawInvoice_hash"))) TS_RawInvoice_hash(uint64_t o) {
46955         LDKRawInvoice o_conv;
46956         o_conv.inner = untag_ptr(o);
46957         o_conv.is_owned = ptr_is_owned(o);
46958         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46959         o_conv.is_owned = false;
46960         int64_t ret_conv = RawInvoice_hash(&o_conv);
46961         return ret_conv;
46962 }
46963
46964 void  __attribute__((export_name("TS_RawDataPart_free"))) TS_RawDataPart_free(uint64_t this_obj) {
46965         LDKRawDataPart this_obj_conv;
46966         this_obj_conv.inner = untag_ptr(this_obj);
46967         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46969         RawDataPart_free(this_obj_conv);
46970 }
46971
46972 uint64_t  __attribute__((export_name("TS_RawDataPart_get_timestamp"))) TS_RawDataPart_get_timestamp(uint64_t this_ptr) {
46973         LDKRawDataPart this_ptr_conv;
46974         this_ptr_conv.inner = untag_ptr(this_ptr);
46975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46977         this_ptr_conv.is_owned = false;
46978         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
46979         uint64_t ret_ref = 0;
46980         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46981         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46982         return ret_ref;
46983 }
46984
46985 void  __attribute__((export_name("TS_RawDataPart_set_timestamp"))) TS_RawDataPart_set_timestamp(uint64_t this_ptr, uint64_t val) {
46986         LDKRawDataPart this_ptr_conv;
46987         this_ptr_conv.inner = untag_ptr(this_ptr);
46988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46990         this_ptr_conv.is_owned = false;
46991         LDKPositiveTimestamp val_conv;
46992         val_conv.inner = untag_ptr(val);
46993         val_conv.is_owned = ptr_is_owned(val);
46994         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46995         val_conv = PositiveTimestamp_clone(&val_conv);
46996         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
46997 }
46998
46999 jboolean  __attribute__((export_name("TS_RawDataPart_eq"))) TS_RawDataPart_eq(uint64_t a, uint64_t b) {
47000         LDKRawDataPart a_conv;
47001         a_conv.inner = untag_ptr(a);
47002         a_conv.is_owned = ptr_is_owned(a);
47003         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47004         a_conv.is_owned = false;
47005         LDKRawDataPart b_conv;
47006         b_conv.inner = untag_ptr(b);
47007         b_conv.is_owned = ptr_is_owned(b);
47008         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47009         b_conv.is_owned = false;
47010         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
47011         return ret_conv;
47012 }
47013
47014 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
47015         LDKRawDataPart ret_var = RawDataPart_clone(arg);
47016         uint64_t ret_ref = 0;
47017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47019         return ret_ref;
47020 }
47021 int64_t  __attribute__((export_name("TS_RawDataPart_clone_ptr"))) TS_RawDataPart_clone_ptr(uint64_t arg) {
47022         LDKRawDataPart arg_conv;
47023         arg_conv.inner = untag_ptr(arg);
47024         arg_conv.is_owned = ptr_is_owned(arg);
47025         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47026         arg_conv.is_owned = false;
47027         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
47028         return ret_conv;
47029 }
47030
47031 uint64_t  __attribute__((export_name("TS_RawDataPart_clone"))) TS_RawDataPart_clone(uint64_t orig) {
47032         LDKRawDataPart orig_conv;
47033         orig_conv.inner = untag_ptr(orig);
47034         orig_conv.is_owned = ptr_is_owned(orig);
47035         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47036         orig_conv.is_owned = false;
47037         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
47038         uint64_t ret_ref = 0;
47039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47041         return ret_ref;
47042 }
47043
47044 int64_t  __attribute__((export_name("TS_RawDataPart_hash"))) TS_RawDataPart_hash(uint64_t o) {
47045         LDKRawDataPart o_conv;
47046         o_conv.inner = untag_ptr(o);
47047         o_conv.is_owned = ptr_is_owned(o);
47048         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47049         o_conv.is_owned = false;
47050         int64_t ret_conv = RawDataPart_hash(&o_conv);
47051         return ret_conv;
47052 }
47053
47054 void  __attribute__((export_name("TS_PositiveTimestamp_free"))) TS_PositiveTimestamp_free(uint64_t this_obj) {
47055         LDKPositiveTimestamp this_obj_conv;
47056         this_obj_conv.inner = untag_ptr(this_obj);
47057         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47059         PositiveTimestamp_free(this_obj_conv);
47060 }
47061
47062 jboolean  __attribute__((export_name("TS_PositiveTimestamp_eq"))) TS_PositiveTimestamp_eq(uint64_t a, uint64_t b) {
47063         LDKPositiveTimestamp a_conv;
47064         a_conv.inner = untag_ptr(a);
47065         a_conv.is_owned = ptr_is_owned(a);
47066         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47067         a_conv.is_owned = false;
47068         LDKPositiveTimestamp b_conv;
47069         b_conv.inner = untag_ptr(b);
47070         b_conv.is_owned = ptr_is_owned(b);
47071         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47072         b_conv.is_owned = false;
47073         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
47074         return ret_conv;
47075 }
47076
47077 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
47078         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
47079         uint64_t ret_ref = 0;
47080         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47081         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47082         return ret_ref;
47083 }
47084 int64_t  __attribute__((export_name("TS_PositiveTimestamp_clone_ptr"))) TS_PositiveTimestamp_clone_ptr(uint64_t arg) {
47085         LDKPositiveTimestamp arg_conv;
47086         arg_conv.inner = untag_ptr(arg);
47087         arg_conv.is_owned = ptr_is_owned(arg);
47088         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47089         arg_conv.is_owned = false;
47090         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
47091         return ret_conv;
47092 }
47093
47094 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_clone"))) TS_PositiveTimestamp_clone(uint64_t orig) {
47095         LDKPositiveTimestamp orig_conv;
47096         orig_conv.inner = untag_ptr(orig);
47097         orig_conv.is_owned = ptr_is_owned(orig);
47098         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47099         orig_conv.is_owned = false;
47100         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
47101         uint64_t ret_ref = 0;
47102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47104         return ret_ref;
47105 }
47106
47107 int64_t  __attribute__((export_name("TS_PositiveTimestamp_hash"))) TS_PositiveTimestamp_hash(uint64_t o) {
47108         LDKPositiveTimestamp o_conv;
47109         o_conv.inner = untag_ptr(o);
47110         o_conv.is_owned = ptr_is_owned(o);
47111         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47112         o_conv.is_owned = false;
47113         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
47114         return ret_conv;
47115 }
47116
47117 uint32_t  __attribute__((export_name("TS_SiPrefix_clone"))) TS_SiPrefix_clone(uint64_t orig) {
47118         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
47119         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
47120         return ret_conv;
47121 }
47122
47123 uint32_t  __attribute__((export_name("TS_SiPrefix_milli"))) TS_SiPrefix_milli() {
47124         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
47125         return ret_conv;
47126 }
47127
47128 uint32_t  __attribute__((export_name("TS_SiPrefix_micro"))) TS_SiPrefix_micro() {
47129         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
47130         return ret_conv;
47131 }
47132
47133 uint32_t  __attribute__((export_name("TS_SiPrefix_nano"))) TS_SiPrefix_nano() {
47134         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
47135         return ret_conv;
47136 }
47137
47138 uint32_t  __attribute__((export_name("TS_SiPrefix_pico"))) TS_SiPrefix_pico() {
47139         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
47140         return ret_conv;
47141 }
47142
47143 jboolean  __attribute__((export_name("TS_SiPrefix_eq"))) TS_SiPrefix_eq(uint64_t a, uint64_t b) {
47144         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
47145         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
47146         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
47147         return ret_conv;
47148 }
47149
47150 int64_t  __attribute__((export_name("TS_SiPrefix_hash"))) TS_SiPrefix_hash(uint64_t o) {
47151         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
47152         int64_t ret_conv = SiPrefix_hash(o_conv);
47153         return ret_conv;
47154 }
47155
47156 int64_t  __attribute__((export_name("TS_SiPrefix_multiplier"))) TS_SiPrefix_multiplier(uint64_t this_arg) {
47157         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
47158         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
47159         return ret_conv;
47160 }
47161
47162 uint32_t  __attribute__((export_name("TS_Currency_clone"))) TS_Currency_clone(uint64_t orig) {
47163         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
47164         uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
47165         return ret_conv;
47166 }
47167
47168 uint32_t  __attribute__((export_name("TS_Currency_bitcoin"))) TS_Currency_bitcoin() {
47169         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
47170         return ret_conv;
47171 }
47172
47173 uint32_t  __attribute__((export_name("TS_Currency_bitcoin_testnet"))) TS_Currency_bitcoin_testnet() {
47174         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
47175         return ret_conv;
47176 }
47177
47178 uint32_t  __attribute__((export_name("TS_Currency_regtest"))) TS_Currency_regtest() {
47179         uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
47180         return ret_conv;
47181 }
47182
47183 uint32_t  __attribute__((export_name("TS_Currency_simnet"))) TS_Currency_simnet() {
47184         uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
47185         return ret_conv;
47186 }
47187
47188 uint32_t  __attribute__((export_name("TS_Currency_signet"))) TS_Currency_signet() {
47189         uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
47190         return ret_conv;
47191 }
47192
47193 int64_t  __attribute__((export_name("TS_Currency_hash"))) TS_Currency_hash(uint64_t o) {
47194         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
47195         int64_t ret_conv = Currency_hash(o_conv);
47196         return ret_conv;
47197 }
47198
47199 jboolean  __attribute__((export_name("TS_Currency_eq"))) TS_Currency_eq(uint64_t a, uint64_t b) {
47200         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
47201         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
47202         jboolean ret_conv = Currency_eq(a_conv, b_conv);
47203         return ret_conv;
47204 }
47205
47206 void  __attribute__((export_name("TS_Sha256_free"))) TS_Sha256_free(uint64_t this_obj) {
47207         LDKSha256 this_obj_conv;
47208         this_obj_conv.inner = untag_ptr(this_obj);
47209         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47211         Sha256_free(this_obj_conv);
47212 }
47213
47214 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
47215         LDKSha256 ret_var = Sha256_clone(arg);
47216         uint64_t ret_ref = 0;
47217         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47218         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47219         return ret_ref;
47220 }
47221 int64_t  __attribute__((export_name("TS_Sha256_clone_ptr"))) TS_Sha256_clone_ptr(uint64_t arg) {
47222         LDKSha256 arg_conv;
47223         arg_conv.inner = untag_ptr(arg);
47224         arg_conv.is_owned = ptr_is_owned(arg);
47225         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47226         arg_conv.is_owned = false;
47227         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
47228         return ret_conv;
47229 }
47230
47231 uint64_t  __attribute__((export_name("TS_Sha256_clone"))) TS_Sha256_clone(uint64_t orig) {
47232         LDKSha256 orig_conv;
47233         orig_conv.inner = untag_ptr(orig);
47234         orig_conv.is_owned = ptr_is_owned(orig);
47235         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47236         orig_conv.is_owned = false;
47237         LDKSha256 ret_var = Sha256_clone(&orig_conv);
47238         uint64_t ret_ref = 0;
47239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47241         return ret_ref;
47242 }
47243
47244 int64_t  __attribute__((export_name("TS_Sha256_hash"))) TS_Sha256_hash(uint64_t o) {
47245         LDKSha256 o_conv;
47246         o_conv.inner = untag_ptr(o);
47247         o_conv.is_owned = ptr_is_owned(o);
47248         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47249         o_conv.is_owned = false;
47250         int64_t ret_conv = Sha256_hash(&o_conv);
47251         return ret_conv;
47252 }
47253
47254 jboolean  __attribute__((export_name("TS_Sha256_eq"))) TS_Sha256_eq(uint64_t a, uint64_t b) {
47255         LDKSha256 a_conv;
47256         a_conv.inner = untag_ptr(a);
47257         a_conv.is_owned = ptr_is_owned(a);
47258         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47259         a_conv.is_owned = false;
47260         LDKSha256 b_conv;
47261         b_conv.inner = untag_ptr(b);
47262         b_conv.is_owned = ptr_is_owned(b);
47263         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47264         b_conv.is_owned = false;
47265         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
47266         return ret_conv;
47267 }
47268
47269 void  __attribute__((export_name("TS_Description_free"))) TS_Description_free(uint64_t this_obj) {
47270         LDKDescription this_obj_conv;
47271         this_obj_conv.inner = untag_ptr(this_obj);
47272         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47274         Description_free(this_obj_conv);
47275 }
47276
47277 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
47278         LDKDescription ret_var = Description_clone(arg);
47279         uint64_t ret_ref = 0;
47280         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47281         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47282         return ret_ref;
47283 }
47284 int64_t  __attribute__((export_name("TS_Description_clone_ptr"))) TS_Description_clone_ptr(uint64_t arg) {
47285         LDKDescription arg_conv;
47286         arg_conv.inner = untag_ptr(arg);
47287         arg_conv.is_owned = ptr_is_owned(arg);
47288         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47289         arg_conv.is_owned = false;
47290         int64_t ret_conv = Description_clone_ptr(&arg_conv);
47291         return ret_conv;
47292 }
47293
47294 uint64_t  __attribute__((export_name("TS_Description_clone"))) TS_Description_clone(uint64_t orig) {
47295         LDKDescription orig_conv;
47296         orig_conv.inner = untag_ptr(orig);
47297         orig_conv.is_owned = ptr_is_owned(orig);
47298         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47299         orig_conv.is_owned = false;
47300         LDKDescription ret_var = Description_clone(&orig_conv);
47301         uint64_t ret_ref = 0;
47302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47304         return ret_ref;
47305 }
47306
47307 int64_t  __attribute__((export_name("TS_Description_hash"))) TS_Description_hash(uint64_t o) {
47308         LDKDescription o_conv;
47309         o_conv.inner = untag_ptr(o);
47310         o_conv.is_owned = ptr_is_owned(o);
47311         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47312         o_conv.is_owned = false;
47313         int64_t ret_conv = Description_hash(&o_conv);
47314         return ret_conv;
47315 }
47316
47317 jboolean  __attribute__((export_name("TS_Description_eq"))) TS_Description_eq(uint64_t a, uint64_t b) {
47318         LDKDescription a_conv;
47319         a_conv.inner = untag_ptr(a);
47320         a_conv.is_owned = ptr_is_owned(a);
47321         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47322         a_conv.is_owned = false;
47323         LDKDescription b_conv;
47324         b_conv.inner = untag_ptr(b);
47325         b_conv.is_owned = ptr_is_owned(b);
47326         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47327         b_conv.is_owned = false;
47328         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
47329         return ret_conv;
47330 }
47331
47332 void  __attribute__((export_name("TS_PayeePubKey_free"))) TS_PayeePubKey_free(uint64_t this_obj) {
47333         LDKPayeePubKey this_obj_conv;
47334         this_obj_conv.inner = untag_ptr(this_obj);
47335         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47337         PayeePubKey_free(this_obj_conv);
47338 }
47339
47340 int8_tArray  __attribute__((export_name("TS_PayeePubKey_get_a"))) TS_PayeePubKey_get_a(uint64_t this_ptr) {
47341         LDKPayeePubKey this_ptr_conv;
47342         this_ptr_conv.inner = untag_ptr(this_ptr);
47343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47345         this_ptr_conv.is_owned = false;
47346         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
47347         memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
47348         return ret_arr;
47349 }
47350
47351 void  __attribute__((export_name("TS_PayeePubKey_set_a"))) TS_PayeePubKey_set_a(uint64_t this_ptr, int8_tArray val) {
47352         LDKPayeePubKey this_ptr_conv;
47353         this_ptr_conv.inner = untag_ptr(this_ptr);
47354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47356         this_ptr_conv.is_owned = false;
47357         LDKPublicKey val_ref;
47358         CHECK(val->arr_len == 33);
47359         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
47360         PayeePubKey_set_a(&this_ptr_conv, val_ref);
47361 }
47362
47363 uint64_t  __attribute__((export_name("TS_PayeePubKey_new"))) TS_PayeePubKey_new(int8_tArray a_arg) {
47364         LDKPublicKey a_arg_ref;
47365         CHECK(a_arg->arr_len == 33);
47366         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
47367         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
47368         uint64_t ret_ref = 0;
47369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47371         return ret_ref;
47372 }
47373
47374 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
47375         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
47376         uint64_t ret_ref = 0;
47377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47379         return ret_ref;
47380 }
47381 int64_t  __attribute__((export_name("TS_PayeePubKey_clone_ptr"))) TS_PayeePubKey_clone_ptr(uint64_t arg) {
47382         LDKPayeePubKey arg_conv;
47383         arg_conv.inner = untag_ptr(arg);
47384         arg_conv.is_owned = ptr_is_owned(arg);
47385         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47386         arg_conv.is_owned = false;
47387         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
47388         return ret_conv;
47389 }
47390
47391 uint64_t  __attribute__((export_name("TS_PayeePubKey_clone"))) TS_PayeePubKey_clone(uint64_t orig) {
47392         LDKPayeePubKey orig_conv;
47393         orig_conv.inner = untag_ptr(orig);
47394         orig_conv.is_owned = ptr_is_owned(orig);
47395         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47396         orig_conv.is_owned = false;
47397         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
47398         uint64_t ret_ref = 0;
47399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47401         return ret_ref;
47402 }
47403
47404 int64_t  __attribute__((export_name("TS_PayeePubKey_hash"))) TS_PayeePubKey_hash(uint64_t o) {
47405         LDKPayeePubKey o_conv;
47406         o_conv.inner = untag_ptr(o);
47407         o_conv.is_owned = ptr_is_owned(o);
47408         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47409         o_conv.is_owned = false;
47410         int64_t ret_conv = PayeePubKey_hash(&o_conv);
47411         return ret_conv;
47412 }
47413
47414 jboolean  __attribute__((export_name("TS_PayeePubKey_eq"))) TS_PayeePubKey_eq(uint64_t a, uint64_t b) {
47415         LDKPayeePubKey a_conv;
47416         a_conv.inner = untag_ptr(a);
47417         a_conv.is_owned = ptr_is_owned(a);
47418         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47419         a_conv.is_owned = false;
47420         LDKPayeePubKey b_conv;
47421         b_conv.inner = untag_ptr(b);
47422         b_conv.is_owned = ptr_is_owned(b);
47423         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47424         b_conv.is_owned = false;
47425         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
47426         return ret_conv;
47427 }
47428
47429 void  __attribute__((export_name("TS_ExpiryTime_free"))) TS_ExpiryTime_free(uint64_t this_obj) {
47430         LDKExpiryTime this_obj_conv;
47431         this_obj_conv.inner = untag_ptr(this_obj);
47432         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47434         ExpiryTime_free(this_obj_conv);
47435 }
47436
47437 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
47438         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
47439         uint64_t ret_ref = 0;
47440         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47441         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47442         return ret_ref;
47443 }
47444 int64_t  __attribute__((export_name("TS_ExpiryTime_clone_ptr"))) TS_ExpiryTime_clone_ptr(uint64_t arg) {
47445         LDKExpiryTime arg_conv;
47446         arg_conv.inner = untag_ptr(arg);
47447         arg_conv.is_owned = ptr_is_owned(arg);
47448         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47449         arg_conv.is_owned = false;
47450         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
47451         return ret_conv;
47452 }
47453
47454 uint64_t  __attribute__((export_name("TS_ExpiryTime_clone"))) TS_ExpiryTime_clone(uint64_t orig) {
47455         LDKExpiryTime orig_conv;
47456         orig_conv.inner = untag_ptr(orig);
47457         orig_conv.is_owned = ptr_is_owned(orig);
47458         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47459         orig_conv.is_owned = false;
47460         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
47461         uint64_t ret_ref = 0;
47462         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47463         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47464         return ret_ref;
47465 }
47466
47467 int64_t  __attribute__((export_name("TS_ExpiryTime_hash"))) TS_ExpiryTime_hash(uint64_t o) {
47468         LDKExpiryTime o_conv;
47469         o_conv.inner = untag_ptr(o);
47470         o_conv.is_owned = ptr_is_owned(o);
47471         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47472         o_conv.is_owned = false;
47473         int64_t ret_conv = ExpiryTime_hash(&o_conv);
47474         return ret_conv;
47475 }
47476
47477 jboolean  __attribute__((export_name("TS_ExpiryTime_eq"))) TS_ExpiryTime_eq(uint64_t a, uint64_t b) {
47478         LDKExpiryTime a_conv;
47479         a_conv.inner = untag_ptr(a);
47480         a_conv.is_owned = ptr_is_owned(a);
47481         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47482         a_conv.is_owned = false;
47483         LDKExpiryTime b_conv;
47484         b_conv.inner = untag_ptr(b);
47485         b_conv.is_owned = ptr_is_owned(b);
47486         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47487         b_conv.is_owned = false;
47488         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
47489         return ret_conv;
47490 }
47491
47492 void  __attribute__((export_name("TS_MinFinalCltvExpiry_free"))) TS_MinFinalCltvExpiry_free(uint64_t this_obj) {
47493         LDKMinFinalCltvExpiry this_obj_conv;
47494         this_obj_conv.inner = untag_ptr(this_obj);
47495         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47497         MinFinalCltvExpiry_free(this_obj_conv);
47498 }
47499
47500 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_get_a"))) TS_MinFinalCltvExpiry_get_a(uint64_t this_ptr) {
47501         LDKMinFinalCltvExpiry this_ptr_conv;
47502         this_ptr_conv.inner = untag_ptr(this_ptr);
47503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47505         this_ptr_conv.is_owned = false;
47506         int64_t ret_conv = MinFinalCltvExpiry_get_a(&this_ptr_conv);
47507         return ret_conv;
47508 }
47509
47510 void  __attribute__((export_name("TS_MinFinalCltvExpiry_set_a"))) TS_MinFinalCltvExpiry_set_a(uint64_t this_ptr, int64_t val) {
47511         LDKMinFinalCltvExpiry this_ptr_conv;
47512         this_ptr_conv.inner = untag_ptr(this_ptr);
47513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47515         this_ptr_conv.is_owned = false;
47516         MinFinalCltvExpiry_set_a(&this_ptr_conv, val);
47517 }
47518
47519 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_new"))) TS_MinFinalCltvExpiry_new(int64_t a_arg) {
47520         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg);
47521         uint64_t ret_ref = 0;
47522         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47523         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47524         return ret_ref;
47525 }
47526
47527 static inline uint64_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) {
47528         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(arg);
47529         uint64_t ret_ref = 0;
47530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47532         return ret_ref;
47533 }
47534 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_clone_ptr"))) TS_MinFinalCltvExpiry_clone_ptr(uint64_t arg) {
47535         LDKMinFinalCltvExpiry arg_conv;
47536         arg_conv.inner = untag_ptr(arg);
47537         arg_conv.is_owned = ptr_is_owned(arg);
47538         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47539         arg_conv.is_owned = false;
47540         int64_t ret_conv = MinFinalCltvExpiry_clone_ptr(&arg_conv);
47541         return ret_conv;
47542 }
47543
47544 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_clone"))) TS_MinFinalCltvExpiry_clone(uint64_t orig) {
47545         LDKMinFinalCltvExpiry orig_conv;
47546         orig_conv.inner = untag_ptr(orig);
47547         orig_conv.is_owned = ptr_is_owned(orig);
47548         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47549         orig_conv.is_owned = false;
47550         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
47551         uint64_t ret_ref = 0;
47552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47554         return ret_ref;
47555 }
47556
47557 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_hash"))) TS_MinFinalCltvExpiry_hash(uint64_t o) {
47558         LDKMinFinalCltvExpiry o_conv;
47559         o_conv.inner = untag_ptr(o);
47560         o_conv.is_owned = ptr_is_owned(o);
47561         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47562         o_conv.is_owned = false;
47563         int64_t ret_conv = MinFinalCltvExpiry_hash(&o_conv);
47564         return ret_conv;
47565 }
47566
47567 jboolean  __attribute__((export_name("TS_MinFinalCltvExpiry_eq"))) TS_MinFinalCltvExpiry_eq(uint64_t a, uint64_t b) {
47568         LDKMinFinalCltvExpiry a_conv;
47569         a_conv.inner = untag_ptr(a);
47570         a_conv.is_owned = ptr_is_owned(a);
47571         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47572         a_conv.is_owned = false;
47573         LDKMinFinalCltvExpiry b_conv;
47574         b_conv.inner = untag_ptr(b);
47575         b_conv.is_owned = ptr_is_owned(b);
47576         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47577         b_conv.is_owned = false;
47578         jboolean ret_conv = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
47579         return ret_conv;
47580 }
47581
47582 void  __attribute__((export_name("TS_Fallback_free"))) TS_Fallback_free(uint64_t this_ptr) {
47583         if (!ptr_is_owned(this_ptr)) return;
47584         void* this_ptr_ptr = untag_ptr(this_ptr);
47585         CHECK_ACCESS(this_ptr_ptr);
47586         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
47587         FREE(untag_ptr(this_ptr));
47588         Fallback_free(this_ptr_conv);
47589 }
47590
47591 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
47592         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
47593         *ret_copy = Fallback_clone(arg);
47594         uint64_t ret_ref = tag_ptr(ret_copy, true);
47595         return ret_ref;
47596 }
47597 int64_t  __attribute__((export_name("TS_Fallback_clone_ptr"))) TS_Fallback_clone_ptr(uint64_t arg) {
47598         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
47599         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
47600         return ret_conv;
47601 }
47602
47603 uint64_t  __attribute__((export_name("TS_Fallback_clone"))) TS_Fallback_clone(uint64_t orig) {
47604         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
47605         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
47606         *ret_copy = Fallback_clone(orig_conv);
47607         uint64_t ret_ref = tag_ptr(ret_copy, true);
47608         return ret_ref;
47609 }
47610
47611 uint64_t  __attribute__((export_name("TS_Fallback_seg_wit_program"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
47612         
47613         LDKCVec_u8Z program_ref;
47614         program_ref.datalen = program->arr_len;
47615         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
47616         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
47617         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
47618         *ret_copy = Fallback_seg_wit_program((LDKU5){ ._0 = version }, program_ref);
47619         uint64_t ret_ref = tag_ptr(ret_copy, true);
47620         return ret_ref;
47621 }
47622
47623 uint64_t  __attribute__((export_name("TS_Fallback_pub_key_hash"))) TS_Fallback_pub_key_hash(int8_tArray a) {
47624         LDKTwentyBytes a_ref;
47625         CHECK(a->arr_len == 20);
47626         memcpy(a_ref.data, a->elems, 20); FREE(a);
47627         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
47628         *ret_copy = Fallback_pub_key_hash(a_ref);
47629         uint64_t ret_ref = tag_ptr(ret_copy, true);
47630         return ret_ref;
47631 }
47632
47633 uint64_t  __attribute__((export_name("TS_Fallback_script_hash"))) TS_Fallback_script_hash(int8_tArray a) {
47634         LDKTwentyBytes a_ref;
47635         CHECK(a->arr_len == 20);
47636         memcpy(a_ref.data, a->elems, 20); FREE(a);
47637         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
47638         *ret_copy = Fallback_script_hash(a_ref);
47639         uint64_t ret_ref = tag_ptr(ret_copy, true);
47640         return ret_ref;
47641 }
47642
47643 int64_t  __attribute__((export_name("TS_Fallback_hash"))) TS_Fallback_hash(uint64_t o) {
47644         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
47645         int64_t ret_conv = Fallback_hash(o_conv);
47646         return ret_conv;
47647 }
47648
47649 jboolean  __attribute__((export_name("TS_Fallback_eq"))) TS_Fallback_eq(uint64_t a, uint64_t b) {
47650         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
47651         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
47652         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
47653         return ret_conv;
47654 }
47655
47656 void  __attribute__((export_name("TS_InvoiceSignature_free"))) TS_InvoiceSignature_free(uint64_t this_obj) {
47657         LDKInvoiceSignature this_obj_conv;
47658         this_obj_conv.inner = untag_ptr(this_obj);
47659         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47661         InvoiceSignature_free(this_obj_conv);
47662 }
47663
47664 static inline uint64_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
47665         LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
47666         uint64_t ret_ref = 0;
47667         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47668         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47669         return ret_ref;
47670 }
47671 int64_t  __attribute__((export_name("TS_InvoiceSignature_clone_ptr"))) TS_InvoiceSignature_clone_ptr(uint64_t arg) {
47672         LDKInvoiceSignature arg_conv;
47673         arg_conv.inner = untag_ptr(arg);
47674         arg_conv.is_owned = ptr_is_owned(arg);
47675         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47676         arg_conv.is_owned = false;
47677         int64_t ret_conv = InvoiceSignature_clone_ptr(&arg_conv);
47678         return ret_conv;
47679 }
47680
47681 uint64_t  __attribute__((export_name("TS_InvoiceSignature_clone"))) TS_InvoiceSignature_clone(uint64_t orig) {
47682         LDKInvoiceSignature orig_conv;
47683         orig_conv.inner = untag_ptr(orig);
47684         orig_conv.is_owned = ptr_is_owned(orig);
47685         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47686         orig_conv.is_owned = false;
47687         LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
47688         uint64_t ret_ref = 0;
47689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47691         return ret_ref;
47692 }
47693
47694 int64_t  __attribute__((export_name("TS_InvoiceSignature_hash"))) TS_InvoiceSignature_hash(uint64_t o) {
47695         LDKInvoiceSignature o_conv;
47696         o_conv.inner = untag_ptr(o);
47697         o_conv.is_owned = ptr_is_owned(o);
47698         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47699         o_conv.is_owned = false;
47700         int64_t ret_conv = InvoiceSignature_hash(&o_conv);
47701         return ret_conv;
47702 }
47703
47704 jboolean  __attribute__((export_name("TS_InvoiceSignature_eq"))) TS_InvoiceSignature_eq(uint64_t a, uint64_t b) {
47705         LDKInvoiceSignature a_conv;
47706         a_conv.inner = untag_ptr(a);
47707         a_conv.is_owned = ptr_is_owned(a);
47708         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47709         a_conv.is_owned = false;
47710         LDKInvoiceSignature b_conv;
47711         b_conv.inner = untag_ptr(b);
47712         b_conv.is_owned = ptr_is_owned(b);
47713         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47714         b_conv.is_owned = false;
47715         jboolean ret_conv = InvoiceSignature_eq(&a_conv, &b_conv);
47716         return ret_conv;
47717 }
47718
47719 void  __attribute__((export_name("TS_PrivateRoute_free"))) TS_PrivateRoute_free(uint64_t this_obj) {
47720         LDKPrivateRoute this_obj_conv;
47721         this_obj_conv.inner = untag_ptr(this_obj);
47722         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47724         PrivateRoute_free(this_obj_conv);
47725 }
47726
47727 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
47728         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
47729         uint64_t ret_ref = 0;
47730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47732         return ret_ref;
47733 }
47734 int64_t  __attribute__((export_name("TS_PrivateRoute_clone_ptr"))) TS_PrivateRoute_clone_ptr(uint64_t arg) {
47735         LDKPrivateRoute arg_conv;
47736         arg_conv.inner = untag_ptr(arg);
47737         arg_conv.is_owned = ptr_is_owned(arg);
47738         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47739         arg_conv.is_owned = false;
47740         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
47741         return ret_conv;
47742 }
47743
47744 uint64_t  __attribute__((export_name("TS_PrivateRoute_clone"))) TS_PrivateRoute_clone(uint64_t orig) {
47745         LDKPrivateRoute orig_conv;
47746         orig_conv.inner = untag_ptr(orig);
47747         orig_conv.is_owned = ptr_is_owned(orig);
47748         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47749         orig_conv.is_owned = false;
47750         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
47751         uint64_t ret_ref = 0;
47752         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47753         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47754         return ret_ref;
47755 }
47756
47757 int64_t  __attribute__((export_name("TS_PrivateRoute_hash"))) TS_PrivateRoute_hash(uint64_t o) {
47758         LDKPrivateRoute o_conv;
47759         o_conv.inner = untag_ptr(o);
47760         o_conv.is_owned = ptr_is_owned(o);
47761         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
47762         o_conv.is_owned = false;
47763         int64_t ret_conv = PrivateRoute_hash(&o_conv);
47764         return ret_conv;
47765 }
47766
47767 jboolean  __attribute__((export_name("TS_PrivateRoute_eq"))) TS_PrivateRoute_eq(uint64_t a, uint64_t b) {
47768         LDKPrivateRoute a_conv;
47769         a_conv.inner = untag_ptr(a);
47770         a_conv.is_owned = ptr_is_owned(a);
47771         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
47772         a_conv.is_owned = false;
47773         LDKPrivateRoute b_conv;
47774         b_conv.inner = untag_ptr(b);
47775         b_conv.is_owned = ptr_is_owned(b);
47776         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
47777         b_conv.is_owned = false;
47778         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
47779         return ret_conv;
47780 }
47781
47782 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_into_parts"))) TS_SignedRawInvoice_into_parts(uint64_t this_arg) {
47783         LDKSignedRawInvoice this_arg_conv;
47784         this_arg_conv.inner = untag_ptr(this_arg);
47785         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47787         this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
47788         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
47789         *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
47790         return tag_ptr(ret_conv, true);
47791 }
47792
47793 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_raw_invoice"))) TS_SignedRawInvoice_raw_invoice(uint64_t this_arg) {
47794         LDKSignedRawInvoice this_arg_conv;
47795         this_arg_conv.inner = untag_ptr(this_arg);
47796         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47798         this_arg_conv.is_owned = false;
47799         LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
47800         uint64_t ret_ref = 0;
47801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47803         return ret_ref;
47804 }
47805
47806 int8_tArray  __attribute__((export_name("TS_SignedRawInvoice_signable_hash"))) TS_SignedRawInvoice_signable_hash(uint64_t this_arg) {
47807         LDKSignedRawInvoice this_arg_conv;
47808         this_arg_conv.inner = untag_ptr(this_arg);
47809         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47811         this_arg_conv.is_owned = false;
47812         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47813         memcpy(ret_arr->elems, *SignedRawInvoice_signable_hash(&this_arg_conv), 32);
47814         return ret_arr;
47815 }
47816
47817 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_signature"))) TS_SignedRawInvoice_signature(uint64_t this_arg) {
47818         LDKSignedRawInvoice this_arg_conv;
47819         this_arg_conv.inner = untag_ptr(this_arg);
47820         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47822         this_arg_conv.is_owned = false;
47823         LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
47824         uint64_t ret_ref = 0;
47825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47827         return ret_ref;
47828 }
47829
47830 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_recover_payee_pub_key"))) TS_SignedRawInvoice_recover_payee_pub_key(uint64_t this_arg) {
47831         LDKSignedRawInvoice this_arg_conv;
47832         this_arg_conv.inner = untag_ptr(this_arg);
47833         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47835         this_arg_conv.is_owned = false;
47836         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
47837         *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
47838         return tag_ptr(ret_conv, true);
47839 }
47840
47841 jboolean  __attribute__((export_name("TS_SignedRawInvoice_check_signature"))) TS_SignedRawInvoice_check_signature(uint64_t this_arg) {
47842         LDKSignedRawInvoice this_arg_conv;
47843         this_arg_conv.inner = untag_ptr(this_arg);
47844         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47846         this_arg_conv.is_owned = false;
47847         jboolean ret_conv = SignedRawInvoice_check_signature(&this_arg_conv);
47848         return ret_conv;
47849 }
47850
47851 int8_tArray  __attribute__((export_name("TS_RawInvoice_signable_hash"))) TS_RawInvoice_signable_hash(uint64_t this_arg) {
47852         LDKRawInvoice this_arg_conv;
47853         this_arg_conv.inner = untag_ptr(this_arg);
47854         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47856         this_arg_conv.is_owned = false;
47857         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47858         memcpy(ret_arr->elems, RawInvoice_signable_hash(&this_arg_conv).data, 32);
47859         return ret_arr;
47860 }
47861
47862 uint64_t  __attribute__((export_name("TS_RawInvoice_payment_hash"))) TS_RawInvoice_payment_hash(uint64_t this_arg) {
47863         LDKRawInvoice this_arg_conv;
47864         this_arg_conv.inner = untag_ptr(this_arg);
47865         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47866         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47867         this_arg_conv.is_owned = false;
47868         LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
47869         uint64_t ret_ref = 0;
47870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47872         return ret_ref;
47873 }
47874
47875 uint64_t  __attribute__((export_name("TS_RawInvoice_description"))) TS_RawInvoice_description(uint64_t this_arg) {
47876         LDKRawInvoice this_arg_conv;
47877         this_arg_conv.inner = untag_ptr(this_arg);
47878         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47880         this_arg_conv.is_owned = false;
47881         LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
47882         uint64_t ret_ref = 0;
47883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47885         return ret_ref;
47886 }
47887
47888 uint64_t  __attribute__((export_name("TS_RawInvoice_payee_pub_key"))) TS_RawInvoice_payee_pub_key(uint64_t this_arg) {
47889         LDKRawInvoice this_arg_conv;
47890         this_arg_conv.inner = untag_ptr(this_arg);
47891         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47893         this_arg_conv.is_owned = false;
47894         LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
47895         uint64_t ret_ref = 0;
47896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47898         return ret_ref;
47899 }
47900
47901 uint64_t  __attribute__((export_name("TS_RawInvoice_description_hash"))) TS_RawInvoice_description_hash(uint64_t this_arg) {
47902         LDKRawInvoice this_arg_conv;
47903         this_arg_conv.inner = untag_ptr(this_arg);
47904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47906         this_arg_conv.is_owned = false;
47907         LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
47908         uint64_t ret_ref = 0;
47909         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47910         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47911         return ret_ref;
47912 }
47913
47914 uint64_t  __attribute__((export_name("TS_RawInvoice_expiry_time"))) TS_RawInvoice_expiry_time(uint64_t this_arg) {
47915         LDKRawInvoice this_arg_conv;
47916         this_arg_conv.inner = untag_ptr(this_arg);
47917         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47919         this_arg_conv.is_owned = false;
47920         LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
47921         uint64_t ret_ref = 0;
47922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47924         return ret_ref;
47925 }
47926
47927 uint64_t  __attribute__((export_name("TS_RawInvoice_min_final_cltv_expiry"))) TS_RawInvoice_min_final_cltv_expiry(uint64_t this_arg) {
47928         LDKRawInvoice this_arg_conv;
47929         this_arg_conv.inner = untag_ptr(this_arg);
47930         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47932         this_arg_conv.is_owned = false;
47933         LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
47934         uint64_t ret_ref = 0;
47935         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47936         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47937         return ret_ref;
47938 }
47939
47940 int8_tArray  __attribute__((export_name("TS_RawInvoice_payment_secret"))) TS_RawInvoice_payment_secret(uint64_t this_arg) {
47941         LDKRawInvoice this_arg_conv;
47942         this_arg_conv.inner = untag_ptr(this_arg);
47943         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47945         this_arg_conv.is_owned = false;
47946         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
47947         memcpy(ret_arr->elems, RawInvoice_payment_secret(&this_arg_conv).data, 32);
47948         return ret_arr;
47949 }
47950
47951 uint64_t  __attribute__((export_name("TS_RawInvoice_features"))) TS_RawInvoice_features(uint64_t this_arg) {
47952         LDKRawInvoice this_arg_conv;
47953         this_arg_conv.inner = untag_ptr(this_arg);
47954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47956         this_arg_conv.is_owned = false;
47957         LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
47958         uint64_t ret_ref = 0;
47959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47961         return ret_ref;
47962 }
47963
47964 uint64_tArray  __attribute__((export_name("TS_RawInvoice_private_routes"))) TS_RawInvoice_private_routes(uint64_t this_arg) {
47965         LDKRawInvoice this_arg_conv;
47966         this_arg_conv.inner = untag_ptr(this_arg);
47967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47969         this_arg_conv.is_owned = false;
47970         LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
47971         uint64_tArray ret_arr = NULL;
47972         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
47973         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
47974         for (size_t o = 0; o < ret_var.datalen; o++) {
47975                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
47976                 uint64_t ret_conv_14_ref = 0;
47977                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
47978                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
47979                 ret_arr_ptr[o] = ret_conv_14_ref;
47980         }
47981         
47982         FREE(ret_var.data);
47983         return ret_arr;
47984 }
47985
47986 uint64_t  __attribute__((export_name("TS_RawInvoice_amount_pico_btc"))) TS_RawInvoice_amount_pico_btc(uint64_t this_arg) {
47987         LDKRawInvoice this_arg_conv;
47988         this_arg_conv.inner = untag_ptr(this_arg);
47989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47991         this_arg_conv.is_owned = false;
47992         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47993         *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
47994         uint64_t ret_ref = tag_ptr(ret_copy, true);
47995         return ret_ref;
47996 }
47997
47998 uint32_t  __attribute__((export_name("TS_RawInvoice_currency"))) TS_RawInvoice_currency(uint64_t this_arg) {
47999         LDKRawInvoice this_arg_conv;
48000         this_arg_conv.inner = untag_ptr(this_arg);
48001         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48003         this_arg_conv.is_owned = false;
48004         uint32_t ret_conv = LDKCurrency_to_js(RawInvoice_currency(&this_arg_conv));
48005         return ret_conv;
48006 }
48007
48008 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_unix_timestamp"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
48009         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
48010         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
48011         return tag_ptr(ret_conv, true);
48012 }
48013
48014 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_duration_since_epoch"))) TS_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
48015         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
48016         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
48017         return tag_ptr(ret_conv, true);
48018 }
48019
48020 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_unix_timestamp"))) TS_PositiveTimestamp_as_unix_timestamp(uint64_t this_arg) {
48021         LDKPositiveTimestamp this_arg_conv;
48022         this_arg_conv.inner = untag_ptr(this_arg);
48023         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48025         this_arg_conv.is_owned = false;
48026         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
48027         return ret_conv;
48028 }
48029
48030 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_duration_since_epoch"))) TS_PositiveTimestamp_as_duration_since_epoch(uint64_t this_arg) {
48031         LDKPositiveTimestamp this_arg_conv;
48032         this_arg_conv.inner = untag_ptr(this_arg);
48033         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48035         this_arg_conv.is_owned = false;
48036         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
48037         return ret_conv;
48038 }
48039
48040 uint64_t  __attribute__((export_name("TS_Invoice_into_signed_raw"))) TS_Invoice_into_signed_raw(uint64_t this_arg) {
48041         LDKInvoice this_arg_conv;
48042         this_arg_conv.inner = untag_ptr(this_arg);
48043         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48045         this_arg_conv = Invoice_clone(&this_arg_conv);
48046         LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
48047         uint64_t ret_ref = 0;
48048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48050         return ret_ref;
48051 }
48052
48053 uint64_t  __attribute__((export_name("TS_Invoice_check_signature"))) TS_Invoice_check_signature(uint64_t this_arg) {
48054         LDKInvoice this_arg_conv;
48055         this_arg_conv.inner = untag_ptr(this_arg);
48056         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48058         this_arg_conv.is_owned = false;
48059         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
48060         *ret_conv = Invoice_check_signature(&this_arg_conv);
48061         return tag_ptr(ret_conv, true);
48062 }
48063
48064 uint64_t  __attribute__((export_name("TS_Invoice_from_signed"))) TS_Invoice_from_signed(uint64_t signed_invoice) {
48065         LDKSignedRawInvoice signed_invoice_conv;
48066         signed_invoice_conv.inner = untag_ptr(signed_invoice);
48067         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
48068         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
48069         signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
48070         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
48071         *ret_conv = Invoice_from_signed(signed_invoice_conv);
48072         return tag_ptr(ret_conv, true);
48073 }
48074
48075 int64_t  __attribute__((export_name("TS_Invoice_duration_since_epoch"))) TS_Invoice_duration_since_epoch(uint64_t this_arg) {
48076         LDKInvoice this_arg_conv;
48077         this_arg_conv.inner = untag_ptr(this_arg);
48078         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48080         this_arg_conv.is_owned = false;
48081         int64_t ret_conv = Invoice_duration_since_epoch(&this_arg_conv);
48082         return ret_conv;
48083 }
48084
48085 int8_tArray  __attribute__((export_name("TS_Invoice_payment_hash"))) TS_Invoice_payment_hash(uint64_t this_arg) {
48086         LDKInvoice this_arg_conv;
48087         this_arg_conv.inner = untag_ptr(this_arg);
48088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48090         this_arg_conv.is_owned = false;
48091         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
48092         memcpy(ret_arr->elems, *Invoice_payment_hash(&this_arg_conv), 32);
48093         return ret_arr;
48094 }
48095
48096 int8_tArray  __attribute__((export_name("TS_Invoice_payee_pub_key"))) TS_Invoice_payee_pub_key(uint64_t this_arg) {
48097         LDKInvoice this_arg_conv;
48098         this_arg_conv.inner = untag_ptr(this_arg);
48099         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48101         this_arg_conv.is_owned = false;
48102         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
48103         memcpy(ret_arr->elems, Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
48104         return ret_arr;
48105 }
48106
48107 int8_tArray  __attribute__((export_name("TS_Invoice_payment_secret"))) TS_Invoice_payment_secret(uint64_t this_arg) {
48108         LDKInvoice this_arg_conv;
48109         this_arg_conv.inner = untag_ptr(this_arg);
48110         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48112         this_arg_conv.is_owned = false;
48113         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
48114         memcpy(ret_arr->elems, *Invoice_payment_secret(&this_arg_conv), 32);
48115         return ret_arr;
48116 }
48117
48118 uint64_t  __attribute__((export_name("TS_Invoice_features"))) TS_Invoice_features(uint64_t this_arg) {
48119         LDKInvoice this_arg_conv;
48120         this_arg_conv.inner = untag_ptr(this_arg);
48121         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48123         this_arg_conv.is_owned = false;
48124         LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
48125         uint64_t ret_ref = 0;
48126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48128         return ret_ref;
48129 }
48130
48131 int8_tArray  __attribute__((export_name("TS_Invoice_recover_payee_pub_key"))) TS_Invoice_recover_payee_pub_key(uint64_t this_arg) {
48132         LDKInvoice this_arg_conv;
48133         this_arg_conv.inner = untag_ptr(this_arg);
48134         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48136         this_arg_conv.is_owned = false;
48137         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
48138         memcpy(ret_arr->elems, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
48139         return ret_arr;
48140 }
48141
48142 int64_t  __attribute__((export_name("TS_Invoice_expiry_time"))) TS_Invoice_expiry_time(uint64_t this_arg) {
48143         LDKInvoice this_arg_conv;
48144         this_arg_conv.inner = untag_ptr(this_arg);
48145         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48147         this_arg_conv.is_owned = false;
48148         int64_t ret_conv = Invoice_expiry_time(&this_arg_conv);
48149         return ret_conv;
48150 }
48151
48152 jboolean  __attribute__((export_name("TS_Invoice_would_expire"))) TS_Invoice_would_expire(uint64_t this_arg, int64_t at_time) {
48153         LDKInvoice this_arg_conv;
48154         this_arg_conv.inner = untag_ptr(this_arg);
48155         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48157         this_arg_conv.is_owned = false;
48158         jboolean ret_conv = Invoice_would_expire(&this_arg_conv, at_time);
48159         return ret_conv;
48160 }
48161
48162 int64_t  __attribute__((export_name("TS_Invoice_min_final_cltv_expiry"))) TS_Invoice_min_final_cltv_expiry(uint64_t this_arg) {
48163         LDKInvoice this_arg_conv;
48164         this_arg_conv.inner = untag_ptr(this_arg);
48165         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48167         this_arg_conv.is_owned = false;
48168         int64_t ret_conv = Invoice_min_final_cltv_expiry(&this_arg_conv);
48169         return ret_conv;
48170 }
48171
48172 uint64_tArray  __attribute__((export_name("TS_Invoice_private_routes"))) TS_Invoice_private_routes(uint64_t this_arg) {
48173         LDKInvoice this_arg_conv;
48174         this_arg_conv.inner = untag_ptr(this_arg);
48175         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48177         this_arg_conv.is_owned = false;
48178         LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
48179         uint64_tArray ret_arr = NULL;
48180         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
48181         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
48182         for (size_t o = 0; o < ret_var.datalen; o++) {
48183                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
48184                 uint64_t ret_conv_14_ref = 0;
48185                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
48186                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
48187                 ret_arr_ptr[o] = ret_conv_14_ref;
48188         }
48189         
48190         FREE(ret_var.data);
48191         return ret_arr;
48192 }
48193
48194 uint64_tArray  __attribute__((export_name("TS_Invoice_route_hints"))) TS_Invoice_route_hints(uint64_t this_arg) {
48195         LDKInvoice this_arg_conv;
48196         this_arg_conv.inner = untag_ptr(this_arg);
48197         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48199         this_arg_conv.is_owned = false;
48200         LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
48201         uint64_tArray ret_arr = NULL;
48202         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
48203         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
48204         for (size_t l = 0; l < ret_var.datalen; l++) {
48205                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
48206                 uint64_t ret_conv_11_ref = 0;
48207                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
48208                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
48209                 ret_arr_ptr[l] = ret_conv_11_ref;
48210         }
48211         
48212         FREE(ret_var.data);
48213         return ret_arr;
48214 }
48215
48216 uint32_t  __attribute__((export_name("TS_Invoice_currency"))) TS_Invoice_currency(uint64_t this_arg) {
48217         LDKInvoice this_arg_conv;
48218         this_arg_conv.inner = untag_ptr(this_arg);
48219         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48221         this_arg_conv.is_owned = false;
48222         uint32_t ret_conv = LDKCurrency_to_js(Invoice_currency(&this_arg_conv));
48223         return ret_conv;
48224 }
48225
48226 uint64_t  __attribute__((export_name("TS_Invoice_amount_milli_satoshis"))) TS_Invoice_amount_milli_satoshis(uint64_t this_arg) {
48227         LDKInvoice this_arg_conv;
48228         this_arg_conv.inner = untag_ptr(this_arg);
48229         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48231         this_arg_conv.is_owned = false;
48232         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
48233         *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
48234         uint64_t ret_ref = tag_ptr(ret_copy, true);
48235         return ret_ref;
48236 }
48237
48238 uint64_t  __attribute__((export_name("TS_Description_new"))) TS_Description_new(jstring description) {
48239         LDKStr description_conv = str_ref_to_owned_c(description);
48240         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
48241         *ret_conv = Description_new(description_conv);
48242         return tag_ptr(ret_conv, true);
48243 }
48244
48245 jstring  __attribute__((export_name("TS_Description_into_inner"))) TS_Description_into_inner(uint64_t this_arg) {
48246         LDKDescription this_arg_conv;
48247         this_arg_conv.inner = untag_ptr(this_arg);
48248         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48250         this_arg_conv = Description_clone(&this_arg_conv);
48251         LDKStr ret_str = Description_into_inner(this_arg_conv);
48252         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
48253         Str_free(ret_str);
48254         return ret_conv;
48255 }
48256
48257 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_seconds"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
48258         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
48259         uint64_t ret_ref = 0;
48260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48262         return ret_ref;
48263 }
48264
48265 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_duration"))) TS_ExpiryTime_from_duration(int64_t duration) {
48266         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
48267         uint64_t ret_ref = 0;
48268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48270         return ret_ref;
48271 }
48272
48273 int64_t  __attribute__((export_name("TS_ExpiryTime_as_seconds"))) TS_ExpiryTime_as_seconds(uint64_t this_arg) {
48274         LDKExpiryTime this_arg_conv;
48275         this_arg_conv.inner = untag_ptr(this_arg);
48276         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48278         this_arg_conv.is_owned = false;
48279         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
48280         return ret_conv;
48281 }
48282
48283 int64_t  __attribute__((export_name("TS_ExpiryTime_as_duration"))) TS_ExpiryTime_as_duration(uint64_t this_arg) {
48284         LDKExpiryTime this_arg_conv;
48285         this_arg_conv.inner = untag_ptr(this_arg);
48286         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48288         this_arg_conv.is_owned = false;
48289         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
48290         return ret_conv;
48291 }
48292
48293 uint64_t  __attribute__((export_name("TS_PrivateRoute_new"))) TS_PrivateRoute_new(uint64_t hops) {
48294         LDKRouteHint hops_conv;
48295         hops_conv.inner = untag_ptr(hops);
48296         hops_conv.is_owned = ptr_is_owned(hops);
48297         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
48298         hops_conv = RouteHint_clone(&hops_conv);
48299         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
48300         *ret_conv = PrivateRoute_new(hops_conv);
48301         return tag_ptr(ret_conv, true);
48302 }
48303
48304 uint64_t  __attribute__((export_name("TS_PrivateRoute_into_inner"))) TS_PrivateRoute_into_inner(uint64_t this_arg) {
48305         LDKPrivateRoute this_arg_conv;
48306         this_arg_conv.inner = untag_ptr(this_arg);
48307         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48309         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
48310         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
48311         uint64_t ret_ref = 0;
48312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48314         return ret_ref;
48315 }
48316
48317 uint32_t  __attribute__((export_name("TS_CreationError_clone"))) TS_CreationError_clone(uint64_t orig) {
48318         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
48319         uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
48320         return ret_conv;
48321 }
48322
48323 uint32_t  __attribute__((export_name("TS_CreationError_description_too_long"))) TS_CreationError_description_too_long() {
48324         uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
48325         return ret_conv;
48326 }
48327
48328 uint32_t  __attribute__((export_name("TS_CreationError_route_too_long"))) TS_CreationError_route_too_long() {
48329         uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
48330         return ret_conv;
48331 }
48332
48333 uint32_t  __attribute__((export_name("TS_CreationError_timestamp_out_of_bounds"))) TS_CreationError_timestamp_out_of_bounds() {
48334         uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
48335         return ret_conv;
48336 }
48337
48338 uint32_t  __attribute__((export_name("TS_CreationError_invalid_amount"))) TS_CreationError_invalid_amount() {
48339         uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount());
48340         return ret_conv;
48341 }
48342
48343 uint32_t  __attribute__((export_name("TS_CreationError_missing_route_hints"))) TS_CreationError_missing_route_hints() {
48344         uint32_t ret_conv = LDKCreationError_to_js(CreationError_missing_route_hints());
48345         return ret_conv;
48346 }
48347
48348 jboolean  __attribute__((export_name("TS_CreationError_eq"))) TS_CreationError_eq(uint64_t a, uint64_t b) {
48349         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
48350         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
48351         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
48352         return ret_conv;
48353 }
48354
48355 jstring  __attribute__((export_name("TS_CreationError_to_str"))) TS_CreationError_to_str(uint64_t o) {
48356         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
48357         LDKStr ret_str = CreationError_to_str(o_conv);
48358         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
48359         Str_free(ret_str);
48360         return ret_conv;
48361 }
48362
48363 uint32_t  __attribute__((export_name("TS_SemanticError_clone"))) TS_SemanticError_clone(uint64_t orig) {
48364         LDKSemanticError* orig_conv = (LDKSemanticError*)untag_ptr(orig);
48365         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_clone(orig_conv));
48366         return ret_conv;
48367 }
48368
48369 uint32_t  __attribute__((export_name("TS_SemanticError_no_payment_hash"))) TS_SemanticError_no_payment_hash() {
48370         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_hash());
48371         return ret_conv;
48372 }
48373
48374 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_payment_hashes"))) TS_SemanticError_multiple_payment_hashes() {
48375         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_hashes());
48376         return ret_conv;
48377 }
48378
48379 uint32_t  __attribute__((export_name("TS_SemanticError_no_description"))) TS_SemanticError_no_description() {
48380         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_description());
48381         return ret_conv;
48382 }
48383
48384 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_descriptions"))) TS_SemanticError_multiple_descriptions() {
48385         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_descriptions());
48386         return ret_conv;
48387 }
48388
48389 uint32_t  __attribute__((export_name("TS_SemanticError_no_payment_secret"))) TS_SemanticError_no_payment_secret() {
48390         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_secret());
48391         return ret_conv;
48392 }
48393
48394 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_payment_secrets"))) TS_SemanticError_multiple_payment_secrets() {
48395         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
48396         return ret_conv;
48397 }
48398
48399 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_features"))) TS_SemanticError_invalid_features() {
48400         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_features());
48401         return ret_conv;
48402 }
48403
48404 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_recovery_id"))) TS_SemanticError_invalid_recovery_id() {
48405         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_recovery_id());
48406         return ret_conv;
48407 }
48408
48409 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_signature"))) TS_SemanticError_invalid_signature() {
48410         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_signature());
48411         return ret_conv;
48412 }
48413
48414 uint32_t  __attribute__((export_name("TS_SemanticError_imprecise_amount"))) TS_SemanticError_imprecise_amount() {
48415         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_imprecise_amount());
48416         return ret_conv;
48417 }
48418
48419 jboolean  __attribute__((export_name("TS_SemanticError_eq"))) TS_SemanticError_eq(uint64_t a, uint64_t b) {
48420         LDKSemanticError* a_conv = (LDKSemanticError*)untag_ptr(a);
48421         LDKSemanticError* b_conv = (LDKSemanticError*)untag_ptr(b);
48422         jboolean ret_conv = SemanticError_eq(a_conv, b_conv);
48423         return ret_conv;
48424 }
48425
48426 jstring  __attribute__((export_name("TS_SemanticError_to_str"))) TS_SemanticError_to_str(uint64_t o) {
48427         LDKSemanticError* o_conv = (LDKSemanticError*)untag_ptr(o);
48428         LDKStr ret_str = SemanticError_to_str(o_conv);
48429         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
48430         Str_free(ret_str);
48431         return ret_conv;
48432 }
48433
48434 void  __attribute__((export_name("TS_SignOrCreationError_free"))) TS_SignOrCreationError_free(uint64_t this_ptr) {
48435         if (!ptr_is_owned(this_ptr)) return;
48436         void* this_ptr_ptr = untag_ptr(this_ptr);
48437         CHECK_ACCESS(this_ptr_ptr);
48438         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
48439         FREE(untag_ptr(this_ptr));
48440         SignOrCreationError_free(this_ptr_conv);
48441 }
48442
48443 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
48444         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
48445         *ret_copy = SignOrCreationError_clone(arg);
48446         uint64_t ret_ref = tag_ptr(ret_copy, true);
48447         return ret_ref;
48448 }
48449 int64_t  __attribute__((export_name("TS_SignOrCreationError_clone_ptr"))) TS_SignOrCreationError_clone_ptr(uint64_t arg) {
48450         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
48451         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
48452         return ret_conv;
48453 }
48454
48455 uint64_t  __attribute__((export_name("TS_SignOrCreationError_clone"))) TS_SignOrCreationError_clone(uint64_t orig) {
48456         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
48457         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
48458         *ret_copy = SignOrCreationError_clone(orig_conv);
48459         uint64_t ret_ref = tag_ptr(ret_copy, true);
48460         return ret_ref;
48461 }
48462
48463 uint64_t  __attribute__((export_name("TS_SignOrCreationError_sign_error"))) TS_SignOrCreationError_sign_error() {
48464         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
48465         *ret_copy = SignOrCreationError_sign_error();
48466         uint64_t ret_ref = tag_ptr(ret_copy, true);
48467         return ret_ref;
48468 }
48469
48470 uint64_t  __attribute__((export_name("TS_SignOrCreationError_creation_error"))) TS_SignOrCreationError_creation_error(uint32_t a) {
48471         LDKCreationError a_conv = LDKCreationError_from_js(a);
48472         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
48473         *ret_copy = SignOrCreationError_creation_error(a_conv);
48474         uint64_t ret_ref = tag_ptr(ret_copy, true);
48475         return ret_ref;
48476 }
48477
48478 jboolean  __attribute__((export_name("TS_SignOrCreationError_eq"))) TS_SignOrCreationError_eq(uint64_t a, uint64_t b) {
48479         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
48480         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
48481         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
48482         return ret_conv;
48483 }
48484
48485 jstring  __attribute__((export_name("TS_SignOrCreationError_to_str"))) TS_SignOrCreationError_to_str(uint64_t o) {
48486         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
48487         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
48488         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
48489         Str_free(ret_str);
48490         return ret_conv;
48491 }
48492
48493 void  __attribute__((export_name("TS_InvoicePayer_free"))) TS_InvoicePayer_free(uint64_t this_obj) {
48494         LDKInvoicePayer this_obj_conv;
48495         this_obj_conv.inner = untag_ptr(this_obj);
48496         this_obj_conv.is_owned = ptr_is_owned(this_obj);
48497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
48498         InvoicePayer_free(this_obj_conv);
48499 }
48500
48501 void  __attribute__((export_name("TS_Payer_free"))) TS_Payer_free(uint64_t this_ptr) {
48502         if (!ptr_is_owned(this_ptr)) return;
48503         void* this_ptr_ptr = untag_ptr(this_ptr);
48504         CHECK_ACCESS(this_ptr_ptr);
48505         LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr);
48506         FREE(untag_ptr(this_ptr));
48507         Payer_free(this_ptr_conv);
48508 }
48509
48510 void  __attribute__((export_name("TS_Retry_free"))) TS_Retry_free(uint64_t this_ptr) {
48511         if (!ptr_is_owned(this_ptr)) return;
48512         void* this_ptr_ptr = untag_ptr(this_ptr);
48513         CHECK_ACCESS(this_ptr_ptr);
48514         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
48515         FREE(untag_ptr(this_ptr));
48516         Retry_free(this_ptr_conv);
48517 }
48518
48519 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
48520         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
48521         *ret_copy = Retry_clone(arg);
48522         uint64_t ret_ref = tag_ptr(ret_copy, true);
48523         return ret_ref;
48524 }
48525 int64_t  __attribute__((export_name("TS_Retry_clone_ptr"))) TS_Retry_clone_ptr(uint64_t arg) {
48526         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
48527         int64_t ret_conv = Retry_clone_ptr(arg_conv);
48528         return ret_conv;
48529 }
48530
48531 uint64_t  __attribute__((export_name("TS_Retry_clone"))) TS_Retry_clone(uint64_t orig) {
48532         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
48533         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
48534         *ret_copy = Retry_clone(orig_conv);
48535         uint64_t ret_ref = tag_ptr(ret_copy, true);
48536         return ret_ref;
48537 }
48538
48539 uint64_t  __attribute__((export_name("TS_Retry_attempts"))) TS_Retry_attempts(uint32_t a) {
48540         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
48541         *ret_copy = Retry_attempts(a);
48542         uint64_t ret_ref = tag_ptr(ret_copy, true);
48543         return ret_ref;
48544 }
48545
48546 jboolean  __attribute__((export_name("TS_Retry_eq"))) TS_Retry_eq(uint64_t a, uint64_t b) {
48547         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
48548         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
48549         jboolean ret_conv = Retry_eq(a_conv, b_conv);
48550         return ret_conv;
48551 }
48552
48553 int64_t  __attribute__((export_name("TS_Retry_hash"))) TS_Retry_hash(uint64_t o) {
48554         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
48555         int64_t ret_conv = Retry_hash(o_conv);
48556         return ret_conv;
48557 }
48558
48559 void  __attribute__((export_name("TS_PaymentError_free"))) TS_PaymentError_free(uint64_t this_ptr) {
48560         if (!ptr_is_owned(this_ptr)) return;
48561         void* this_ptr_ptr = untag_ptr(this_ptr);
48562         CHECK_ACCESS(this_ptr_ptr);
48563         LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
48564         FREE(untag_ptr(this_ptr));
48565         PaymentError_free(this_ptr_conv);
48566 }
48567
48568 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
48569         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
48570         *ret_copy = PaymentError_clone(arg);
48571         uint64_t ret_ref = tag_ptr(ret_copy, true);
48572         return ret_ref;
48573 }
48574 int64_t  __attribute__((export_name("TS_PaymentError_clone_ptr"))) TS_PaymentError_clone_ptr(uint64_t arg) {
48575         LDKPaymentError* arg_conv = (LDKPaymentError*)untag_ptr(arg);
48576         int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
48577         return ret_conv;
48578 }
48579
48580 uint64_t  __attribute__((export_name("TS_PaymentError_clone"))) TS_PaymentError_clone(uint64_t orig) {
48581         LDKPaymentError* orig_conv = (LDKPaymentError*)untag_ptr(orig);
48582         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
48583         *ret_copy = PaymentError_clone(orig_conv);
48584         uint64_t ret_ref = tag_ptr(ret_copy, true);
48585         return ret_ref;
48586 }
48587
48588 uint64_t  __attribute__((export_name("TS_PaymentError_invoice"))) TS_PaymentError_invoice(jstring a) {
48589         LDKStr a_conv = str_ref_to_owned_c(a);
48590         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
48591         *ret_copy = PaymentError_invoice(a_conv);
48592         uint64_t ret_ref = tag_ptr(ret_copy, true);
48593         return ret_ref;
48594 }
48595
48596 uint64_t  __attribute__((export_name("TS_PaymentError_routing"))) TS_PaymentError_routing(uint64_t a) {
48597         LDKLightningError a_conv;
48598         a_conv.inner = untag_ptr(a);
48599         a_conv.is_owned = ptr_is_owned(a);
48600         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
48601         a_conv = LightningError_clone(&a_conv);
48602         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
48603         *ret_copy = PaymentError_routing(a_conv);
48604         uint64_t ret_ref = tag_ptr(ret_copy, true);
48605         return ret_ref;
48606 }
48607
48608 uint64_t  __attribute__((export_name("TS_PaymentError_sending"))) TS_PaymentError_sending(uint64_t a) {
48609         void* a_ptr = untag_ptr(a);
48610         CHECK_ACCESS(a_ptr);
48611         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
48612         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
48613         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
48614         *ret_copy = PaymentError_sending(a_conv);
48615         uint64_t ret_ref = tag_ptr(ret_copy, true);
48616         return ret_ref;
48617 }
48618
48619 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) {
48620         void* payer_ptr = untag_ptr(payer);
48621         CHECK_ACCESS(payer_ptr);
48622         LDKPayer payer_conv = *(LDKPayer*)(payer_ptr);
48623         if (payer_conv.free == LDKPayer_JCalls_free) {
48624                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48625                 LDKPayer_JCalls_cloned(&payer_conv);
48626         }
48627         void* router_ptr = untag_ptr(router);
48628         CHECK_ACCESS(router_ptr);
48629         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
48630         if (router_conv.free == LDKRouter_JCalls_free) {
48631                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48632                 LDKRouter_JCalls_cloned(&router_conv);
48633         }
48634         void* logger_ptr = untag_ptr(logger);
48635         CHECK_ACCESS(logger_ptr);
48636         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
48637         if (logger_conv.free == LDKLogger_JCalls_free) {
48638                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48639                 LDKLogger_JCalls_cloned(&logger_conv);
48640         }
48641         void* event_handler_ptr = untag_ptr(event_handler);
48642         CHECK_ACCESS(event_handler_ptr);
48643         LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
48644         if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
48645                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48646                 LDKEventHandler_JCalls_cloned(&event_handler_conv);
48647         }
48648         void* retry_ptr = untag_ptr(retry);
48649         CHECK_ACCESS(retry_ptr);
48650         LDKRetry retry_conv = *(LDKRetry*)(retry_ptr);
48651         retry_conv = Retry_clone((LDKRetry*)untag_ptr(retry));
48652         LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, logger_conv, event_handler_conv, retry_conv);
48653         uint64_t ret_ref = 0;
48654         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48655         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48656         return ret_ref;
48657 }
48658
48659 uint64_t  __attribute__((export_name("TS_InvoicePayer_pay_invoice"))) TS_InvoicePayer_pay_invoice(uint64_t this_arg, uint64_t invoice) {
48660         LDKInvoicePayer this_arg_conv;
48661         this_arg_conv.inner = untag_ptr(this_arg);
48662         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48664         this_arg_conv.is_owned = false;
48665         LDKInvoice invoice_conv;
48666         invoice_conv.inner = untag_ptr(invoice);
48667         invoice_conv.is_owned = ptr_is_owned(invoice);
48668         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
48669         invoice_conv.is_owned = false;
48670         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
48671         *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv);
48672         return tag_ptr(ret_conv, true);
48673 }
48674
48675 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) {
48676         LDKInvoicePayer this_arg_conv;
48677         this_arg_conv.inner = untag_ptr(this_arg);
48678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48680         this_arg_conv.is_owned = false;
48681         LDKInvoice invoice_conv;
48682         invoice_conv.inner = untag_ptr(invoice);
48683         invoice_conv.is_owned = ptr_is_owned(invoice);
48684         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
48685         invoice_conv.is_owned = false;
48686         LDKThirtyTwoBytes payment_id_ref;
48687         CHECK(payment_id->arr_len == 32);
48688         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
48689         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
48690         *ret_conv = InvoicePayer_pay_invoice_with_id(&this_arg_conv, &invoice_conv, payment_id_ref);
48691         return tag_ptr(ret_conv, true);
48692 }
48693
48694 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) {
48695         LDKInvoicePayer this_arg_conv;
48696         this_arg_conv.inner = untag_ptr(this_arg);
48697         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48699         this_arg_conv.is_owned = false;
48700         LDKInvoice invoice_conv;
48701         invoice_conv.inner = untag_ptr(invoice);
48702         invoice_conv.is_owned = ptr_is_owned(invoice);
48703         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
48704         invoice_conv.is_owned = false;
48705         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
48706         *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats);
48707         return tag_ptr(ret_conv, true);
48708 }
48709
48710 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) {
48711         LDKInvoicePayer this_arg_conv;
48712         this_arg_conv.inner = untag_ptr(this_arg);
48713         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48715         this_arg_conv.is_owned = false;
48716         LDKInvoice invoice_conv;
48717         invoice_conv.inner = untag_ptr(invoice);
48718         invoice_conv.is_owned = ptr_is_owned(invoice);
48719         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
48720         invoice_conv.is_owned = false;
48721         LDKThirtyTwoBytes payment_id_ref;
48722         CHECK(payment_id->arr_len == 32);
48723         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
48724         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
48725         *ret_conv = InvoicePayer_pay_zero_value_invoice_with_id(&this_arg_conv, &invoice_conv, amount_msats, payment_id_ref);
48726         return tag_ptr(ret_conv, true);
48727 }
48728
48729 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) {
48730         LDKInvoicePayer this_arg_conv;
48731         this_arg_conv.inner = untag_ptr(this_arg);
48732         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48734         this_arg_conv.is_owned = false;
48735         LDKPublicKey pubkey_ref;
48736         CHECK(pubkey->arr_len == 33);
48737         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
48738         LDKThirtyTwoBytes payment_preimage_ref;
48739         CHECK(payment_preimage->arr_len == 32);
48740         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
48741         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
48742         *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta);
48743         return tag_ptr(ret_conv, true);
48744 }
48745
48746 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) {
48747         LDKInvoicePayer this_arg_conv;
48748         this_arg_conv.inner = untag_ptr(this_arg);
48749         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48751         this_arg_conv.is_owned = false;
48752         LDKPublicKey pubkey_ref;
48753         CHECK(pubkey->arr_len == 33);
48754         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
48755         LDKThirtyTwoBytes payment_preimage_ref;
48756         CHECK(payment_preimage->arr_len == 32);
48757         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
48758         LDKThirtyTwoBytes payment_id_ref;
48759         CHECK(payment_id->arr_len == 32);
48760         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
48761         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
48762         *ret_conv = InvoicePayer_pay_pubkey_with_id(&this_arg_conv, pubkey_ref, payment_preimage_ref, payment_id_ref, amount_msats, final_cltv_expiry_delta);
48763         return tag_ptr(ret_conv, true);
48764 }
48765
48766 void  __attribute__((export_name("TS_InvoicePayer_remove_cached_payment"))) TS_InvoicePayer_remove_cached_payment(uint64_t this_arg, int8_tArray payment_hash) {
48767         LDKInvoicePayer this_arg_conv;
48768         this_arg_conv.inner = untag_ptr(this_arg);
48769         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48771         this_arg_conv.is_owned = false;
48772         unsigned char payment_hash_arr[32];
48773         CHECK(payment_hash->arr_len == 32);
48774         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
48775         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
48776         InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref);
48777 }
48778
48779 uint64_t  __attribute__((export_name("TS_InvoicePayer_as_EventHandler"))) TS_InvoicePayer_as_EventHandler(uint64_t this_arg) {
48780         LDKInvoicePayer this_arg_conv;
48781         this_arg_conv.inner = untag_ptr(this_arg);
48782         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48784         this_arg_conv.is_owned = false;
48785         LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
48786         *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv);
48787         return tag_ptr(ret_ret, true);
48788 }
48789
48790 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) {
48791         LDKChannelManager channelmanager_conv;
48792         channelmanager_conv.inner = untag_ptr(channelmanager);
48793         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
48794         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
48795         channelmanager_conv.is_owned = false;
48796         void* keys_manager_ptr = untag_ptr(keys_manager);
48797         CHECK_ACCESS(keys_manager_ptr);
48798         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
48799         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
48800                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48801                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
48802         }
48803         void* logger_ptr = untag_ptr(logger);
48804         CHECK_ACCESS(logger_ptr);
48805         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
48806         if (logger_conv.free == LDKLogger_JCalls_free) {
48807                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48808                 LDKLogger_JCalls_cloned(&logger_conv);
48809         }
48810         LDKCurrency network_conv = LDKCurrency_from_js(network);
48811         void* amt_msat_ptr = untag_ptr(amt_msat);
48812         CHECK_ACCESS(amt_msat_ptr);
48813         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
48814         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
48815         LDKSha256 description_hash_conv;
48816         description_hash_conv.inner = untag_ptr(description_hash);
48817         description_hash_conv.is_owned = ptr_is_owned(description_hash);
48818         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
48819         description_hash_conv = Sha256_clone(&description_hash_conv);
48820         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
48821         *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);
48822         return tag_ptr(ret_conv, true);
48823 }
48824
48825 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) {
48826         LDKChannelManager channelmanager_conv;
48827         channelmanager_conv.inner = untag_ptr(channelmanager);
48828         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
48829         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
48830         channelmanager_conv.is_owned = false;
48831         void* keys_manager_ptr = untag_ptr(keys_manager);
48832         CHECK_ACCESS(keys_manager_ptr);
48833         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
48834         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
48835                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48836                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
48837         }
48838         void* logger_ptr = untag_ptr(logger);
48839         CHECK_ACCESS(logger_ptr);
48840         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
48841         if (logger_conv.free == LDKLogger_JCalls_free) {
48842                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48843                 LDKLogger_JCalls_cloned(&logger_conv);
48844         }
48845         LDKCurrency network_conv = LDKCurrency_from_js(network);
48846         void* amt_msat_ptr = untag_ptr(amt_msat);
48847         CHECK_ACCESS(amt_msat_ptr);
48848         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
48849         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
48850         LDKStr description_conv = str_ref_to_owned_c(description);
48851         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
48852         *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);
48853         return tag_ptr(ret_conv, true);
48854 }
48855
48856 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) {
48857         LDKChannelManager channelmanager_conv;
48858         channelmanager_conv.inner = untag_ptr(channelmanager);
48859         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
48860         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
48861         channelmanager_conv.is_owned = false;
48862         void* keys_manager_ptr = untag_ptr(keys_manager);
48863         CHECK_ACCESS(keys_manager_ptr);
48864         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
48865         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
48866                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48867                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
48868         }
48869         void* logger_ptr = untag_ptr(logger);
48870         CHECK_ACCESS(logger_ptr);
48871         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
48872         if (logger_conv.free == LDKLogger_JCalls_free) {
48873                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
48874                 LDKLogger_JCalls_cloned(&logger_conv);
48875         }
48876         LDKCurrency network_conv = LDKCurrency_from_js(network);
48877         void* amt_msat_ptr = untag_ptr(amt_msat);
48878         CHECK_ACCESS(amt_msat_ptr);
48879         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
48880         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
48881         LDKStr description_conv = str_ref_to_owned_c(description);
48882         LDKThirtyTwoBytes payment_hash_ref;
48883         CHECK(payment_hash->arr_len == 32);
48884         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
48885         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
48886         *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);
48887         return tag_ptr(ret_conv, true);
48888 }
48889
48890 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Payer"))) TS_ChannelManager_as_Payer(uint64_t this_arg) {
48891         LDKChannelManager this_arg_conv;
48892         this_arg_conv.inner = untag_ptr(this_arg);
48893         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48895         this_arg_conv.is_owned = false;
48896         LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer");
48897         *ret_ret = ChannelManager_as_Payer(&this_arg_conv);
48898         return tag_ptr(ret_ret, true);
48899 }
48900
48901 uint64_t  __attribute__((export_name("TS_SiPrefix_from_str"))) TS_SiPrefix_from_str(jstring s) {
48902         LDKStr s_conv = str_ref_to_owned_c(s);
48903         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
48904         *ret_conv = SiPrefix_from_str(s_conv);
48905         return tag_ptr(ret_conv, true);
48906 }
48907
48908 uint64_t  __attribute__((export_name("TS_Invoice_from_str"))) TS_Invoice_from_str(jstring s) {
48909         LDKStr s_conv = str_ref_to_owned_c(s);
48910         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
48911         *ret_conv = Invoice_from_str(s_conv);
48912         return tag_ptr(ret_conv, true);
48913 }
48914
48915 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_from_str"))) TS_SignedRawInvoice_from_str(jstring s) {
48916         LDKStr s_conv = str_ref_to_owned_c(s);
48917         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
48918         *ret_conv = SignedRawInvoice_from_str(s_conv);
48919         return tag_ptr(ret_conv, true);
48920 }
48921
48922 jstring  __attribute__((export_name("TS_ParseError_to_str"))) TS_ParseError_to_str(uint64_t o) {
48923         LDKParseError* o_conv = (LDKParseError*)untag_ptr(o);
48924         LDKStr ret_str = ParseError_to_str(o_conv);
48925         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
48926         Str_free(ret_str);
48927         return ret_conv;
48928 }
48929
48930 jstring  __attribute__((export_name("TS_ParseOrSemanticError_to_str"))) TS_ParseOrSemanticError_to_str(uint64_t o) {
48931         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
48932         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
48933         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
48934         Str_free(ret_str);
48935         return ret_conv;
48936 }
48937
48938 jstring  __attribute__((export_name("TS_Invoice_to_str"))) TS_Invoice_to_str(uint64_t o) {
48939         LDKInvoice o_conv;
48940         o_conv.inner = untag_ptr(o);
48941         o_conv.is_owned = ptr_is_owned(o);
48942         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48943         o_conv.is_owned = false;
48944         LDKStr ret_str = Invoice_to_str(&o_conv);
48945         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
48946         Str_free(ret_str);
48947         return ret_conv;
48948 }
48949
48950 jstring  __attribute__((export_name("TS_SignedRawInvoice_to_str"))) TS_SignedRawInvoice_to_str(uint64_t o) {
48951         LDKSignedRawInvoice o_conv;
48952         o_conv.inner = untag_ptr(o);
48953         o_conv.is_owned = ptr_is_owned(o);
48954         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
48955         o_conv.is_owned = false;
48956         LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
48957         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
48958         Str_free(ret_str);
48959         return ret_conv;
48960 }
48961
48962 jstring  __attribute__((export_name("TS_Currency_to_str"))) TS_Currency_to_str(uint64_t o) {
48963         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
48964         LDKStr ret_str = Currency_to_str(o_conv);
48965         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
48966         Str_free(ret_str);
48967         return ret_conv;
48968 }
48969
48970 jstring  __attribute__((export_name("TS_SiPrefix_to_str"))) TS_SiPrefix_to_str(uint64_t o) {
48971         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
48972         LDKStr ret_str = SiPrefix_to_str(o_conv);
48973         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
48974         Str_free(ret_str);
48975         return ret_conv;
48976 }
48977