[TS] Update auto-generated bindings (with RGS)
[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 LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_js(int32_t ord) {
183         switch (ord) {
184                 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
185                 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
186         }
187         abort();
188 }
189 static inline int32_t LDKChannelMonitorUpdateErr_to_js(LDKChannelMonitorUpdateErr val) {
190         switch (val) {
191                 case LDKChannelMonitorUpdateErr_TemporaryFailure: return 0;
192                 case LDKChannelMonitorUpdateErr_PermanentFailure: return 1;
193                 default: abort();
194         }
195 }
196 static inline LDKConfirmationTarget LDKConfirmationTarget_from_js(int32_t ord) {
197         switch (ord) {
198                 case 0: return LDKConfirmationTarget_Background;
199                 case 1: return LDKConfirmationTarget_Normal;
200                 case 2: return LDKConfirmationTarget_HighPriority;
201         }
202         abort();
203 }
204 static inline int32_t LDKConfirmationTarget_to_js(LDKConfirmationTarget val) {
205         switch (val) {
206                 case LDKConfirmationTarget_Background: return 0;
207                 case LDKConfirmationTarget_Normal: return 1;
208                 case LDKConfirmationTarget_HighPriority: return 2;
209                 default: abort();
210         }
211 }
212 static inline LDKCreationError LDKCreationError_from_js(int32_t ord) {
213         switch (ord) {
214                 case 0: return LDKCreationError_DescriptionTooLong;
215                 case 1: return LDKCreationError_RouteTooLong;
216                 case 2: return LDKCreationError_TimestampOutOfBounds;
217                 case 3: return LDKCreationError_InvalidAmount;
218                 case 4: return LDKCreationError_MissingRouteHints;
219         }
220         abort();
221 }
222 static inline int32_t LDKCreationError_to_js(LDKCreationError val) {
223         switch (val) {
224                 case LDKCreationError_DescriptionTooLong: return 0;
225                 case LDKCreationError_RouteTooLong: return 1;
226                 case LDKCreationError_TimestampOutOfBounds: return 2;
227                 case LDKCreationError_InvalidAmount: return 3;
228                 case LDKCreationError_MissingRouteHints: return 4;
229                 default: abort();
230         }
231 }
232 static inline LDKCurrency LDKCurrency_from_js(int32_t ord) {
233         switch (ord) {
234                 case 0: return LDKCurrency_Bitcoin;
235                 case 1: return LDKCurrency_BitcoinTestnet;
236                 case 2: return LDKCurrency_Regtest;
237                 case 3: return LDKCurrency_Simnet;
238                 case 4: return LDKCurrency_Signet;
239         }
240         abort();
241 }
242 static inline int32_t LDKCurrency_to_js(LDKCurrency val) {
243         switch (val) {
244                 case LDKCurrency_Bitcoin: return 0;
245                 case LDKCurrency_BitcoinTestnet: return 1;
246                 case LDKCurrency_Regtest: return 2;
247                 case LDKCurrency_Simnet: return 3;
248                 case LDKCurrency_Signet: return 4;
249                 default: abort();
250         }
251 }
252 static inline LDKIOError LDKIOError_from_js(int32_t ord) {
253         switch (ord) {
254                 case 0: return LDKIOError_NotFound;
255                 case 1: return LDKIOError_PermissionDenied;
256                 case 2: return LDKIOError_ConnectionRefused;
257                 case 3: return LDKIOError_ConnectionReset;
258                 case 4: return LDKIOError_ConnectionAborted;
259                 case 5: return LDKIOError_NotConnected;
260                 case 6: return LDKIOError_AddrInUse;
261                 case 7: return LDKIOError_AddrNotAvailable;
262                 case 8: return LDKIOError_BrokenPipe;
263                 case 9: return LDKIOError_AlreadyExists;
264                 case 10: return LDKIOError_WouldBlock;
265                 case 11: return LDKIOError_InvalidInput;
266                 case 12: return LDKIOError_InvalidData;
267                 case 13: return LDKIOError_TimedOut;
268                 case 14: return LDKIOError_WriteZero;
269                 case 15: return LDKIOError_Interrupted;
270                 case 16: return LDKIOError_Other;
271                 case 17: return LDKIOError_UnexpectedEof;
272         }
273         abort();
274 }
275 static inline int32_t LDKIOError_to_js(LDKIOError val) {
276         switch (val) {
277                 case LDKIOError_NotFound: return 0;
278                 case LDKIOError_PermissionDenied: return 1;
279                 case LDKIOError_ConnectionRefused: return 2;
280                 case LDKIOError_ConnectionReset: return 3;
281                 case LDKIOError_ConnectionAborted: return 4;
282                 case LDKIOError_NotConnected: return 5;
283                 case LDKIOError_AddrInUse: return 6;
284                 case LDKIOError_AddrNotAvailable: return 7;
285                 case LDKIOError_BrokenPipe: return 8;
286                 case LDKIOError_AlreadyExists: return 9;
287                 case LDKIOError_WouldBlock: return 10;
288                 case LDKIOError_InvalidInput: return 11;
289                 case LDKIOError_InvalidData: return 12;
290                 case LDKIOError_TimedOut: return 13;
291                 case LDKIOError_WriteZero: return 14;
292                 case LDKIOError_Interrupted: return 15;
293                 case LDKIOError_Other: return 16;
294                 case LDKIOError_UnexpectedEof: return 17;
295                 default: abort();
296         }
297 }
298 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
299         switch (ord) {
300                 case 0: return LDKLevel_Gossip;
301                 case 1: return LDKLevel_Trace;
302                 case 2: return LDKLevel_Debug;
303                 case 3: return LDKLevel_Info;
304                 case 4: return LDKLevel_Warn;
305                 case 5: return LDKLevel_Error;
306         }
307         abort();
308 }
309 static inline int32_t LDKLevel_to_js(LDKLevel val) {
310         switch (val) {
311                 case LDKLevel_Gossip: return 0;
312                 case LDKLevel_Trace: return 1;
313                 case LDKLevel_Debug: return 2;
314                 case LDKLevel_Info: return 3;
315                 case LDKLevel_Warn: return 4;
316                 case LDKLevel_Error: return 5;
317                 default: abort();
318         }
319 }
320 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
321         switch (ord) {
322                 case 0: return LDKNetwork_Bitcoin;
323                 case 1: return LDKNetwork_Testnet;
324                 case 2: return LDKNetwork_Regtest;
325                 case 3: return LDKNetwork_Signet;
326         }
327         abort();
328 }
329 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
330         switch (val) {
331                 case LDKNetwork_Bitcoin: return 0;
332                 case LDKNetwork_Testnet: return 1;
333                 case LDKNetwork_Regtest: return 2;
334                 case LDKNetwork_Signet: return 3;
335                 default: abort();
336         }
337 }
338 static inline LDKRecipient LDKRecipient_from_js(int32_t ord) {
339         switch (ord) {
340                 case 0: return LDKRecipient_Node;
341                 case 1: return LDKRecipient_PhantomNode;
342         }
343         abort();
344 }
345 static inline int32_t LDKRecipient_to_js(LDKRecipient val) {
346         switch (val) {
347                 case LDKRecipient_Node: return 0;
348                 case LDKRecipient_PhantomNode: return 1;
349                 default: abort();
350         }
351 }
352 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
353         switch (ord) {
354                 case 0: return LDKSecp256k1Error_IncorrectSignature;
355                 case 1: return LDKSecp256k1Error_InvalidMessage;
356                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
357                 case 3: return LDKSecp256k1Error_InvalidSignature;
358                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
359                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
360                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
361                 case 7: return LDKSecp256k1Error_InvalidTweak;
362                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
363                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
364                 case 10: return LDKSecp256k1Error_InvalidParityValue;
365         }
366         abort();
367 }
368 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
369         switch (val) {
370                 case LDKSecp256k1Error_IncorrectSignature: return 0;
371                 case LDKSecp256k1Error_InvalidMessage: return 1;
372                 case LDKSecp256k1Error_InvalidPublicKey: return 2;
373                 case LDKSecp256k1Error_InvalidSignature: return 3;
374                 case LDKSecp256k1Error_InvalidSecretKey: return 4;
375                 case LDKSecp256k1Error_InvalidSharedSecret: return 5;
376                 case LDKSecp256k1Error_InvalidRecoveryId: return 6;
377                 case LDKSecp256k1Error_InvalidTweak: return 7;
378                 case LDKSecp256k1Error_NotEnoughMemory: return 8;
379                 case LDKSecp256k1Error_InvalidPublicKeySum: return 9;
380                 case LDKSecp256k1Error_InvalidParityValue: return 10;
381                 default: abort();
382         }
383 }
384 static inline LDKSemanticError LDKSemanticError_from_js(int32_t ord) {
385         switch (ord) {
386                 case 0: return LDKSemanticError_NoPaymentHash;
387                 case 1: return LDKSemanticError_MultiplePaymentHashes;
388                 case 2: return LDKSemanticError_NoDescription;
389                 case 3: return LDKSemanticError_MultipleDescriptions;
390                 case 4: return LDKSemanticError_NoPaymentSecret;
391                 case 5: return LDKSemanticError_MultiplePaymentSecrets;
392                 case 6: return LDKSemanticError_InvalidFeatures;
393                 case 7: return LDKSemanticError_InvalidRecoveryId;
394                 case 8: return LDKSemanticError_InvalidSignature;
395                 case 9: return LDKSemanticError_ImpreciseAmount;
396         }
397         abort();
398 }
399 static inline int32_t LDKSemanticError_to_js(LDKSemanticError val) {
400         switch (val) {
401                 case LDKSemanticError_NoPaymentHash: return 0;
402                 case LDKSemanticError_MultiplePaymentHashes: return 1;
403                 case LDKSemanticError_NoDescription: return 2;
404                 case LDKSemanticError_MultipleDescriptions: return 3;
405                 case LDKSemanticError_NoPaymentSecret: return 4;
406                 case LDKSemanticError_MultiplePaymentSecrets: return 5;
407                 case LDKSemanticError_InvalidFeatures: return 6;
408                 case LDKSemanticError_InvalidRecoveryId: return 7;
409                 case LDKSemanticError_InvalidSignature: return 8;
410                 case LDKSemanticError_ImpreciseAmount: return 9;
411                 default: abort();
412         }
413 }
414 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
415         switch (ord) {
416                 case 0: return LDKSiPrefix_Milli;
417                 case 1: return LDKSiPrefix_Micro;
418                 case 2: return LDKSiPrefix_Nano;
419                 case 3: return LDKSiPrefix_Pico;
420         }
421         abort();
422 }
423 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
424         switch (val) {
425                 case LDKSiPrefix_Milli: return 0;
426                 case LDKSiPrefix_Micro: return 1;
427                 case LDKSiPrefix_Nano: return 2;
428                 case LDKSiPrefix_Pico: return 3;
429                 default: abort();
430         }
431 }
432 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
433         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
434         return ret;
435 }
436 int8_tArray  __attribute__((export_name("TS_BigEndianScalar_get_bytes"))) TS_BigEndianScalar_get_bytes(uint64_t thing) {
437         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
438         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
439         memcpy(ret_arr->elems, BigEndianScalar_get_bytes(thing_conv).data, 32);
440         return ret_arr;
441 }
442
443 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
444 void  __attribute__((export_name("TS_BigEndianScalar_free"))) TS_BigEndianScalar_free(uint64_t thing) {
445         if (!ptr_is_owned(thing)) return;
446         void* thing_ptr = untag_ptr(thing);
447         CHECK_ACCESS(thing_ptr);
448         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
449         FREE(untag_ptr(thing));
450         BigEndianScalar_free(thing_conv);
451 }
452
453 uint32_t __attribute__((export_name("TS_LDKBech32Error_ty_from_ptr"))) TS_LDKBech32Error_ty_from_ptr(uint64_t ptr) {
454         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
455         switch(obj->tag) {
456                 case LDKBech32Error_MissingSeparator: return 0;
457                 case LDKBech32Error_InvalidChecksum: return 1;
458                 case LDKBech32Error_InvalidLength: return 2;
459                 case LDKBech32Error_InvalidChar: return 3;
460                 case LDKBech32Error_InvalidData: return 4;
461                 case LDKBech32Error_InvalidPadding: return 5;
462                 case LDKBech32Error_MixedCase: return 6;
463                 default: abort();
464         }
465 }
466 int32_t __attribute__((export_name("TS_LDKBech32Error_InvalidChar_get_invalid_char"))) TS_LDKBech32Error_InvalidChar_get_invalid_char(uint64_t ptr) {
467         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
468         assert(obj->tag == LDKBech32Error_InvalidChar);
469                         int32_t invalid_char_conv = obj->invalid_char;
470         return invalid_char_conv;
471 }
472 int8_t __attribute__((export_name("TS_LDKBech32Error_InvalidData_get_invalid_data"))) TS_LDKBech32Error_InvalidData_get_invalid_data(uint64_t ptr) {
473         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
474         assert(obj->tag == LDKBech32Error_InvalidData);
475                         int8_t invalid_data_conv = obj->invalid_data;
476         return invalid_data_conv;
477 }
478 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
479         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
480         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
481         return ret;
482 }
483 struct LDKCVec_u8Z TxOut_get_script_pubkey (struct LDKTxOut* thing) {   return CVec_u8Z_clone(&thing->script_pubkey);}int8_tArray  __attribute__((export_name("TS_TxOut_get_script_pubkey"))) TS_TxOut_get_script_pubkey(uint64_t thing) {
484         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
485         LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
486         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
487         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
488         CVec_u8Z_free(ret_var);
489         return ret_arr;
490 }
491
492 uint64_t TxOut_get_value (struct LDKTxOut* thing) {     return thing->value;}int64_t  __attribute__((export_name("TS_TxOut_get_value"))) TS_TxOut_get_value(uint64_t thing) {
493         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
494         int64_t ret_conv = TxOut_get_value(thing_conv);
495         return ret_conv;
496 }
497
498 static inline struct LDKBlindedRoute CResult_BlindedRouteNoneZ_get_ok(LDKCResult_BlindedRouteNoneZ *NONNULL_PTR owner){
499         LDKBlindedRoute ret = *owner->contents.result;
500         ret.is_owned = false;
501         return ret;
502 }
503 uint64_t  __attribute__((export_name("TS_CResult_BlindedRouteNoneZ_get_ok"))) TS_CResult_BlindedRouteNoneZ_get_ok(uint64_t owner) {
504         LDKCResult_BlindedRouteNoneZ* owner_conv = (LDKCResult_BlindedRouteNoneZ*)untag_ptr(owner);
505         LDKBlindedRoute ret_var = CResult_BlindedRouteNoneZ_get_ok(owner_conv);
506         uint64_t ret_ref = 0;
507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
509         return ret_ref;
510 }
511
512 static inline void CResult_BlindedRouteNoneZ_get_err(LDKCResult_BlindedRouteNoneZ *NONNULL_PTR owner){
513 CHECK(!owner->result_ok);
514         return *owner->contents.err;
515 }
516 void  __attribute__((export_name("TS_CResult_BlindedRouteNoneZ_get_err"))) TS_CResult_BlindedRouteNoneZ_get_err(uint64_t owner) {
517         LDKCResult_BlindedRouteNoneZ* owner_conv = (LDKCResult_BlindedRouteNoneZ*)untag_ptr(owner);
518         CResult_BlindedRouteNoneZ_get_err(owner_conv);
519 }
520
521 static inline struct LDKBlindedRoute CResult_BlindedRouteDecodeErrorZ_get_ok(LDKCResult_BlindedRouteDecodeErrorZ *NONNULL_PTR owner){
522         LDKBlindedRoute ret = *owner->contents.result;
523         ret.is_owned = false;
524         return ret;
525 }
526 uint64_t  __attribute__((export_name("TS_CResult_BlindedRouteDecodeErrorZ_get_ok"))) TS_CResult_BlindedRouteDecodeErrorZ_get_ok(uint64_t owner) {
527         LDKCResult_BlindedRouteDecodeErrorZ* owner_conv = (LDKCResult_BlindedRouteDecodeErrorZ*)untag_ptr(owner);
528         LDKBlindedRoute ret_var = CResult_BlindedRouteDecodeErrorZ_get_ok(owner_conv);
529         uint64_t ret_ref = 0;
530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
532         return ret_ref;
533 }
534
535 static inline struct LDKDecodeError CResult_BlindedRouteDecodeErrorZ_get_err(LDKCResult_BlindedRouteDecodeErrorZ *NONNULL_PTR owner){
536         LDKDecodeError ret = *owner->contents.err;
537         ret.is_owned = false;
538         return ret;
539 }
540 uint64_t  __attribute__((export_name("TS_CResult_BlindedRouteDecodeErrorZ_get_err"))) TS_CResult_BlindedRouteDecodeErrorZ_get_err(uint64_t owner) {
541         LDKCResult_BlindedRouteDecodeErrorZ* owner_conv = (LDKCResult_BlindedRouteDecodeErrorZ*)untag_ptr(owner);
542         LDKDecodeError ret_var = CResult_BlindedRouteDecodeErrorZ_get_err(owner_conv);
543         uint64_t ret_ref = 0;
544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
546         return ret_ref;
547 }
548
549 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
550         LDKBlindedHop ret = *owner->contents.result;
551         ret.is_owned = false;
552         return ret;
553 }
554 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopDecodeErrorZ_get_ok(uint64_t owner) {
555         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
556         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
557         uint64_t ret_ref = 0;
558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
560         return ret_ref;
561 }
562
563 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
564         LDKDecodeError ret = *owner->contents.err;
565         ret.is_owned = false;
566         return ret;
567 }
568 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_err"))) TS_CResult_BlindedHopDecodeErrorZ_get_err(uint64_t owner) {
569         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
570         LDKDecodeError ret_var = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
571         uint64_t ret_ref = 0;
572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
574         return ret_ref;
575 }
576
577 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
578 CHECK(owner->result_ok);
579         return *owner->contents.result;
580 }
581 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_ok"))) TS_CResult_NoneNoneZ_get_ok(uint64_t owner) {
582         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
583         CResult_NoneNoneZ_get_ok(owner_conv);
584 }
585
586 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
587 CHECK(!owner->result_ok);
588         return *owner->contents.err;
589 }
590 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_err"))) TS_CResult_NoneNoneZ_get_err(uint64_t owner) {
591         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
592         CResult_NoneNoneZ_get_err(owner_conv);
593 }
594
595 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
596         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
597         ret.is_owned = false;
598         return ret;
599 }
600 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(uint64_t owner) {
601         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
602         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
603         uint64_t ret_ref = 0;
604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
606         return ret_ref;
607 }
608
609 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
610         LDKDecodeError ret = *owner->contents.err;
611         ret.is_owned = false;
612         return ret;
613 }
614 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(uint64_t owner) {
615         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
616         LDKDecodeError ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
617         uint64_t ret_ref = 0;
618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
620         return ret_ref;
621 }
622
623 static inline struct LDKSecretKey CResult_SecretKeyErrorZ_get_ok(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
624 CHECK(owner->result_ok);
625         return *owner->contents.result;
626 }
627 int8_tArray  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_get_ok"))) TS_CResult_SecretKeyErrorZ_get_ok(uint64_t owner) {
628         LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(owner);
629         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
630         memcpy(ret_arr->elems, CResult_SecretKeyErrorZ_get_ok(owner_conv).bytes, 32);
631         return ret_arr;
632 }
633
634 static inline enum LDKSecp256k1Error CResult_SecretKeyErrorZ_get_err(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){
635 CHECK(!owner->result_ok);
636         return *owner->contents.err;
637 }
638 uint32_t  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_get_err"))) TS_CResult_SecretKeyErrorZ_get_err(uint64_t owner) {
639         LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(owner);
640         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_SecretKeyErrorZ_get_err(owner_conv));
641         return ret_conv;
642 }
643
644 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
645 CHECK(owner->result_ok);
646         return *owner->contents.result;
647 }
648 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_ok"))) TS_CResult_PublicKeyErrorZ_get_ok(uint64_t owner) {
649         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
650         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
651         memcpy(ret_arr->elems, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form, 33);
652         return ret_arr;
653 }
654
655 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
656 CHECK(!owner->result_ok);
657         return *owner->contents.err;
658 }
659 uint32_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_err"))) TS_CResult_PublicKeyErrorZ_get_err(uint64_t owner) {
660         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
661         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PublicKeyErrorZ_get_err(owner_conv));
662         return ret_conv;
663 }
664
665 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
666         LDKTxCreationKeys ret = *owner->contents.result;
667         ret.is_owned = false;
668         return ret;
669 }
670 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_ok(uint64_t owner) {
671         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
672         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
673         uint64_t ret_ref = 0;
674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
676         return ret_ref;
677 }
678
679 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
680         LDKDecodeError ret = *owner->contents.err;
681         ret.is_owned = false;
682         return ret;
683 }
684 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_err(uint64_t owner) {
685         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
686         LDKDecodeError ret_var = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
687         uint64_t ret_ref = 0;
688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
690         return ret_ref;
691 }
692
693 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
694         LDKChannelPublicKeys ret = *owner->contents.result;
695         ret.is_owned = false;
696         return ret;
697 }
698 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint64_t owner) {
699         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
700         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
701         uint64_t ret_ref = 0;
702         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
703         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
704         return ret_ref;
705 }
706
707 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
708         LDKDecodeError ret = *owner->contents.err;
709         ret.is_owned = false;
710         return ret;
711 }
712 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err(uint64_t owner) {
713         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
714         LDKDecodeError ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
715         uint64_t ret_ref = 0;
716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
718         return ret_ref;
719 }
720
721 static inline struct LDKTxCreationKeys CResult_TxCreationKeysErrorZ_get_ok(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
722         LDKTxCreationKeys ret = *owner->contents.result;
723         ret.is_owned = false;
724         return ret;
725 }
726 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_get_ok"))) TS_CResult_TxCreationKeysErrorZ_get_ok(uint64_t owner) {
727         LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(owner);
728         LDKTxCreationKeys ret_var = CResult_TxCreationKeysErrorZ_get_ok(owner_conv);
729         uint64_t ret_ref = 0;
730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
732         return ret_ref;
733 }
734
735 static inline enum LDKSecp256k1Error CResult_TxCreationKeysErrorZ_get_err(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){
736 CHECK(!owner->result_ok);
737         return *owner->contents.err;
738 }
739 uint32_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_get_err"))) TS_CResult_TxCreationKeysErrorZ_get_err(uint64_t owner) {
740         LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(owner);
741         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_TxCreationKeysErrorZ_get_err(owner_conv));
742         return ret_conv;
743 }
744
745 uint32_t __attribute__((export_name("TS_LDKCOption_u32Z_ty_from_ptr"))) TS_LDKCOption_u32Z_ty_from_ptr(uint64_t ptr) {
746         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
747         switch(obj->tag) {
748                 case LDKCOption_u32Z_Some: return 0;
749                 case LDKCOption_u32Z_None: return 1;
750                 default: abort();
751         }
752 }
753 int32_t __attribute__((export_name("TS_LDKCOption_u32Z_Some_get_some"))) TS_LDKCOption_u32Z_Some_get_some(uint64_t ptr) {
754         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
755         assert(obj->tag == LDKCOption_u32Z_Some);
756                         int32_t some_conv = obj->some;
757         return some_conv;
758 }
759 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
760         LDKHTLCOutputInCommitment ret = *owner->contents.result;
761         ret.is_owned = false;
762         return ret;
763 }
764 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint64_t owner) {
765         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
766         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
767         uint64_t ret_ref = 0;
768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
770         return ret_ref;
771 }
772
773 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
774         LDKDecodeError ret = *owner->contents.err;
775         ret.is_owned = false;
776         return ret;
777 }
778 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint64_t owner) {
779         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
780         LDKDecodeError ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
781         uint64_t ret_ref = 0;
782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
784         return ret_ref;
785 }
786
787 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
788         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
789         ret.is_owned = false;
790         return ret;
791 }
792 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
793         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
794         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
795         uint64_t ret_ref = 0;
796         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
797         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
798         return ret_ref;
799 }
800
801 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
802         LDKDecodeError ret = *owner->contents.err;
803         ret.is_owned = false;
804         return ret;
805 }
806 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
807         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
808         LDKDecodeError ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
809         uint64_t ret_ref = 0;
810         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
811         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
812         return ret_ref;
813 }
814
815 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
816         LDKChannelTransactionParameters ret = *owner->contents.result;
817         ret.is_owned = false;
818         return ret;
819 }
820 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
821         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
822         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
823         uint64_t ret_ref = 0;
824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
826         return ret_ref;
827 }
828
829 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
830         LDKDecodeError ret = *owner->contents.err;
831         ret.is_owned = false;
832         return ret;
833 }
834 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
835         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
836         LDKDecodeError ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
837         uint64_t ret_ref = 0;
838         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
839         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
840         return ret_ref;
841 }
842
843 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
844         LDKHolderCommitmentTransaction ret = *owner->contents.result;
845         ret.is_owned = false;
846         return ret;
847 }
848 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
849         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
850         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
851         uint64_t ret_ref = 0;
852         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
853         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
854         return ret_ref;
855 }
856
857 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
858         LDKDecodeError ret = *owner->contents.err;
859         ret.is_owned = false;
860         return ret;
861 }
862 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
863         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
864         LDKDecodeError ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
865         uint64_t ret_ref = 0;
866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
868         return ret_ref;
869 }
870
871 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
872         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
873         ret.is_owned = false;
874         return ret;
875 }
876 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
877         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
878         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
879         uint64_t ret_ref = 0;
880         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
881         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
882         return ret_ref;
883 }
884
885 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
886         LDKDecodeError ret = *owner->contents.err;
887         ret.is_owned = false;
888         return ret;
889 }
890 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
891         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
892         LDKDecodeError ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
893         uint64_t ret_ref = 0;
894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
896         return ret_ref;
897 }
898
899 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
900         LDKTrustedClosingTransaction ret = *owner->contents.result;
901         ret.is_owned = false;
902         return ret;
903 }
904 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_get_ok(uint64_t owner) {
905         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
906         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
907         uint64_t ret_ref = 0;
908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
910         return ret_ref;
911 }
912
913 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
914 CHECK(!owner->result_ok);
915         return *owner->contents.err;
916 }
917 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_err"))) TS_CResult_TrustedClosingTransactionNoneZ_get_err(uint64_t owner) {
918         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
919         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
920 }
921
922 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
923         LDKCommitmentTransaction ret = *owner->contents.result;
924         ret.is_owned = false;
925         return ret;
926 }
927 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
928         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
929         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
930         uint64_t ret_ref = 0;
931         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
932         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
933         return ret_ref;
934 }
935
936 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
937         LDKDecodeError ret = *owner->contents.err;
938         ret.is_owned = false;
939         return ret;
940 }
941 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
942         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
943         LDKDecodeError ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
944         uint64_t ret_ref = 0;
945         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
946         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
947         return ret_ref;
948 }
949
950 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
951         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
952         ret.is_owned = false;
953         return ret;
954 }
955 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok(uint64_t owner) {
956         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
957         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
958         uint64_t ret_ref = 0;
959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
961         return ret_ref;
962 }
963
964 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
965 CHECK(!owner->result_ok);
966         return *owner->contents.err;
967 }
968 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_err(uint64_t owner) {
969         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
970         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
971 }
972
973 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
974 CHECK(owner->result_ok);
975         return *owner->contents.result;
976 }
977 ptrArray  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_ok"))) TS_CResult_CVec_SignatureZNoneZ_get_ok(uint64_t owner) {
978         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
979         LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
980         ptrArray ret_arr = NULL;
981         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
982         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
983         for (size_t m = 0; m < ret_var.datalen; m++) {
984                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
985                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
986                 ret_arr_ptr[m] = ret_conv_12_arr;
987         }
988         
989         return ret_arr;
990 }
991
992 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
993 CHECK(!owner->result_ok);
994         return *owner->contents.err;
995 }
996 void  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_err"))) TS_CResult_CVec_SignatureZNoneZ_get_err(uint64_t owner) {
997         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
998         CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
999 }
1000
1001 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1002         LDKShutdownScript ret = *owner->contents.result;
1003         ret.is_owned = false;
1004         return ret;
1005 }
1006 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_ok(uint64_t owner) {
1007         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
1008         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
1009         uint64_t ret_ref = 0;
1010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1012         return ret_ref;
1013 }
1014
1015 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1016         LDKDecodeError ret = *owner->contents.err;
1017         ret.is_owned = false;
1018         return ret;
1019 }
1020 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_err(uint64_t owner) {
1021         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
1022         LDKDecodeError ret_var = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
1023         uint64_t ret_ref = 0;
1024         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1025         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1026         return ret_ref;
1027 }
1028
1029 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1030         LDKShutdownScript ret = *owner->contents.result;
1031         ret.is_owned = false;
1032         return ret;
1033 }
1034 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint64_t owner) {
1035         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
1036         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_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 LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1044         LDKInvalidShutdownScript ret = *owner->contents.err;
1045         ret.is_owned = false;
1046         return ret;
1047 }
1048 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint64_t owner) {
1049         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
1050         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_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 struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1058         LDKRouteHop ret = *owner->contents.result;
1059         ret.is_owned = false;
1060         return ret;
1061 }
1062 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHopDecodeErrorZ_get_ok(uint64_t owner) {
1063         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
1064         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
1065         uint64_t ret_ref = 0;
1066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1068         return ret_ref;
1069 }
1070
1071 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
1072         LDKDecodeError ret = *owner->contents.err;
1073         ret.is_owned = false;
1074         return ret;
1075 }
1076 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_err"))) TS_CResult_RouteHopDecodeErrorZ_get_err(uint64_t owner) {
1077         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
1078         LDKDecodeError ret_var = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
1079         uint64_t ret_ref = 0;
1080         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1081         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1082         return ret_ref;
1083 }
1084
1085 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1086         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1087         for (size_t i = 0; i < ret.datalen; i++) {
1088                 ret.data[i] = RouteHop_clone(&orig->data[i]);
1089         }
1090         return ret;
1091 }
1092 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1093         LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1094         for (size_t i = 0; i < ret.datalen; i++) {
1095                 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1096         }
1097         return ret;
1098 }
1099 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1100         LDKRoute ret = *owner->contents.result;
1101         ret.is_owned = false;
1102         return ret;
1103 }
1104 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_ok"))) TS_CResult_RouteDecodeErrorZ_get_ok(uint64_t owner) {
1105         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
1106         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
1107         uint64_t ret_ref = 0;
1108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1109         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1110         return ret_ref;
1111 }
1112
1113 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
1114         LDKDecodeError ret = *owner->contents.err;
1115         ret.is_owned = false;
1116         return ret;
1117 }
1118 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_err"))) TS_CResult_RouteDecodeErrorZ_get_err(uint64_t owner) {
1119         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
1120         LDKDecodeError ret_var = CResult_RouteDecodeErrorZ_get_err(owner_conv);
1121         uint64_t ret_ref = 0;
1122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1124         return ret_ref;
1125 }
1126
1127 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1128         LDKRouteParameters ret = *owner->contents.result;
1129         ret.is_owned = false;
1130         return ret;
1131 }
1132 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_ok"))) TS_CResult_RouteParametersDecodeErrorZ_get_ok(uint64_t owner) {
1133         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
1134         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
1135         uint64_t ret_ref = 0;
1136         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1137         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1138         return ret_ref;
1139 }
1140
1141 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
1142         LDKDecodeError ret = *owner->contents.err;
1143         ret.is_owned = false;
1144         return ret;
1145 }
1146 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_err"))) TS_CResult_RouteParametersDecodeErrorZ_get_err(uint64_t owner) {
1147         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
1148         LDKDecodeError ret_var = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
1149         uint64_t ret_ref = 0;
1150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1152         return ret_ref;
1153 }
1154
1155 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1156         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1157         for (size_t i = 0; i < ret.datalen; i++) {
1158                 ret.data[i] = RouteHint_clone(&orig->data[i]);
1159         }
1160         return ret;
1161 }
1162 uint32_t __attribute__((export_name("TS_LDKCOption_u64Z_ty_from_ptr"))) TS_LDKCOption_u64Z_ty_from_ptr(uint64_t ptr) {
1163         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1164         switch(obj->tag) {
1165                 case LDKCOption_u64Z_Some: return 0;
1166                 case LDKCOption_u64Z_None: return 1;
1167                 default: abort();
1168         }
1169 }
1170 int64_t __attribute__((export_name("TS_LDKCOption_u64Z_Some_get_some"))) TS_LDKCOption_u64Z_Some_get_some(uint64_t ptr) {
1171         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1172         assert(obj->tag == LDKCOption_u64Z_Some);
1173                         int64_t some_conv = obj->some;
1174         return some_conv;
1175 }
1176 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
1177         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
1178         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
1179         return ret;
1180 }
1181 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1182         LDKPaymentParameters ret = *owner->contents.result;
1183         ret.is_owned = false;
1184         return ret;
1185 }
1186 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_get_ok(uint64_t owner) {
1187         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
1188         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
1189         uint64_t ret_ref = 0;
1190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1192         return ret_ref;
1193 }
1194
1195 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
1196         LDKDecodeError ret = *owner->contents.err;
1197         ret.is_owned = false;
1198         return ret;
1199 }
1200 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_err"))) TS_CResult_PaymentParametersDecodeErrorZ_get_err(uint64_t owner) {
1201         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
1202         LDKDecodeError ret_var = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
1203         uint64_t ret_ref = 0;
1204         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1205         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1206         return ret_ref;
1207 }
1208
1209 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
1210         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
1211         for (size_t i = 0; i < ret.datalen; i++) {
1212                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
1213         }
1214         return ret;
1215 }
1216 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1217         LDKRouteHint ret = *owner->contents.result;
1218         ret.is_owned = false;
1219         return ret;
1220 }
1221 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_ok"))) TS_CResult_RouteHintDecodeErrorZ_get_ok(uint64_t owner) {
1222         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
1223         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
1224         uint64_t ret_ref = 0;
1225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1227         return ret_ref;
1228 }
1229
1230 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
1231         LDKDecodeError ret = *owner->contents.err;
1232         ret.is_owned = false;
1233         return ret;
1234 }
1235 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_err"))) TS_CResult_RouteHintDecodeErrorZ_get_err(uint64_t owner) {
1236         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
1237         LDKDecodeError ret_var = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
1238         uint64_t ret_ref = 0;
1239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1241         return ret_ref;
1242 }
1243
1244 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1245         LDKRouteHintHop ret = *owner->contents.result;
1246         ret.is_owned = false;
1247         return ret;
1248 }
1249 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_get_ok(uint64_t owner) {
1250         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
1251         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
1252         uint64_t ret_ref = 0;
1253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1255         return ret_ref;
1256 }
1257
1258 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
1259         LDKDecodeError ret = *owner->contents.err;
1260         ret.is_owned = false;
1261         return ret;
1262 }
1263 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_err"))) TS_CResult_RouteHintHopDecodeErrorZ_get_err(uint64_t owner) {
1264         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
1265         LDKDecodeError ret_var = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
1266         uint64_t ret_ref = 0;
1267         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1268         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1269         return ret_ref;
1270 }
1271
1272 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1273         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1274         for (size_t i = 0; i < ret.datalen; i++) {
1275                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1276         }
1277         return ret;
1278 }
1279 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1280         LDKRoute ret = *owner->contents.result;
1281         ret.is_owned = false;
1282         return ret;
1283 }
1284 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_ok"))) TS_CResult_RouteLightningErrorZ_get_ok(uint64_t owner) {
1285         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
1286         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
1287         uint64_t ret_ref = 0;
1288         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1289         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1290         return ret_ref;
1291 }
1292
1293 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
1294         LDKLightningError ret = *owner->contents.err;
1295         ret.is_owned = false;
1296         return ret;
1297 }
1298 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_err"))) TS_CResult_RouteLightningErrorZ_get_err(uint64_t owner) {
1299         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
1300         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
1301         uint64_t ret_ref = 0;
1302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1304         return ret_ref;
1305 }
1306
1307 uint32_t __attribute__((export_name("TS_LDKPaymentPurpose_ty_from_ptr"))) TS_LDKPaymentPurpose_ty_from_ptr(uint64_t ptr) {
1308         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1309         switch(obj->tag) {
1310                 case LDKPaymentPurpose_InvoicePayment: return 0;
1311                 case LDKPaymentPurpose_SpontaneousPayment: return 1;
1312                 default: abort();
1313         }
1314 }
1315 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage(uint64_t ptr) {
1316         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1317         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1318                         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
1319                         memcpy(payment_preimage_arr->elems, obj->invoice_payment.payment_preimage.data, 32);
1320         return payment_preimage_arr;
1321 }
1322 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret(uint64_t ptr) {
1323         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1324         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
1325                         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
1326                         memcpy(payment_secret_arr->elems, obj->invoice_payment.payment_secret.data, 32);
1327         return payment_secret_arr;
1328 }
1329 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment"))) TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(uint64_t ptr) {
1330         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
1331         assert(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
1332                         int8_tArray spontaneous_payment_arr = init_int8_tArray(32, __LINE__);
1333                         memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
1334         return spontaneous_payment_arr;
1335 }
1336 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1337 CHECK(owner->result_ok);
1338         return PaymentPurpose_clone(&*owner->contents.result);
1339 }
1340 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_ok(uint64_t owner) {
1341         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
1342         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
1343         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
1344         uint64_t ret_ref = tag_ptr(ret_copy, true);
1345         return ret_ref;
1346 }
1347
1348 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
1349         LDKDecodeError ret = *owner->contents.err;
1350         ret.is_owned = false;
1351         return ret;
1352 }
1353 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_err(uint64_t owner) {
1354         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
1355         LDKDecodeError ret_var = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
1356         uint64_t ret_ref = 0;
1357         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1358         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1359         return ret_ref;
1360 }
1361
1362 uint32_t __attribute__((export_name("TS_LDKClosureReason_ty_from_ptr"))) TS_LDKClosureReason_ty_from_ptr(uint64_t ptr) {
1363         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
1364         switch(obj->tag) {
1365                 case LDKClosureReason_CounterpartyForceClosed: return 0;
1366                 case LDKClosureReason_HolderForceClosed: return 1;
1367                 case LDKClosureReason_CooperativeClosure: return 2;
1368                 case LDKClosureReason_CommitmentTxConfirmed: return 3;
1369                 case LDKClosureReason_FundingTimedOut: return 4;
1370                 case LDKClosureReason_ProcessingError: return 5;
1371                 case LDKClosureReason_DisconnectedPeer: return 6;
1372                 case LDKClosureReason_OutdatedChannelManager: return 7;
1373                 default: abort();
1374         }
1375 }
1376 jstring __attribute__((export_name("TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg"))) TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(uint64_t ptr) {
1377         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
1378         assert(obj->tag == LDKClosureReason_CounterpartyForceClosed);
1379                         LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
1380                         jstring peer_msg_conv = str_ref_to_ts(peer_msg_str.chars, peer_msg_str.len);
1381         return peer_msg_conv;
1382 }
1383 jstring __attribute__((export_name("TS_LDKClosureReason_ProcessingError_get_err"))) TS_LDKClosureReason_ProcessingError_get_err(uint64_t ptr) {
1384         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
1385         assert(obj->tag == LDKClosureReason_ProcessingError);
1386                         LDKStr err_str = obj->processing_error.err;
1387                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
1388         return err_conv;
1389 }
1390 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_ty_from_ptr"))) TS_LDKCOption_ClosureReasonZ_ty_from_ptr(uint64_t ptr) {
1391         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
1392         switch(obj->tag) {
1393                 case LDKCOption_ClosureReasonZ_Some: return 0;
1394                 case LDKCOption_ClosureReasonZ_None: return 1;
1395                 default: abort();
1396         }
1397 }
1398 uint64_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_Some_get_some"))) TS_LDKCOption_ClosureReasonZ_Some_get_some(uint64_t ptr) {
1399         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
1400         assert(obj->tag == LDKCOption_ClosureReasonZ_Some);
1401                         uint64_t some_ref = tag_ptr(&obj->some, false);
1402         return some_ref;
1403 }
1404 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
1405 CHECK(owner->result_ok);
1406         return COption_ClosureReasonZ_clone(&*owner->contents.result);
1407 }
1408 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint64_t owner) {
1409         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
1410         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
1411         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
1412         uint64_t ret_ref = tag_ptr(ret_copy, true);
1413         return ret_ref;
1414 }
1415
1416 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
1417         LDKDecodeError ret = *owner->contents.err;
1418         ret.is_owned = false;
1419         return ret;
1420 }
1421 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint64_t owner) {
1422         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
1423         LDKDecodeError ret_var = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
1424         uint64_t ret_ref = 0;
1425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1427         return ret_ref;
1428 }
1429
1430 uint32_t __attribute__((export_name("TS_LDKHTLCDestination_ty_from_ptr"))) TS_LDKHTLCDestination_ty_from_ptr(uint64_t ptr) {
1431         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1432         switch(obj->tag) {
1433                 case LDKHTLCDestination_NextHopChannel: return 0;
1434                 case LDKHTLCDestination_UnknownNextHop: return 1;
1435                 case LDKHTLCDestination_FailedPayment: return 2;
1436                 default: abort();
1437         }
1438 }
1439 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_node_id"))) TS_LDKHTLCDestination_NextHopChannel_get_node_id(uint64_t ptr) {
1440         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1441         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
1442                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
1443                         memcpy(node_id_arr->elems, obj->next_hop_channel.node_id.compressed_form, 33);
1444         return node_id_arr;
1445 }
1446 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_channel_id"))) TS_LDKHTLCDestination_NextHopChannel_get_channel_id(uint64_t ptr) {
1447         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1448         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
1449                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
1450                         memcpy(channel_id_arr->elems, obj->next_hop_channel.channel_id.data, 32);
1451         return channel_id_arr;
1452 }
1453 int64_t __attribute__((export_name("TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid"))) TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid(uint64_t ptr) {
1454         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1455         assert(obj->tag == LDKHTLCDestination_UnknownNextHop);
1456                         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
1457         return requested_forward_scid_conv;
1458 }
1459 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_FailedPayment_get_payment_hash"))) TS_LDKHTLCDestination_FailedPayment_get_payment_hash(uint64_t ptr) {
1460         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
1461         assert(obj->tag == LDKHTLCDestination_FailedPayment);
1462                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1463                         memcpy(payment_hash_arr->elems, obj->failed_payment.payment_hash.data, 32);
1464         return payment_hash_arr;
1465 }
1466 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_ty_from_ptr"))) TS_LDKCOption_HTLCDestinationZ_ty_from_ptr(uint64_t ptr) {
1467         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
1468         switch(obj->tag) {
1469                 case LDKCOption_HTLCDestinationZ_Some: return 0;
1470                 case LDKCOption_HTLCDestinationZ_None: return 1;
1471                 default: abort();
1472         }
1473 }
1474 uint64_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_Some_get_some"))) TS_LDKCOption_HTLCDestinationZ_Some_get_some(uint64_t ptr) {
1475         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
1476         assert(obj->tag == LDKCOption_HTLCDestinationZ_Some);
1477                         uint64_t some_ref = tag_ptr(&obj->some, false);
1478         return some_ref;
1479 }
1480 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
1481 CHECK(owner->result_ok);
1482         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
1483 }
1484 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(uint64_t owner) {
1485         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
1486         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
1487         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
1488         uint64_t ret_ref = tag_ptr(ret_copy, true);
1489         return ret_ref;
1490 }
1491
1492 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
1493         LDKDecodeError ret = *owner->contents.err;
1494         ret.is_owned = false;
1495         return ret;
1496 }
1497 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(uint64_t owner) {
1498         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
1499         LDKDecodeError ret_var = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
1500         uint64_t ret_ref = 0;
1501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1503         return ret_ref;
1504 }
1505
1506 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ty_from_ptr"))) TS_LDKNetworkUpdate_ty_from_ptr(uint64_t ptr) {
1507         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1508         switch(obj->tag) {
1509                 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
1510                 case LDKNetworkUpdate_ChannelFailure: return 1;
1511                 case LDKNetworkUpdate_NodeFailure: return 2;
1512                 default: abort();
1513         }
1514 }
1515 uint64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg"))) TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(uint64_t ptr) {
1516         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1517         assert(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
1518                         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1519                         uint64_t msg_ref = 0;
1520                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
1521                         msg_ref = tag_ptr(msg_var.inner, false);
1522         return msg_ref;
1523 }
1524 int64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id"))) TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id(uint64_t ptr) {
1525         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1526         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
1527                         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
1528         return short_channel_id_conv;
1529 }
1530 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent"))) TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent(uint64_t ptr) {
1531         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1532         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
1533                         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
1534         return is_permanent_conv;
1535 }
1536 int8_tArray __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_node_id"))) TS_LDKNetworkUpdate_NodeFailure_get_node_id(uint64_t ptr) {
1537         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1538         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1539                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
1540                         memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
1541         return node_id_arr;
1542 }
1543 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_is_permanent"))) TS_LDKNetworkUpdate_NodeFailure_get_is_permanent(uint64_t ptr) {
1544         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
1545         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
1546                         jboolean is_permanent_conv = obj->node_failure.is_permanent;
1547         return is_permanent_conv;
1548 }
1549 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_ty_from_ptr"))) TS_LDKCOption_NetworkUpdateZ_ty_from_ptr(uint64_t ptr) {
1550         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
1551         switch(obj->tag) {
1552                 case LDKCOption_NetworkUpdateZ_Some: return 0;
1553                 case LDKCOption_NetworkUpdateZ_None: return 1;
1554                 default: abort();
1555         }
1556 }
1557 uint64_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_Some_get_some"))) TS_LDKCOption_NetworkUpdateZ_Some_get_some(uint64_t ptr) {
1558         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
1559         assert(obj->tag == LDKCOption_NetworkUpdateZ_Some);
1560                         uint64_t some_ref = tag_ptr(&obj->some, false);
1561         return some_ref;
1562 }
1563 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_ty_from_ptr"))) TS_LDKSpendableOutputDescriptor_ty_from_ptr(uint64_t ptr) {
1564         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1565         switch(obj->tag) {
1566                 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
1567                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
1568                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
1569                 default: abort();
1570         }
1571 }
1572 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(uint64_t ptr) {
1573         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1574         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1575                         LDKOutPoint outpoint_var = obj->static_output.outpoint;
1576                         uint64_t outpoint_ref = 0;
1577                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1578                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
1579         return outpoint_ref;
1580 }
1581 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_output"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_output(uint64_t ptr) {
1582         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1583         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1584                         LDKTxOut* output_ref = &obj->static_output.output;
1585         return tag_ptr(output_ref, false);
1586 }
1587 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output"))) TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(uint64_t ptr) {
1588         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1589         assert(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
1590                         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1591                         uint64_t delayed_payment_output_ref = 0;
1592                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1593                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
1594         return delayed_payment_output_ref;
1595 }
1596 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output"))) TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(uint64_t ptr) {
1597         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1598         assert(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
1599                         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1600                         uint64_t static_payment_output_ref = 0;
1601                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1602                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
1603         return static_payment_output_ref;
1604 }
1605 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1606         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1607         for (size_t i = 0; i < ret.datalen; i++) {
1608                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1609         }
1610         return ret;
1611 }
1612 uint32_t __attribute__((export_name("TS_LDKEvent_ty_from_ptr"))) TS_LDKEvent_ty_from_ptr(uint64_t ptr) {
1613         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1614         switch(obj->tag) {
1615                 case LDKEvent_FundingGenerationReady: return 0;
1616                 case LDKEvent_PaymentReceived: return 1;
1617                 case LDKEvent_PaymentClaimed: return 2;
1618                 case LDKEvent_PaymentSent: return 3;
1619                 case LDKEvent_PaymentFailed: return 4;
1620                 case LDKEvent_PaymentPathSuccessful: return 5;
1621                 case LDKEvent_PaymentPathFailed: return 6;
1622                 case LDKEvent_ProbeSuccessful: return 7;
1623                 case LDKEvent_ProbeFailed: return 8;
1624                 case LDKEvent_PendingHTLCsForwardable: return 9;
1625                 case LDKEvent_SpendableOutputs: return 10;
1626                 case LDKEvent_PaymentForwarded: return 11;
1627                 case LDKEvent_ChannelClosed: return 12;
1628                 case LDKEvent_DiscardFunding: return 13;
1629                 case LDKEvent_OpenChannelRequest: return 14;
1630                 case LDKEvent_HTLCHandlingFailed: return 15;
1631                 default: abort();
1632         }
1633 }
1634 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id(uint64_t ptr) {
1635         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1636         assert(obj->tag == LDKEvent_FundingGenerationReady);
1637                         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
1638                         memcpy(temporary_channel_id_arr->elems, obj->funding_generation_ready.temporary_channel_id.data, 32);
1639         return temporary_channel_id_arr;
1640 }
1641 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id"))) TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id(uint64_t ptr) {
1642         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1643         assert(obj->tag == LDKEvent_FundingGenerationReady);
1644                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
1645                         memcpy(counterparty_node_id_arr->elems, obj->funding_generation_ready.counterparty_node_id.compressed_form, 33);
1646         return counterparty_node_id_arr;
1647 }
1648 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis"))) TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(uint64_t ptr) {
1649         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1650         assert(obj->tag == LDKEvent_FundingGenerationReady);
1651                         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
1652         return channel_value_satoshis_conv;
1653 }
1654 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_output_script"))) TS_LDKEvent_FundingGenerationReady_get_output_script(uint64_t ptr) {
1655         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1656         assert(obj->tag == LDKEvent_FundingGenerationReady);
1657                         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1658                         int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen, __LINE__);
1659                         memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
1660         return output_script_arr;
1661 }
1662 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_user_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_user_channel_id(uint64_t ptr) {
1663         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1664         assert(obj->tag == LDKEvent_FundingGenerationReady);
1665                         int64_t user_channel_id_conv = obj->funding_generation_ready.user_channel_id;
1666         return user_channel_id_conv;
1667 }
1668 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_payment_hash"))) TS_LDKEvent_PaymentReceived_get_payment_hash(uint64_t ptr) {
1669         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1670         assert(obj->tag == LDKEvent_PaymentReceived);
1671                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1672                         memcpy(payment_hash_arr->elems, obj->payment_received.payment_hash.data, 32);
1673         return payment_hash_arr;
1674 }
1675 int64_t __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_amount_msat"))) TS_LDKEvent_PaymentReceived_get_amount_msat(uint64_t ptr) {
1676         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1677         assert(obj->tag == LDKEvent_PaymentReceived);
1678                         int64_t amount_msat_conv = obj->payment_received.amount_msat;
1679         return amount_msat_conv;
1680 }
1681 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_purpose"))) TS_LDKEvent_PaymentReceived_get_purpose(uint64_t ptr) {
1682         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1683         assert(obj->tag == LDKEvent_PaymentReceived);
1684                         uint64_t purpose_ref = tag_ptr(&obj->payment_received.purpose, false);
1685         return purpose_ref;
1686 }
1687 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_payment_hash"))) TS_LDKEvent_PaymentClaimed_get_payment_hash(uint64_t ptr) {
1688         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1689         assert(obj->tag == LDKEvent_PaymentClaimed);
1690                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1691                         memcpy(payment_hash_arr->elems, obj->payment_claimed.payment_hash.data, 32);
1692         return payment_hash_arr;
1693 }
1694 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_amount_msat"))) TS_LDKEvent_PaymentClaimed_get_amount_msat(uint64_t ptr) {
1695         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1696         assert(obj->tag == LDKEvent_PaymentClaimed);
1697                         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
1698         return amount_msat_conv;
1699 }
1700 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_purpose"))) TS_LDKEvent_PaymentClaimed_get_purpose(uint64_t ptr) {
1701         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1702         assert(obj->tag == LDKEvent_PaymentClaimed);
1703                         uint64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
1704         return purpose_ref;
1705 }
1706 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_id"))) TS_LDKEvent_PaymentSent_get_payment_id(uint64_t ptr) {
1707         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1708         assert(obj->tag == LDKEvent_PaymentSent);
1709                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1710                         memcpy(payment_id_arr->elems, obj->payment_sent.payment_id.data, 32);
1711         return payment_id_arr;
1712 }
1713 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_preimage"))) TS_LDKEvent_PaymentSent_get_payment_preimage(uint64_t ptr) {
1714         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1715         assert(obj->tag == LDKEvent_PaymentSent);
1716                         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
1717                         memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
1718         return payment_preimage_arr;
1719 }
1720 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_hash"))) TS_LDKEvent_PaymentSent_get_payment_hash(uint64_t ptr) {
1721         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1722         assert(obj->tag == LDKEvent_PaymentSent);
1723                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1724                         memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
1725         return payment_hash_arr;
1726 }
1727 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_fee_paid_msat"))) TS_LDKEvent_PaymentSent_get_fee_paid_msat(uint64_t ptr) {
1728         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1729         assert(obj->tag == LDKEvent_PaymentSent);
1730                         uint64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
1731         return fee_paid_msat_ref;
1732 }
1733 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_id"))) TS_LDKEvent_PaymentFailed_get_payment_id(uint64_t ptr) {
1734         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1735         assert(obj->tag == LDKEvent_PaymentFailed);
1736                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1737                         memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
1738         return payment_id_arr;
1739 }
1740 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_hash"))) TS_LDKEvent_PaymentFailed_get_payment_hash(uint64_t ptr) {
1741         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1742         assert(obj->tag == LDKEvent_PaymentFailed);
1743                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1744                         memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
1745         return payment_hash_arr;
1746 }
1747 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_id"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_id(uint64_t ptr) {
1748         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1749         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1750                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1751                         memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
1752         return payment_id_arr;
1753 }
1754 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_hash"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_hash(uint64_t ptr) {
1755         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1756         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1757                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1758                         memcpy(payment_hash_arr->elems, obj->payment_path_successful.payment_hash.data, 32);
1759         return payment_hash_arr;
1760 }
1761 uint64_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_path"))) TS_LDKEvent_PaymentPathSuccessful_get_path(uint64_t ptr) {
1762         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1763         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
1764                         LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path;
1765                         uint64_tArray path_arr = NULL;
1766                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1767                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1768                         for (size_t k = 0; k < path_var.datalen; k++) {
1769                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1770                                 uint64_t path_conv_10_ref = 0;
1771                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1772                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1773                                 path_arr_ptr[k] = path_conv_10_ref;
1774                         }
1775                         
1776         return path_arr;
1777 }
1778 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_id"))) TS_LDKEvent_PaymentPathFailed_get_payment_id(uint64_t ptr) {
1779         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1780         assert(obj->tag == LDKEvent_PaymentPathFailed);
1781                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1782                         memcpy(payment_id_arr->elems, obj->payment_path_failed.payment_id.data, 32);
1783         return payment_id_arr;
1784 }
1785 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_hash"))) TS_LDKEvent_PaymentPathFailed_get_payment_hash(uint64_t ptr) {
1786         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1787         assert(obj->tag == LDKEvent_PaymentPathFailed);
1788                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1789                         memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
1790         return payment_hash_arr;
1791 }
1792 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently"))) TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently(uint64_t ptr) {
1793         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1794         assert(obj->tag == LDKEvent_PaymentPathFailed);
1795                         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
1796         return payment_failed_permanently_conv;
1797 }
1798 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_network_update"))) TS_LDKEvent_PaymentPathFailed_get_network_update(uint64_t ptr) {
1799         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1800         assert(obj->tag == LDKEvent_PaymentPathFailed);
1801                         uint64_t network_update_ref = tag_ptr(&obj->payment_path_failed.network_update, false);
1802         return network_update_ref;
1803 }
1804 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_all_paths_failed"))) TS_LDKEvent_PaymentPathFailed_get_all_paths_failed(uint64_t ptr) {
1805         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1806         assert(obj->tag == LDKEvent_PaymentPathFailed);
1807                         jboolean all_paths_failed_conv = obj->payment_path_failed.all_paths_failed;
1808         return all_paths_failed_conv;
1809 }
1810 uint64_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_path"))) TS_LDKEvent_PaymentPathFailed_get_path(uint64_t ptr) {
1811         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1812         assert(obj->tag == LDKEvent_PaymentPathFailed);
1813                         LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
1814                         uint64_tArray path_arr = NULL;
1815                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1816                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1817                         for (size_t k = 0; k < path_var.datalen; k++) {
1818                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1819                                 uint64_t path_conv_10_ref = 0;
1820                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1821                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1822                                 path_arr_ptr[k] = path_conv_10_ref;
1823                         }
1824                         
1825         return path_arr;
1826 }
1827 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_short_channel_id"))) TS_LDKEvent_PaymentPathFailed_get_short_channel_id(uint64_t ptr) {
1828         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1829         assert(obj->tag == LDKEvent_PaymentPathFailed);
1830                         uint64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
1831         return short_channel_id_ref;
1832 }
1833 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_retry"))) TS_LDKEvent_PaymentPathFailed_get_retry(uint64_t ptr) {
1834         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1835         assert(obj->tag == LDKEvent_PaymentPathFailed);
1836                         LDKRouteParameters retry_var = obj->payment_path_failed.retry;
1837                         uint64_t retry_ref = 0;
1838                         CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_var);
1839                         retry_ref = tag_ptr(retry_var.inner, false);
1840         return retry_ref;
1841 }
1842 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_id"))) TS_LDKEvent_ProbeSuccessful_get_payment_id(uint64_t ptr) {
1843         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1844         assert(obj->tag == LDKEvent_ProbeSuccessful);
1845                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1846                         memcpy(payment_id_arr->elems, obj->probe_successful.payment_id.data, 32);
1847         return payment_id_arr;
1848 }
1849 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_hash"))) TS_LDKEvent_ProbeSuccessful_get_payment_hash(uint64_t ptr) {
1850         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1851         assert(obj->tag == LDKEvent_ProbeSuccessful);
1852                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1853                         memcpy(payment_hash_arr->elems, obj->probe_successful.payment_hash.data, 32);
1854         return payment_hash_arr;
1855 }
1856 uint64_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_path"))) TS_LDKEvent_ProbeSuccessful_get_path(uint64_t ptr) {
1857         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1858         assert(obj->tag == LDKEvent_ProbeSuccessful);
1859                         LDKCVec_RouteHopZ path_var = obj->probe_successful.path;
1860                         uint64_tArray path_arr = NULL;
1861                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1862                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1863                         for (size_t k = 0; k < path_var.datalen; k++) {
1864                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1865                                 uint64_t path_conv_10_ref = 0;
1866                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1867                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1868                                 path_arr_ptr[k] = path_conv_10_ref;
1869                         }
1870                         
1871         return path_arr;
1872 }
1873 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_id"))) TS_LDKEvent_ProbeFailed_get_payment_id(uint64_t ptr) {
1874         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1875         assert(obj->tag == LDKEvent_ProbeFailed);
1876                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
1877                         memcpy(payment_id_arr->elems, obj->probe_failed.payment_id.data, 32);
1878         return payment_id_arr;
1879 }
1880 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_hash"))) TS_LDKEvent_ProbeFailed_get_payment_hash(uint64_t ptr) {
1881         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1882         assert(obj->tag == LDKEvent_ProbeFailed);
1883                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
1884                         memcpy(payment_hash_arr->elems, obj->probe_failed.payment_hash.data, 32);
1885         return payment_hash_arr;
1886 }
1887 uint64_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_path"))) TS_LDKEvent_ProbeFailed_get_path(uint64_t ptr) {
1888         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1889         assert(obj->tag == LDKEvent_ProbeFailed);
1890                         LDKCVec_RouteHopZ path_var = obj->probe_failed.path;
1891                         uint64_tArray path_arr = NULL;
1892                         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
1893                         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
1894                         for (size_t k = 0; k < path_var.datalen; k++) {
1895                                 LDKRouteHop path_conv_10_var = path_var.data[k];
1896                                 uint64_t path_conv_10_ref = 0;
1897                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
1898                                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, false);
1899                                 path_arr_ptr[k] = path_conv_10_ref;
1900                         }
1901                         
1902         return path_arr;
1903 }
1904 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_short_channel_id"))) TS_LDKEvent_ProbeFailed_get_short_channel_id(uint64_t ptr) {
1905         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1906         assert(obj->tag == LDKEvent_ProbeFailed);
1907                         uint64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
1908         return short_channel_id_ref;
1909 }
1910 int64_t __attribute__((export_name("TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable"))) TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(uint64_t ptr) {
1911         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1912         assert(obj->tag == LDKEvent_PendingHTLCsForwardable);
1913                         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
1914         return time_forwardable_conv;
1915 }
1916 uint64_tArray __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_outputs"))) TS_LDKEvent_SpendableOutputs_get_outputs(uint64_t ptr) {
1917         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1918         assert(obj->tag == LDKEvent_SpendableOutputs);
1919                         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1920                         uint64_tArray outputs_arr = NULL;
1921                         outputs_arr = init_uint64_tArray(outputs_var.datalen, __LINE__);
1922                         uint64_t *outputs_arr_ptr = (uint64_t*)(((uint8_t*)outputs_arr) + 8);
1923                         for (size_t b = 0; b < outputs_var.datalen; b++) {
1924                                 uint64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
1925                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
1926                         }
1927                         
1928         return outputs_arr;
1929 }
1930 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_prev_channel_id"))) TS_LDKEvent_PaymentForwarded_get_prev_channel_id(uint64_t ptr) {
1931         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1932         assert(obj->tag == LDKEvent_PaymentForwarded);
1933                         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
1934                         memcpy(prev_channel_id_arr->elems, obj->payment_forwarded.prev_channel_id.data, 32);
1935         return prev_channel_id_arr;
1936 }
1937 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_next_channel_id"))) TS_LDKEvent_PaymentForwarded_get_next_channel_id(uint64_t ptr) {
1938         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1939         assert(obj->tag == LDKEvent_PaymentForwarded);
1940                         int8_tArray next_channel_id_arr = init_int8_tArray(32, __LINE__);
1941                         memcpy(next_channel_id_arr->elems, obj->payment_forwarded.next_channel_id.data, 32);
1942         return next_channel_id_arr;
1943 }
1944 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_fee_earned_msat"))) TS_LDKEvent_PaymentForwarded_get_fee_earned_msat(uint64_t ptr) {
1945         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1946         assert(obj->tag == LDKEvent_PaymentForwarded);
1947                         uint64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
1948         return fee_earned_msat_ref;
1949 }
1950 jboolean __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx"))) TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(uint64_t ptr) {
1951         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1952         assert(obj->tag == LDKEvent_PaymentForwarded);
1953                         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
1954         return claim_from_onchain_tx_conv;
1955 }
1956 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_id"))) TS_LDKEvent_ChannelClosed_get_channel_id(uint64_t ptr) {
1957         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1958         assert(obj->tag == LDKEvent_ChannelClosed);
1959                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
1960                         memcpy(channel_id_arr->elems, obj->channel_closed.channel_id.data, 32);
1961         return channel_id_arr;
1962 }
1963 int64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_user_channel_id"))) TS_LDKEvent_ChannelClosed_get_user_channel_id(uint64_t ptr) {
1964         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1965         assert(obj->tag == LDKEvent_ChannelClosed);
1966                         int64_t user_channel_id_conv = obj->channel_closed.user_channel_id;
1967         return user_channel_id_conv;
1968 }
1969 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_reason"))) TS_LDKEvent_ChannelClosed_get_reason(uint64_t ptr) {
1970         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1971         assert(obj->tag == LDKEvent_ChannelClosed);
1972                         uint64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
1973         return reason_ref;
1974 }
1975 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_channel_id"))) TS_LDKEvent_DiscardFunding_get_channel_id(uint64_t ptr) {
1976         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1977         assert(obj->tag == LDKEvent_DiscardFunding);
1978                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
1979                         memcpy(channel_id_arr->elems, obj->discard_funding.channel_id.data, 32);
1980         return channel_id_arr;
1981 }
1982 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_transaction"))) TS_LDKEvent_DiscardFunding_get_transaction(uint64_t ptr) {
1983         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1984         assert(obj->tag == LDKEvent_DiscardFunding);
1985                         LDKTransaction transaction_var = obj->discard_funding.transaction;
1986                         int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen, __LINE__);
1987                         memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
1988         return transaction_arr;
1989 }
1990 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id"))) TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id(uint64_t ptr) {
1991         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1992         assert(obj->tag == LDKEvent_OpenChannelRequest);
1993                         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
1994                         memcpy(temporary_channel_id_arr->elems, obj->open_channel_request.temporary_channel_id.data, 32);
1995         return temporary_channel_id_arr;
1996 }
1997 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id"))) TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id(uint64_t ptr) {
1998         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
1999         assert(obj->tag == LDKEvent_OpenChannelRequest);
2000                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
2001                         memcpy(counterparty_node_id_arr->elems, obj->open_channel_request.counterparty_node_id.compressed_form, 33);
2002         return counterparty_node_id_arr;
2003 }
2004 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_funding_satoshis"))) TS_LDKEvent_OpenChannelRequest_get_funding_satoshis(uint64_t ptr) {
2005         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2006         assert(obj->tag == LDKEvent_OpenChannelRequest);
2007                         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
2008         return funding_satoshis_conv;
2009 }
2010 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_push_msat"))) TS_LDKEvent_OpenChannelRequest_get_push_msat(uint64_t ptr) {
2011         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2012         assert(obj->tag == LDKEvent_OpenChannelRequest);
2013                         int64_t push_msat_conv = obj->open_channel_request.push_msat;
2014         return push_msat_conv;
2015 }
2016 uint64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_channel_type"))) TS_LDKEvent_OpenChannelRequest_get_channel_type(uint64_t ptr) {
2017         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2018         assert(obj->tag == LDKEvent_OpenChannelRequest);
2019                         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
2020                         uint64_t channel_type_ref = 0;
2021                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
2022                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
2023         return channel_type_ref;
2024 }
2025 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id"))) TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id(uint64_t ptr) {
2026         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2027         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
2028                         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
2029                         memcpy(prev_channel_id_arr->elems, obj->htlc_handling_failed.prev_channel_id.data, 32);
2030         return prev_channel_id_arr;
2031 }
2032 uint64_t __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination"))) TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination(uint64_t ptr) {
2033         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
2034         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
2035                         uint64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
2036         return failed_next_destination_ref;
2037 }
2038 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_ty_from_ptr"))) TS_LDKCOption_EventZ_ty_from_ptr(uint64_t ptr) {
2039         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
2040         switch(obj->tag) {
2041                 case LDKCOption_EventZ_Some: return 0;
2042                 case LDKCOption_EventZ_None: return 1;
2043                 default: abort();
2044         }
2045 }
2046 uint64_t __attribute__((export_name("TS_LDKCOption_EventZ_Some_get_some"))) TS_LDKCOption_EventZ_Some_get_some(uint64_t ptr) {
2047         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
2048         assert(obj->tag == LDKCOption_EventZ_Some);
2049                         uint64_t some_ref = tag_ptr(&obj->some, false);
2050         return some_ref;
2051 }
2052 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2053 CHECK(owner->result_ok);
2054         return COption_EventZ_clone(&*owner->contents.result);
2055 }
2056 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_ok"))) TS_CResult_COption_EventZDecodeErrorZ_get_ok(uint64_t owner) {
2057         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
2058         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
2059         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
2060         uint64_t ret_ref = tag_ptr(ret_copy, true);
2061         return ret_ref;
2062 }
2063
2064 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
2065         LDKDecodeError ret = *owner->contents.err;
2066         ret.is_owned = false;
2067         return ret;
2068 }
2069 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_err"))) TS_CResult_COption_EventZDecodeErrorZ_get_err(uint64_t owner) {
2070         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
2071         LDKDecodeError ret_var = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
2072         uint64_t ret_ref = 0;
2073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2075         return ret_ref;
2076 }
2077
2078 uint32_t __attribute__((export_name("TS_LDKErrorAction_ty_from_ptr"))) TS_LDKErrorAction_ty_from_ptr(uint64_t ptr) {
2079         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2080         switch(obj->tag) {
2081                 case LDKErrorAction_DisconnectPeer: return 0;
2082                 case LDKErrorAction_IgnoreError: return 1;
2083                 case LDKErrorAction_IgnoreAndLog: return 2;
2084                 case LDKErrorAction_IgnoreDuplicateGossip: return 3;
2085                 case LDKErrorAction_SendErrorMessage: return 4;
2086                 case LDKErrorAction_SendWarningMessage: return 5;
2087                 default: abort();
2088         }
2089 }
2090 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeer_get_msg"))) TS_LDKErrorAction_DisconnectPeer_get_msg(uint64_t ptr) {
2091         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2092         assert(obj->tag == LDKErrorAction_DisconnectPeer);
2093                         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
2094                         uint64_t msg_ref = 0;
2095                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2096                         msg_ref = tag_ptr(msg_var.inner, false);
2097         return msg_ref;
2098 }
2099 uint32_t __attribute__((export_name("TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log"))) TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(uint64_t ptr) {
2100         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2101         assert(obj->tag == LDKErrorAction_IgnoreAndLog);
2102                         uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
2103         return ignore_and_log_conv;
2104 }
2105 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendErrorMessage_get_msg"))) TS_LDKErrorAction_SendErrorMessage_get_msg(uint64_t ptr) {
2106         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2107         assert(obj->tag == LDKErrorAction_SendErrorMessage);
2108                         LDKErrorMessage msg_var = obj->send_error_message.msg;
2109                         uint64_t msg_ref = 0;
2110                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2111                         msg_ref = tag_ptr(msg_var.inner, false);
2112         return msg_ref;
2113 }
2114 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_msg"))) TS_LDKErrorAction_SendWarningMessage_get_msg(uint64_t ptr) {
2115         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2116         assert(obj->tag == LDKErrorAction_SendWarningMessage);
2117                         LDKWarningMessage msg_var = obj->send_warning_message.msg;
2118                         uint64_t msg_ref = 0;
2119                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2120                         msg_ref = tag_ptr(msg_var.inner, false);
2121         return msg_ref;
2122 }
2123 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_log_level"))) TS_LDKErrorAction_SendWarningMessage_get_log_level(uint64_t ptr) {
2124         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
2125         assert(obj->tag == LDKErrorAction_SendWarningMessage);
2126                         uint32_t log_level_conv = LDKLevel_to_js(obj->send_warning_message.log_level);
2127         return log_level_conv;
2128 }
2129 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_ty_from_ptr"))) TS_LDKMessageSendEvent_ty_from_ptr(uint64_t ptr) {
2130         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2131         switch(obj->tag) {
2132                 case LDKMessageSendEvent_SendAcceptChannel: return 0;
2133                 case LDKMessageSendEvent_SendOpenChannel: return 1;
2134                 case LDKMessageSendEvent_SendFundingCreated: return 2;
2135                 case LDKMessageSendEvent_SendFundingSigned: return 3;
2136                 case LDKMessageSendEvent_SendChannelReady: return 4;
2137                 case LDKMessageSendEvent_SendAnnouncementSignatures: return 5;
2138                 case LDKMessageSendEvent_UpdateHTLCs: return 6;
2139                 case LDKMessageSendEvent_SendRevokeAndACK: return 7;
2140                 case LDKMessageSendEvent_SendClosingSigned: return 8;
2141                 case LDKMessageSendEvent_SendShutdown: return 9;
2142                 case LDKMessageSendEvent_SendChannelReestablish: return 10;
2143                 case LDKMessageSendEvent_SendChannelAnnouncement: return 11;
2144                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 12;
2145                 case LDKMessageSendEvent_BroadcastChannelUpdate: return 13;
2146                 case LDKMessageSendEvent_SendChannelUpdate: return 14;
2147                 case LDKMessageSendEvent_HandleError: return 15;
2148                 case LDKMessageSendEvent_SendChannelRangeQuery: return 16;
2149                 case LDKMessageSendEvent_SendShortIdsQuery: return 17;
2150                 case LDKMessageSendEvent_SendReplyChannelRange: return 18;
2151                 case LDKMessageSendEvent_SendGossipTimestampFilter: return 19;
2152                 default: abort();
2153         }
2154 }
2155 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id(uint64_t ptr) {
2156         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2157         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2158                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2159                         memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
2160         return node_id_arr;
2161 }
2162 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_msg(uint64_t ptr) {
2163         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2164         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
2165                         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
2166                         uint64_t msg_ref = 0;
2167                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2168                         msg_ref = tag_ptr(msg_var.inner, false);
2169         return msg_ref;
2170 }
2171 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannel_get_node_id(uint64_t ptr) {
2172         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2173         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2174                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2175                         memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
2176         return node_id_arr;
2177 }
2178 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannel_get_msg(uint64_t ptr) {
2179         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2180         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
2181                         LDKOpenChannel msg_var = obj->send_open_channel.msg;
2182                         uint64_t msg_ref = 0;
2183                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2184                         msg_ref = tag_ptr(msg_var.inner, false);
2185         return msg_ref;
2186 }
2187 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_node_id"))) TS_LDKMessageSendEvent_SendFundingCreated_get_node_id(uint64_t ptr) {
2188         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2189         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2190                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2191                         memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
2192         return node_id_arr;
2193 }
2194 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_msg"))) TS_LDKMessageSendEvent_SendFundingCreated_get_msg(uint64_t ptr) {
2195         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2196         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
2197                         LDKFundingCreated msg_var = obj->send_funding_created.msg;
2198                         uint64_t msg_ref = 0;
2199                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2200                         msg_ref = tag_ptr(msg_var.inner, false);
2201         return msg_ref;
2202 }
2203 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendFundingSigned_get_node_id(uint64_t ptr) {
2204         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2205         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2206                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2207                         memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
2208         return node_id_arr;
2209 }
2210 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_msg"))) TS_LDKMessageSendEvent_SendFundingSigned_get_msg(uint64_t ptr) {
2211         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2212         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
2213                         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
2214                         uint64_t msg_ref = 0;
2215                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2216                         msg_ref = tag_ptr(msg_var.inner, false);
2217         return msg_ref;
2218 }
2219 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReady_get_node_id(uint64_t ptr) {
2220         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2221         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
2222                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2223                         memcpy(node_id_arr->elems, obj->send_channel_ready.node_id.compressed_form, 33);
2224         return node_id_arr;
2225 }
2226 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_msg"))) TS_LDKMessageSendEvent_SendChannelReady_get_msg(uint64_t ptr) {
2227         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2228         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
2229                         LDKChannelReady msg_var = obj->send_channel_ready.msg;
2230                         uint64_t msg_ref = 0;
2231                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2232                         msg_ref = tag_ptr(msg_var.inner, false);
2233         return msg_ref;
2234 }
2235 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(uint64_t ptr) {
2236         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2237         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2238                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2239                         memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
2240         return node_id_arr;
2241 }
2242 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(uint64_t ptr) {
2243         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2244         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
2245                         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
2246                         uint64_t msg_ref = 0;
2247                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2248                         msg_ref = tag_ptr(msg_var.inner, false);
2249         return msg_ref;
2250 }
2251 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id(uint64_t ptr) {
2252         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2253         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
2254                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2255                         memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
2256         return node_id_arr;
2257 }
2258 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_updates"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_updates(uint64_t ptr) {
2259         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2260         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
2261                         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
2262                         uint64_t updates_ref = 0;
2263                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
2264                         updates_ref = tag_ptr(updates_var.inner, false);
2265         return updates_ref;
2266 }
2267 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(uint64_t ptr) {
2268         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2269         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
2270                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2271                         memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
2272         return node_id_arr;
2273 }
2274 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg(uint64_t ptr) {
2275         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2276         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
2277                         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
2278                         uint64_t msg_ref = 0;
2279                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2280                         msg_ref = tag_ptr(msg_var.inner, false);
2281         return msg_ref;
2282 }
2283 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendClosingSigned_get_node_id(uint64_t ptr) {
2284         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2285         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
2286                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2287                         memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
2288         return node_id_arr;
2289 }
2290 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_msg"))) TS_LDKMessageSendEvent_SendClosingSigned_get_msg(uint64_t ptr) {
2291         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2292         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
2293                         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
2294                         uint64_t msg_ref = 0;
2295                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2296                         msg_ref = tag_ptr(msg_var.inner, false);
2297         return msg_ref;
2298 }
2299 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_node_id"))) TS_LDKMessageSendEvent_SendShutdown_get_node_id(uint64_t ptr) {
2300         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2301         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
2302                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2303                         memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
2304         return node_id_arr;
2305 }
2306 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_msg"))) TS_LDKMessageSendEvent_SendShutdown_get_msg(uint64_t ptr) {
2307         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2308         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
2309                         LDKShutdown msg_var = obj->send_shutdown.msg;
2310                         uint64_t msg_ref = 0;
2311                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2312                         msg_ref = tag_ptr(msg_var.inner, false);
2313         return msg_ref;
2314 }
2315 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id(uint64_t ptr) {
2316         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2317         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
2318                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2319                         memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
2320         return node_id_arr;
2321 }
2322 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_msg"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_msg(uint64_t ptr) {
2323         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2324         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
2325                         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
2326                         uint64_t msg_ref = 0;
2327                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2328                         msg_ref = tag_ptr(msg_var.inner, false);
2329         return msg_ref;
2330 }
2331 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id(uint64_t ptr) {
2332         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2333         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
2334                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2335                         memcpy(node_id_arr->elems, obj->send_channel_announcement.node_id.compressed_form, 33);
2336         return node_id_arr;
2337 }
2338 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg(uint64_t ptr) {
2339         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2340         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
2341                         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
2342                         uint64_t msg_ref = 0;
2343                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2344                         msg_ref = tag_ptr(msg_var.inner, false);
2345         return msg_ref;
2346 }
2347 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg(uint64_t ptr) {
2348         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2349         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
2350                         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
2351                         uint64_t update_msg_ref = 0;
2352                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
2353                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
2354         return update_msg_ref;
2355 }
2356 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(uint64_t ptr) {
2357         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2358         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
2359                         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
2360                         uint64_t msg_ref = 0;
2361                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2362                         msg_ref = tag_ptr(msg_var.inner, false);
2363         return msg_ref;
2364 }
2365 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(uint64_t ptr) {
2366         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2367         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
2368                         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
2369                         uint64_t update_msg_ref = 0;
2370                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
2371                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
2372         return update_msg_ref;
2373 }
2374 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(uint64_t ptr) {
2375         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2376         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
2377                         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
2378                         uint64_t msg_ref = 0;
2379                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2380                         msg_ref = tag_ptr(msg_var.inner, false);
2381         return msg_ref;
2382 }
2383 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id(uint64_t ptr) {
2384         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2385         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
2386                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2387                         memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
2388         return node_id_arr;
2389 }
2390 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_msg(uint64_t ptr) {
2391         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2392         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
2393                         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
2394                         uint64_t msg_ref = 0;
2395                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2396                         msg_ref = tag_ptr(msg_var.inner, false);
2397         return msg_ref;
2398 }
2399 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_node_id"))) TS_LDKMessageSendEvent_HandleError_get_node_id(uint64_t ptr) {
2400         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2401         assert(obj->tag == LDKMessageSendEvent_HandleError);
2402                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2403                         memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
2404         return node_id_arr;
2405 }
2406 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_action"))) TS_LDKMessageSendEvent_HandleError_get_action(uint64_t ptr) {
2407         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2408         assert(obj->tag == LDKMessageSendEvent_HandleError);
2409                         uint64_t action_ref = tag_ptr(&obj->handle_error.action, false);
2410         return action_ref;
2411 }
2412 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(uint64_t ptr) {
2413         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2414         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
2415                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2416                         memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
2417         return node_id_arr;
2418 }
2419 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(uint64_t ptr) {
2420         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2421         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
2422                         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
2423                         uint64_t msg_ref = 0;
2424                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2425                         msg_ref = tag_ptr(msg_var.inner, false);
2426         return msg_ref;
2427 }
2428 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(uint64_t ptr) {
2429         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2430         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
2431                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2432                         memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
2433         return node_id_arr;
2434 }
2435 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg(uint64_t ptr) {
2436         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2437         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
2438                         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
2439                         uint64_t msg_ref = 0;
2440                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2441                         msg_ref = tag_ptr(msg_var.inner, false);
2442         return msg_ref;
2443 }
2444 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(uint64_t ptr) {
2445         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2446         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
2447                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2448                         memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
2449         return node_id_arr;
2450 }
2451 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg(uint64_t ptr) {
2452         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2453         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
2454                         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
2455                         uint64_t msg_ref = 0;
2456                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2457                         msg_ref = tag_ptr(msg_var.inner, false);
2458         return msg_ref;
2459 }
2460 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id(uint64_t ptr) {
2461         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2462         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
2463                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
2464                         memcpy(node_id_arr->elems, obj->send_gossip_timestamp_filter.node_id.compressed_form, 33);
2465         return node_id_arr;
2466 }
2467 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg(uint64_t ptr) {
2468         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
2469         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
2470                         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
2471                         uint64_t msg_ref = 0;
2472                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2473                         msg_ref = tag_ptr(msg_var.inner, false);
2474         return msg_ref;
2475 }
2476 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
2477         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
2478         for (size_t i = 0; i < ret.datalen; i++) {
2479                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
2480         }
2481         return ret;
2482 }
2483 static inline struct LDKTxOut CResult_TxOutAccessErrorZ_get_ok(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
2484 CHECK(owner->result_ok);
2485         return TxOut_clone(&*owner->contents.result);
2486 }
2487 uint64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_get_ok"))) TS_CResult_TxOutAccessErrorZ_get_ok(uint64_t owner) {
2488         LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(owner);
2489         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
2490         *ret_ref = CResult_TxOutAccessErrorZ_get_ok(owner_conv);
2491         return tag_ptr(ret_ref, true);
2492 }
2493
2494 static inline enum LDKAccessError CResult_TxOutAccessErrorZ_get_err(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){
2495 CHECK(!owner->result_ok);
2496         return AccessError_clone(&*owner->contents.err);
2497 }
2498 uint32_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_get_err"))) TS_CResult_TxOutAccessErrorZ_get_err(uint64_t owner) {
2499         LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(owner);
2500         uint32_t ret_conv = LDKAccessError_to_js(CResult_TxOutAccessErrorZ_get_err(owner_conv));
2501         return ret_conv;
2502 }
2503
2504 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2505         return owner->a;
2506 }
2507 uint32_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_a"))) TS_C2Tuple_usizeTransactionZ_get_a(uint64_t owner) {
2508         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2509         uint32_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
2510         return ret_conv;
2511 }
2512
2513 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2514         return owner->b;
2515 }
2516 int8_tArray  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_b"))) TS_C2Tuple_usizeTransactionZ_get_b(uint64_t owner) {
2517         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2518         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
2519         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2520         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2521         return ret_arr;
2522 }
2523
2524 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
2525         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
2526         for (size_t i = 0; i < ret.datalen; i++) {
2527                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
2528         }
2529         return ret;
2530 }
2531 static inline LDKCVec_TxidZ CVec_TxidZ_clone(const LDKCVec_TxidZ *orig) {
2532         LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
2533         for (size_t i = 0; i < ret.datalen; i++) {
2534                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
2535         }
2536         return ret;
2537 }
2538 static inline void CResult_NoneChannelMonitorUpdateErrZ_get_ok(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
2539 CHECK(owner->result_ok);
2540         return *owner->contents.result;
2541 }
2542 void  __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_get_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_get_ok(uint64_t owner) {
2543         LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(owner);
2544         CResult_NoneChannelMonitorUpdateErrZ_get_ok(owner_conv);
2545 }
2546
2547 static inline enum LDKChannelMonitorUpdateErr CResult_NoneChannelMonitorUpdateErrZ_get_err(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR owner){
2548 CHECK(!owner->result_ok);
2549         return ChannelMonitorUpdateErr_clone(&*owner->contents.err);
2550 }
2551 uint32_t  __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_get_err"))) TS_CResult_NoneChannelMonitorUpdateErrZ_get_err(uint64_t owner) {
2552         LDKCResult_NoneChannelMonitorUpdateErrZ* owner_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(owner);
2553         uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(CResult_NoneChannelMonitorUpdateErrZ_get_err(owner_conv));
2554         return ret_conv;
2555 }
2556
2557 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_ty_from_ptr"))) TS_LDKMonitorEvent_ty_from_ptr(uint64_t ptr) {
2558         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2559         switch(obj->tag) {
2560                 case LDKMonitorEvent_HTLCEvent: return 0;
2561                 case LDKMonitorEvent_CommitmentTxConfirmed: return 1;
2562                 case LDKMonitorEvent_UpdateCompleted: return 2;
2563                 case LDKMonitorEvent_UpdateFailed: return 3;
2564                 default: abort();
2565         }
2566 }
2567 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HTLCEvent_get_htlc_event"))) TS_LDKMonitorEvent_HTLCEvent_get_htlc_event(uint64_t ptr) {
2568         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2569         assert(obj->tag == LDKMonitorEvent_HTLCEvent);
2570                         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
2571                         uint64_t htlc_event_ref = 0;
2572                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
2573                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
2574         return htlc_event_ref;
2575 }
2576 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed"))) TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed(uint64_t ptr) {
2577         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2578         assert(obj->tag == LDKMonitorEvent_CommitmentTxConfirmed);
2579                         LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
2580                         uint64_t commitment_tx_confirmed_ref = 0;
2581                         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
2582                         commitment_tx_confirmed_ref = tag_ptr(commitment_tx_confirmed_var.inner, false);
2583         return commitment_tx_confirmed_ref;
2584 }
2585 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateCompleted_get_funding_txo"))) TS_LDKMonitorEvent_UpdateCompleted_get_funding_txo(uint64_t ptr) {
2586         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2587         assert(obj->tag == LDKMonitorEvent_UpdateCompleted);
2588                         LDKOutPoint funding_txo_var = obj->update_completed.funding_txo;
2589                         uint64_t funding_txo_ref = 0;
2590                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
2591                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
2592         return funding_txo_ref;
2593 }
2594 int64_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateCompleted_get_monitor_update_id"))) TS_LDKMonitorEvent_UpdateCompleted_get_monitor_update_id(uint64_t ptr) {
2595         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2596         assert(obj->tag == LDKMonitorEvent_UpdateCompleted);
2597                         int64_t monitor_update_id_conv = obj->update_completed.monitor_update_id;
2598         return monitor_update_id_conv;
2599 }
2600 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateFailed_get_update_failed"))) TS_LDKMonitorEvent_UpdateFailed_get_update_failed(uint64_t ptr) {
2601         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
2602         assert(obj->tag == LDKMonitorEvent_UpdateFailed);
2603                         LDKOutPoint update_failed_var = obj->update_failed;
2604                         uint64_t update_failed_ref = 0;
2605                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
2606                         update_failed_ref = tag_ptr(update_failed_var.inner, false);
2607         return update_failed_ref;
2608 }
2609 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
2610         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
2611         for (size_t i = 0; i < ret.datalen; i++) {
2612                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
2613         }
2614         return ret;
2615 }
2616 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2617         LDKOutPoint ret = owner->a;
2618         ret.is_owned = false;
2619         return ret;
2620 }
2621 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(uint64_t owner) {
2622         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2623         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
2624         uint64_t ret_ref = 0;
2625         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2626         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2627         return ret_ref;
2628 }
2629
2630 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2631         return CVec_MonitorEventZ_clone(&owner->b);
2632 }
2633 uint64_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(uint64_t owner) {
2634         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2635         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
2636         uint64_tArray ret_arr = NULL;
2637         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
2638         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
2639         for (size_t o = 0; o < ret_var.datalen; o++) {
2640                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
2641                 *ret_conv_14_copy = ret_var.data[o];
2642                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
2643                 ret_arr_ptr[o] = ret_conv_14_ref;
2644         }
2645         
2646         FREE(ret_var.data);
2647         return ret_arr;
2648 }
2649
2650 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
2651         return owner->c;
2652 }
2653 int8_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(uint64_t owner) {
2654         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
2655         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
2656         memcpy(ret_arr->elems, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form, 33);
2657         return ret_arr;
2658 }
2659
2660 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
2661         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
2662         for (size_t i = 0; i < ret.datalen; i++) {
2663                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
2664         }
2665         return ret;
2666 }
2667 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2668         LDKFixedPenaltyScorer ret = *owner->contents.result;
2669         ret.is_owned = false;
2670         return ret;
2671 }
2672 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(uint64_t owner) {
2673         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2674         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
2675         uint64_t ret_ref = 0;
2676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2678         return ret_ref;
2679 }
2680
2681 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
2682         LDKDecodeError ret = *owner->contents.err;
2683         ret.is_owned = false;
2684         return ret;
2685 }
2686 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err(uint64_t owner) {
2687         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
2688         LDKDecodeError ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
2689         uint64_t ret_ref = 0;
2690         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2691         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2692         return ret_ref;
2693 }
2694
2695 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2696         return owner->a;
2697 }
2698 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_a"))) TS_C2Tuple_u64u64Z_get_a(uint64_t owner) {
2699         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2700         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
2701         return ret_conv;
2702 }
2703
2704 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
2705         return owner->b;
2706 }
2707 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_b"))) TS_C2Tuple_u64u64Z_get_b(uint64_t owner) {
2708         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
2709         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
2710         return ret_conv;
2711 }
2712
2713 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr(uint64_t ptr) {
2714         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2715         switch(obj->tag) {
2716                 case LDKCOption_C2Tuple_u64u64ZZ_Some: return 0;
2717                 case LDKCOption_C2Tuple_u64u64ZZ_None: return 1;
2718                 default: abort();
2719         }
2720 }
2721 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some(uint64_t ptr) {
2722         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
2723         assert(obj->tag == LDKCOption_C2Tuple_u64u64ZZ_Some);
2724                         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
2725                         *some_conv = obj->some;
2726                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
2727         return tag_ptr(some_conv, true);
2728 }
2729 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
2730         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
2731         for (size_t i = 0; i < ret.datalen; i++) {
2732                 ret.data[i] = NodeId_clone(&orig->data[i]);
2733         }
2734         return ret;
2735 }
2736 typedef struct LDKLogger_JCalls {
2737         atomic_size_t refcnt;
2738         uint32_t instance_ptr;
2739 } LDKLogger_JCalls;
2740 static void LDKLogger_JCalls_free(void* this_arg) {
2741         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2742         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2743                 FREE(j_calls);
2744         }
2745 }
2746 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
2747         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2748         LDKRecord record_var = *record;
2749         uint64_t record_ref = 0;
2750         record_var = Record_clone(&record_var);
2751         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
2752         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
2753         js_invoke_function_buuuuu(j_calls->instance_ptr, 0, record_ref, 0, 0, 0, 0, 0);
2754 }
2755 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
2756         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
2757         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2758 }
2759 static inline LDKLogger LDKLogger_init (JSValue o) {
2760         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2761         atomic_init(&calls->refcnt, 1);
2762         calls->instance_ptr = o;
2763
2764         LDKLogger ret = {
2765                 .this_arg = (void*) calls,
2766                 .log = log_LDKLogger_jcall,
2767                 .free = LDKLogger_JCalls_free,
2768         };
2769         return ret;
2770 }
2771 uint64_t  __attribute__((export_name("TS_LDKLogger_new"))) TS_LDKLogger_new(JSValue o) {
2772         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2773         *res_ptr = LDKLogger_init(o);
2774         return tag_ptr(res_ptr, true);
2775 }
2776 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2777         LDKProbabilisticScorer ret = *owner->contents.result;
2778         ret.is_owned = false;
2779         return ret;
2780 }
2781 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok(uint64_t owner) {
2782         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
2783         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
2784         uint64_t ret_ref = 0;
2785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2787         return ret_ref;
2788 }
2789
2790 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
2791         LDKDecodeError ret = *owner->contents.err;
2792         ret.is_owned = false;
2793         return ret;
2794 }
2795 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err(uint64_t owner) {
2796         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
2797         LDKDecodeError ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
2798         uint64_t ret_ref = 0;
2799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2801         return ret_ref;
2802 }
2803
2804 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
2805         LDKInitFeatures ret = *owner->contents.result;
2806         ret.is_owned = false;
2807         return ret;
2808 }
2809 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2810         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
2811         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
2812         uint64_t ret_ref = 0;
2813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2815         return ret_ref;
2816 }
2817
2818 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
2819         LDKDecodeError ret = *owner->contents.err;
2820         ret.is_owned = false;
2821         return ret;
2822 }
2823 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_err"))) TS_CResult_InitFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2824         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
2825         LDKDecodeError ret_var = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
2826         uint64_t ret_ref = 0;
2827         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2828         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2829         return ret_ref;
2830 }
2831
2832 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
2833         LDKChannelFeatures ret = *owner->contents.result;
2834         ret.is_owned = false;
2835         return ret;
2836 }
2837 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2838         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
2839         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
2840         uint64_t ret_ref = 0;
2841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2843         return ret_ref;
2844 }
2845
2846 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
2847         LDKDecodeError ret = *owner->contents.err;
2848         ret.is_owned = false;
2849         return ret;
2850 }
2851 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2852         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
2853         LDKDecodeError ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
2854         uint64_t ret_ref = 0;
2855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2857         return ret_ref;
2858 }
2859
2860 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2861         LDKNodeFeatures ret = *owner->contents.result;
2862         ret.is_owned = false;
2863         return ret;
2864 }
2865 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2866         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
2867         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
2868         uint64_t ret_ref = 0;
2869         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2870         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2871         return ret_ref;
2872 }
2873
2874 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2875         LDKDecodeError ret = *owner->contents.err;
2876         ret.is_owned = false;
2877         return ret;
2878 }
2879 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2880         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
2881         LDKDecodeError ret_var = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
2882         uint64_t ret_ref = 0;
2883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2885         return ret_ref;
2886 }
2887
2888 static inline struct LDKInvoiceFeatures CResult_InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
2889         LDKInvoiceFeatures ret = *owner->contents.result;
2890         ret.is_owned = false;
2891         return ret;
2892 }
2893 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2894         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
2895         LDKInvoiceFeatures ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
2896         uint64_t ret_ref = 0;
2897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2899         return ret_ref;
2900 }
2901
2902 static inline struct LDKDecodeError CResult_InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
2903         LDKDecodeError ret = *owner->contents.err;
2904         ret.is_owned = false;
2905         return ret;
2906 }
2907 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2908         LDKCResult_InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
2909         LDKDecodeError ret_var = CResult_InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
2910         uint64_t ret_ref = 0;
2911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2913         return ret_ref;
2914 }
2915
2916 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2917         LDKChannelTypeFeatures ret = *owner->contents.result;
2918         ret.is_owned = false;
2919         return ret;
2920 }
2921 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
2922         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
2923         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
2924         uint64_t ret_ref = 0;
2925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2927         return ret_ref;
2928 }
2929
2930 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
2931         LDKDecodeError ret = *owner->contents.err;
2932         ret.is_owned = false;
2933         return ret;
2934 }
2935 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
2936         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
2937         LDKDecodeError ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
2938         uint64_t ret_ref = 0;
2939         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2940         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2941         return ret_ref;
2942 }
2943
2944 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
2945         LDKNodeId ret = *owner->contents.result;
2946         ret.is_owned = false;
2947         return ret;
2948 }
2949 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_ok"))) TS_CResult_NodeIdDecodeErrorZ_get_ok(uint64_t owner) {
2950         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
2951         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
2952         uint64_t ret_ref = 0;
2953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2955         return ret_ref;
2956 }
2957
2958 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
2959         LDKDecodeError ret = *owner->contents.err;
2960         ret.is_owned = false;
2961         return ret;
2962 }
2963 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_err"))) TS_CResult_NodeIdDecodeErrorZ_get_err(uint64_t owner) {
2964         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
2965         LDKDecodeError ret_var = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
2966         uint64_t ret_ref = 0;
2967         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2968         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2969         return ret_ref;
2970 }
2971
2972 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
2973 CHECK(owner->result_ok);
2974         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
2975 }
2976 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint64_t owner) {
2977         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
2978         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
2979         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
2980         uint64_t ret_ref = tag_ptr(ret_copy, true);
2981         return ret_ref;
2982 }
2983
2984 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
2985         LDKDecodeError ret = *owner->contents.err;
2986         ret.is_owned = false;
2987         return ret;
2988 }
2989 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint64_t owner) {
2990         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
2991         LDKDecodeError ret_var = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
2992         uint64_t ret_ref = 0;
2993         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2994         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2995         return ret_ref;
2996 }
2997
2998 typedef struct LDKAccess_JCalls {
2999         atomic_size_t refcnt;
3000         uint32_t instance_ptr;
3001 } LDKAccess_JCalls;
3002 static void LDKAccess_JCalls_free(void* this_arg) {
3003         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3004         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3005                 FREE(j_calls);
3006         }
3007 }
3008 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
3009         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3010         int8_tArray genesis_hash_arr = init_int8_tArray(32, __LINE__);
3011         memcpy(genesis_hash_arr->elems, *genesis_hash, 32);
3012         int64_t short_channel_id_conv = short_channel_id;
3013         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);
3014         void* ret_ptr = untag_ptr(ret);
3015         CHECK_ACCESS(ret_ptr);
3016         LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr);
3017         FREE(untag_ptr(ret));
3018         return ret_conv;
3019 }
3020 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
3021         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
3022         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3023 }
3024 static inline LDKAccess LDKAccess_init (JSValue o) {
3025         LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
3026         atomic_init(&calls->refcnt, 1);
3027         calls->instance_ptr = o;
3028
3029         LDKAccess ret = {
3030                 .this_arg = (void*) calls,
3031                 .get_utxo = get_utxo_LDKAccess_jcall,
3032                 .free = LDKAccess_JCalls_free,
3033         };
3034         return ret;
3035 }
3036 uint64_t  __attribute__((export_name("TS_LDKAccess_new"))) TS_LDKAccess_new(JSValue o) {
3037         LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
3038         *res_ptr = LDKAccess_init(o);
3039         return tag_ptr(res_ptr, true);
3040 }
3041 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) {
3042         void* this_arg_ptr = untag_ptr(this_arg);
3043         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3044         LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr;
3045         unsigned char genesis_hash_arr[32];
3046         CHECK(genesis_hash->arr_len == 32);
3047         memcpy(genesis_hash_arr, genesis_hash->elems, 32); FREE(genesis_hash);
3048         unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
3049         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
3050         *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
3051         return tag_ptr(ret_conv, true);
3052 }
3053
3054 uint32_t __attribute__((export_name("TS_LDKCOption_AccessZ_ty_from_ptr"))) TS_LDKCOption_AccessZ_ty_from_ptr(uint64_t ptr) {
3055         LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)untag_ptr(ptr);
3056         switch(obj->tag) {
3057                 case LDKCOption_AccessZ_Some: return 0;
3058                 case LDKCOption_AccessZ_None: return 1;
3059                 default: abort();
3060         }
3061 }
3062 uint64_t __attribute__((export_name("TS_LDKCOption_AccessZ_Some_get_some"))) TS_LDKCOption_AccessZ_Some_get_some(uint64_t ptr) {
3063         LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)untag_ptr(ptr);
3064         assert(obj->tag == LDKCOption_AccessZ_Some);
3065                         LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess");
3066                         *some_ret = obj->some;
3067                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
3068                         if ((*some_ret).free == LDKAccess_JCalls_free) {
3069                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3070                                 LDKAccess_JCalls_cloned(&(*some_ret));
3071                         }
3072         return tag_ptr(some_ret, true);
3073 }
3074 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3075 CHECK(owner->result_ok);
3076         return *owner->contents.result;
3077 }
3078 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_ok"))) TS_CResult_boolLightningErrorZ_get_ok(uint64_t owner) {
3079         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3080         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
3081         return ret_conv;
3082 }
3083
3084 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
3085         LDKLightningError ret = *owner->contents.err;
3086         ret.is_owned = false;
3087         return ret;
3088 }
3089 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_err"))) TS_CResult_boolLightningErrorZ_get_err(uint64_t owner) {
3090         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
3091         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
3092         uint64_t ret_ref = 0;
3093         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3094         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3095         return ret_ref;
3096 }
3097
3098 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3099         LDKChannelAnnouncement ret = owner->a;
3100         ret.is_owned = false;
3101         return ret;
3102 }
3103 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint64_t owner) {
3104         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3105         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
3106         uint64_t ret_ref = 0;
3107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3109         return ret_ref;
3110 }
3111
3112 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3113         LDKChannelUpdate ret = owner->b;
3114         ret.is_owned = false;
3115         return ret;
3116 }
3117 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint64_t owner) {
3118         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3119         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
3120         uint64_t ret_ref = 0;
3121         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3122         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3123         return ret_ref;
3124 }
3125
3126 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
3127         LDKChannelUpdate ret = owner->c;
3128         ret.is_owned = false;
3129         return ret;
3130 }
3131 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint64_t owner) {
3132         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
3133         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
3134         uint64_t ret_ref = 0;
3135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3137         return ret_ref;
3138 }
3139
3140 uint32_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr(uint64_t ptr) {
3141         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
3142         switch(obj->tag) {
3143                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: return 0;
3144                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: return 1;
3145                 default: abort();
3146         }
3147 }
3148 uint64_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some(uint64_t ptr) {
3149         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
3150         assert(obj->tag == LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some);
3151                         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
3152                         *some_conv = obj->some;
3153                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
3154         return tag_ptr(some_conv, true);
3155 }
3156 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3157 CHECK(owner->result_ok);
3158         return *owner->contents.result;
3159 }
3160 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_ok"))) TS_CResult_NoneLightningErrorZ_get_ok(uint64_t owner) {
3161         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3162         CResult_NoneLightningErrorZ_get_ok(owner_conv);
3163 }
3164
3165 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
3166         LDKLightningError ret = *owner->contents.err;
3167         ret.is_owned = false;
3168         return ret;
3169 }
3170 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_err"))) TS_CResult_NoneLightningErrorZ_get_err(uint64_t owner) {
3171         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
3172         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
3173         uint64_t ret_ref = 0;
3174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3176         return ret_ref;
3177 }
3178
3179 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3180         LDKChannelUpdateInfo ret = *owner->contents.result;
3181         ret.is_owned = false;
3182         return ret;
3183 }
3184 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(uint64_t owner) {
3185         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
3186         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
3187         uint64_t ret_ref = 0;
3188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3190         return ret_ref;
3191 }
3192
3193 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
3194         LDKDecodeError ret = *owner->contents.err;
3195         ret.is_owned = false;
3196         return ret;
3197 }
3198 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err(uint64_t owner) {
3199         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
3200         LDKDecodeError ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
3201         uint64_t ret_ref = 0;
3202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3204         return ret_ref;
3205 }
3206
3207 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3208         LDKChannelInfo ret = *owner->contents.result;
3209         ret.is_owned = false;
3210         return ret;
3211 }
3212 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_get_ok(uint64_t owner) {
3213         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
3214         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
3215         uint64_t ret_ref = 0;
3216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3218         return ret_ref;
3219 }
3220
3221 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
3222         LDKDecodeError ret = *owner->contents.err;
3223         ret.is_owned = false;
3224         return ret;
3225 }
3226 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelInfoDecodeErrorZ_get_err(uint64_t owner) {
3227         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
3228         LDKDecodeError ret_var = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
3229         uint64_t ret_ref = 0;
3230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3232         return ret_ref;
3233 }
3234
3235 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3236         LDKRoutingFees ret = *owner->contents.result;
3237         ret.is_owned = false;
3238         return ret;
3239 }
3240 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_get_ok(uint64_t owner) {
3241         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
3242         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
3243         uint64_t ret_ref = 0;
3244         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3245         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3246         return ret_ref;
3247 }
3248
3249 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
3250         LDKDecodeError ret = *owner->contents.err;
3251         ret.is_owned = false;
3252         return ret;
3253 }
3254 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_err"))) TS_CResult_RoutingFeesDecodeErrorZ_get_err(uint64_t owner) {
3255         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
3256         LDKDecodeError ret_var = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
3257         uint64_t ret_ref = 0;
3258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3260         return ret_ref;
3261 }
3262
3263 uint32_t __attribute__((export_name("TS_LDKNetAddress_ty_from_ptr"))) TS_LDKNetAddress_ty_from_ptr(uint64_t ptr) {
3264         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3265         switch(obj->tag) {
3266                 case LDKNetAddress_IPv4: return 0;
3267                 case LDKNetAddress_IPv6: return 1;
3268                 case LDKNetAddress_OnionV2: return 2;
3269                 case LDKNetAddress_OnionV3: return 3;
3270                 case LDKNetAddress_Hostname: return 4;
3271                 default: abort();
3272         }
3273 }
3274 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv4_get_addr"))) TS_LDKNetAddress_IPv4_get_addr(uint64_t ptr) {
3275         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3276         assert(obj->tag == LDKNetAddress_IPv4);
3277                         int8_tArray addr_arr = init_int8_tArray(4, __LINE__);
3278                         memcpy(addr_arr->elems, obj->i_pv4.addr.data, 4);
3279         return addr_arr;
3280 }
3281 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv4_get_port"))) TS_LDKNetAddress_IPv4_get_port(uint64_t ptr) {
3282         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3283         assert(obj->tag == LDKNetAddress_IPv4);
3284                         int16_t port_conv = obj->i_pv4.port;
3285         return port_conv;
3286 }
3287 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv6_get_addr"))) TS_LDKNetAddress_IPv6_get_addr(uint64_t ptr) {
3288         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3289         assert(obj->tag == LDKNetAddress_IPv6);
3290                         int8_tArray addr_arr = init_int8_tArray(16, __LINE__);
3291                         memcpy(addr_arr->elems, obj->i_pv6.addr.data, 16);
3292         return addr_arr;
3293 }
3294 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv6_get_port"))) TS_LDKNetAddress_IPv6_get_port(uint64_t ptr) {
3295         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3296         assert(obj->tag == LDKNetAddress_IPv6);
3297                         int16_t port_conv = obj->i_pv6.port;
3298         return port_conv;
3299 }
3300 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV2_get_onion_v2"))) TS_LDKNetAddress_OnionV2_get_onion_v2(uint64_t ptr) {
3301         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3302         assert(obj->tag == LDKNetAddress_OnionV2);
3303                         int8_tArray onion_v2_arr = init_int8_tArray(12, __LINE__);
3304                         memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
3305         return onion_v2_arr;
3306 }
3307 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_ed25519_pubkey"))) TS_LDKNetAddress_OnionV3_get_ed25519_pubkey(uint64_t ptr) {
3308         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3309         assert(obj->tag == LDKNetAddress_OnionV3);
3310                         int8_tArray ed25519_pubkey_arr = init_int8_tArray(32, __LINE__);
3311                         memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
3312         return ed25519_pubkey_arr;
3313 }
3314 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_checksum"))) TS_LDKNetAddress_OnionV3_get_checksum(uint64_t ptr) {
3315         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3316         assert(obj->tag == LDKNetAddress_OnionV3);
3317                         int16_t checksum_conv = obj->onion_v3.checksum;
3318         return checksum_conv;
3319 }
3320 int8_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_version"))) TS_LDKNetAddress_OnionV3_get_version(uint64_t ptr) {
3321         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3322         assert(obj->tag == LDKNetAddress_OnionV3);
3323                         int8_t version_conv = obj->onion_v3.version;
3324         return version_conv;
3325 }
3326 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_port"))) TS_LDKNetAddress_OnionV3_get_port(uint64_t ptr) {
3327         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3328         assert(obj->tag == LDKNetAddress_OnionV3);
3329                         int16_t port_conv = obj->onion_v3.port;
3330         return port_conv;
3331 }
3332 uint64_t __attribute__((export_name("TS_LDKNetAddress_Hostname_get_hostname"))) TS_LDKNetAddress_Hostname_get_hostname(uint64_t ptr) {
3333         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3334         assert(obj->tag == LDKNetAddress_Hostname);
3335                         LDKHostname hostname_var = obj->hostname.hostname;
3336                         uint64_t hostname_ref = 0;
3337                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
3338                         hostname_ref = tag_ptr(hostname_var.inner, false);
3339         return hostname_ref;
3340 }
3341 int16_t __attribute__((export_name("TS_LDKNetAddress_Hostname_get_port"))) TS_LDKNetAddress_Hostname_get_port(uint64_t ptr) {
3342         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
3343         assert(obj->tag == LDKNetAddress_Hostname);
3344                         int16_t port_conv = obj->hostname.port;
3345         return port_conv;
3346 }
3347 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3348         LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3349         for (size_t i = 0; i < ret.datalen; i++) {
3350                 ret.data[i] = NetAddress_clone(&orig->data[i]);
3351         }
3352         return ret;
3353 }
3354 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3355         LDKNodeAnnouncementInfo ret = *owner->contents.result;
3356         ret.is_owned = false;
3357         return ret;
3358 }
3359 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint64_t owner) {
3360         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
3361         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
3362         uint64_t ret_ref = 0;
3363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3365         return ret_ref;
3366 }
3367
3368 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
3369         LDKDecodeError ret = *owner->contents.err;
3370         ret.is_owned = false;
3371         return ret;
3372 }
3373 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint64_t owner) {
3374         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
3375         LDKDecodeError ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
3376         uint64_t ret_ref = 0;
3377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3379         return ret_ref;
3380 }
3381
3382 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
3383         LDKNodeAlias ret = *owner->contents.result;
3384         ret.is_owned = false;
3385         return ret;
3386 }
3387 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_ok"))) TS_CResult_NodeAliasDecodeErrorZ_get_ok(uint64_t owner) {
3388         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
3389         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
3390         uint64_t ret_ref = 0;
3391         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3392         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3393         return ret_ref;
3394 }
3395
3396 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
3397         LDKDecodeError ret = *owner->contents.err;
3398         ret.is_owned = false;
3399         return ret;
3400 }
3401 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_err"))) TS_CResult_NodeAliasDecodeErrorZ_get_err(uint64_t owner) {
3402         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
3403         LDKDecodeError ret_var = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
3404         uint64_t ret_ref = 0;
3405         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3406         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3407         return ret_ref;
3408 }
3409
3410 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3411         LDKNodeInfo ret = *owner->contents.result;
3412         ret.is_owned = false;
3413         return ret;
3414 }
3415 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeInfoDecodeErrorZ_get_ok(uint64_t owner) {
3416         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
3417         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
3418         uint64_t ret_ref = 0;
3419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3421         return ret_ref;
3422 }
3423
3424 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
3425         LDKDecodeError ret = *owner->contents.err;
3426         ret.is_owned = false;
3427         return ret;
3428 }
3429 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_err"))) TS_CResult_NodeInfoDecodeErrorZ_get_err(uint64_t owner) {
3430         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
3431         LDKDecodeError ret_var = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
3432         uint64_t ret_ref = 0;
3433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3435         return ret_ref;
3436 }
3437
3438 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3439         LDKNetworkGraph ret = *owner->contents.result;
3440         ret.is_owned = false;
3441         return ret;
3442 }
3443 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_get_ok(uint64_t owner) {
3444         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
3445         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
3446         uint64_t ret_ref = 0;
3447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3449         return ret_ref;
3450 }
3451
3452 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
3453         LDKDecodeError ret = *owner->contents.err;
3454         ret.is_owned = false;
3455         return ret;
3456 }
3457 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_err"))) TS_CResult_NetworkGraphDecodeErrorZ_get_err(uint64_t owner) {
3458         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
3459         LDKDecodeError ret_var = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
3460         uint64_t ret_ref = 0;
3461         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3462         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3463         return ret_ref;
3464 }
3465
3466 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr"))) TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr(uint64_t ptr) {
3467         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
3468         switch(obj->tag) {
3469                 case LDKCOption_CVec_NetAddressZZ_Some: return 0;
3470                 case LDKCOption_CVec_NetAddressZZ_None: return 1;
3471                 default: abort();
3472         }
3473 }
3474 uint64_tArray __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_Some_get_some"))) TS_LDKCOption_CVec_NetAddressZZ_Some_get_some(uint64_t ptr) {
3475         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
3476         assert(obj->tag == LDKCOption_CVec_NetAddressZZ_Some);
3477                         LDKCVec_NetAddressZ some_var = obj->some;
3478                         uint64_tArray some_arr = NULL;
3479                         some_arr = init_uint64_tArray(some_var.datalen, __LINE__);
3480                         uint64_t *some_arr_ptr = (uint64_t*)(((uint8_t*)some_arr) + 8);
3481                         for (size_t m = 0; m < some_var.datalen; m++) {
3482                                 uint64_t some_conv_12_ref = tag_ptr(&some_var.data[m], false);
3483                                 some_arr_ptr[m] = some_conv_12_ref;
3484                         }
3485                         
3486         return some_arr;
3487 }
3488 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3489         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
3490         ret.is_owned = false;
3491         return ret;
3492 }
3493 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
3494         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3495         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3496         uint64_t ret_ref = 0;
3497         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3498         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3499         return ret_ref;
3500 }
3501
3502 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3503         LDKDecodeError ret = *owner->contents.err;
3504         ret.is_owned = false;
3505         return ret;
3506 }
3507 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
3508         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3509         LDKDecodeError ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3510         uint64_t ret_ref = 0;
3511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3513         return ret_ref;
3514 }
3515
3516 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3517         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
3518         ret.is_owned = false;
3519         return ret;
3520 }
3521 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
3522         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3523         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3524         uint64_t ret_ref = 0;
3525         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3526         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3527         return ret_ref;
3528 }
3529
3530 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3531         LDKDecodeError ret = *owner->contents.err;
3532         ret.is_owned = false;
3533         return ret;
3534 }
3535 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
3536         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3537         LDKDecodeError ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3538         uint64_t ret_ref = 0;
3539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3541         return ret_ref;
3542 }
3543
3544 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3545 CHECK(owner->result_ok);
3546         return SpendableOutputDescriptor_clone(&*owner->contents.result);
3547 }
3548 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
3549         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3550         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
3551         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
3552         uint64_t ret_ref = tag_ptr(ret_copy, true);
3553         return ret_ref;
3554 }
3555
3556 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
3557         LDKDecodeError ret = *owner->contents.err;
3558         ret.is_owned = false;
3559         return ret;
3560 }
3561 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
3562         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
3563         LDKDecodeError ret_var = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
3564         uint64_t ret_ref = 0;
3565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3567         return ret_ref;
3568 }
3569
3570 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
3571         LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
3572         for (size_t i = 0; i < ret.datalen; i++) {
3573                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
3574         }
3575         return ret;
3576 }
3577 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3578         return owner->a;
3579 }
3580 int8_tArray  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_a"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_a(uint64_t owner) {
3581         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
3582         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3583         memcpy(ret_arr->elems, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form, 64);
3584         return ret_arr;
3585 }
3586
3587 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
3588         return owner->b;
3589 }
3590 ptrArray  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_b"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_b(uint64_t owner) {
3591         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
3592         LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
3593         ptrArray ret_arr = NULL;
3594         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
3595         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
3596         for (size_t m = 0; m < ret_var.datalen; m++) {
3597                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
3598                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
3599                 ret_arr_ptr[m] = ret_conv_12_arr;
3600         }
3601         
3602         return ret_arr;
3603 }
3604
3605 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3606 CHECK(owner->result_ok);
3607         return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
3608 }
3609 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint64_t owner) {
3610         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
3611         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
3612         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
3613         return tag_ptr(ret_conv, true);
3614 }
3615
3616 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
3617 CHECK(!owner->result_ok);
3618         return *owner->contents.err;
3619 }
3620 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint64_t owner) {
3621         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
3622         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
3623 }
3624
3625 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3626 CHECK(owner->result_ok);
3627         return *owner->contents.result;
3628 }
3629 int8_tArray  __attribute__((export_name("TS_CResult_SignatureNoneZ_get_ok"))) TS_CResult_SignatureNoneZ_get_ok(uint64_t owner) {
3630         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
3631         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3632         memcpy(ret_arr->elems, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form, 64);
3633         return ret_arr;
3634 }
3635
3636 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
3637 CHECK(!owner->result_ok);
3638         return *owner->contents.err;
3639 }
3640 void  __attribute__((export_name("TS_CResult_SignatureNoneZ_get_err"))) TS_CResult_SignatureNoneZ_get_err(uint64_t owner) {
3641         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
3642         CResult_SignatureNoneZ_get_err(owner_conv);
3643 }
3644
3645 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_a(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
3646         return owner->a;
3647 }
3648 int8_tArray  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_get_a"))) TS_C2Tuple_SignatureSignatureZ_get_a(uint64_t owner) {
3649         LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(owner);
3650         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3651         memcpy(ret_arr->elems, C2Tuple_SignatureSignatureZ_get_a(owner_conv).compact_form, 64);
3652         return ret_arr;
3653 }
3654
3655 static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_b(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){
3656         return owner->b;
3657 }
3658 int8_tArray  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_get_b"))) TS_C2Tuple_SignatureSignatureZ_get_b(uint64_t owner) {
3659         LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(owner);
3660         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
3661         memcpy(ret_arr->elems, C2Tuple_SignatureSignatureZ_get_b(owner_conv).compact_form, 64);
3662         return ret_arr;
3663 }
3664
3665 static inline struct LDKC2Tuple_SignatureSignatureZ CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
3666 CHECK(owner->result_ok);
3667         return C2Tuple_SignatureSignatureZ_clone(&*owner->contents.result);
3668 }
3669 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(uint64_t owner) {
3670         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(owner);
3671         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
3672         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(owner_conv);
3673         return tag_ptr(ret_conv, true);
3674 }
3675
3676 static inline void CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){
3677 CHECK(!owner->result_ok);
3678         return *owner->contents.err;
3679 }
3680 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(uint64_t owner) {
3681         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(owner);
3682         CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(owner_conv);
3683 }
3684
3685 static inline struct LDKSecretKey CResult_SecretKeyNoneZ_get_ok(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
3686 CHECK(owner->result_ok);
3687         return *owner->contents.result;
3688 }
3689 int8_tArray  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_get_ok"))) TS_CResult_SecretKeyNoneZ_get_ok(uint64_t owner) {
3690         LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(owner);
3691         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3692         memcpy(ret_arr->elems, CResult_SecretKeyNoneZ_get_ok(owner_conv).bytes, 32);
3693         return ret_arr;
3694 }
3695
3696 static inline void CResult_SecretKeyNoneZ_get_err(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){
3697 CHECK(!owner->result_ok);
3698         return *owner->contents.err;
3699 }
3700 void  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_get_err"))) TS_CResult_SecretKeyNoneZ_get_err(uint64_t owner) {
3701         LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(owner);
3702         CResult_SecretKeyNoneZ_get_err(owner_conv);
3703 }
3704
3705 uint32_t __attribute__((export_name("TS_LDKCOption_ScalarZ_ty_from_ptr"))) TS_LDKCOption_ScalarZ_ty_from_ptr(uint64_t ptr) {
3706         LDKCOption_ScalarZ *obj = (LDKCOption_ScalarZ*)untag_ptr(ptr);
3707         switch(obj->tag) {
3708                 case LDKCOption_ScalarZ_Some: return 0;
3709                 case LDKCOption_ScalarZ_None: return 1;
3710                 default: abort();
3711         }
3712 }
3713 uint64_t __attribute__((export_name("TS_LDKCOption_ScalarZ_Some_get_some"))) TS_LDKCOption_ScalarZ_Some_get_some(uint64_t ptr) {
3714         LDKCOption_ScalarZ *obj = (LDKCOption_ScalarZ*)untag_ptr(ptr);
3715         assert(obj->tag == LDKCOption_ScalarZ_Some);
3716                         LDKBigEndianScalar* some_ref = &obj->some;
3717         return tag_ptr(some_ref, false);
3718 }
3719 static inline struct LDKThirtyTwoBytes CResult_SharedSecretNoneZ_get_ok(LDKCResult_SharedSecretNoneZ *NONNULL_PTR owner){
3720 CHECK(owner->result_ok);
3721         return ThirtyTwoBytes_clone(&*owner->contents.result);
3722 }
3723 int8_tArray  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_get_ok"))) TS_CResult_SharedSecretNoneZ_get_ok(uint64_t owner) {
3724         LDKCResult_SharedSecretNoneZ* owner_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(owner);
3725         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
3726         memcpy(ret_arr->elems, CResult_SharedSecretNoneZ_get_ok(owner_conv).data, 32);
3727         return ret_arr;
3728 }
3729
3730 static inline void CResult_SharedSecretNoneZ_get_err(LDKCResult_SharedSecretNoneZ *NONNULL_PTR owner){
3731 CHECK(!owner->result_ok);
3732         return *owner->contents.err;
3733 }
3734 void  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_get_err"))) TS_CResult_SharedSecretNoneZ_get_err(uint64_t owner) {
3735         LDKCResult_SharedSecretNoneZ* owner_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(owner);
3736         CResult_SharedSecretNoneZ_get_err(owner_conv);
3737 }
3738
3739 typedef struct LDKBaseSign_JCalls {
3740         atomic_size_t refcnt;
3741         uint32_t instance_ptr;
3742 } LDKBaseSign_JCalls;
3743 static void LDKBaseSign_JCalls_free(void* this_arg) {
3744         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3745         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3746                 FREE(j_calls);
3747         }
3748 }
3749 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3750         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3751         int64_t idx_conv = idx;
3752         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 2, idx_conv, 0, 0, 0, 0, 0);
3753         LDKPublicKey ret_ref;
3754         CHECK(ret->arr_len == 33);
3755         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
3756         return ret_ref;
3757 }
3758 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
3759         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3760         int64_t idx_conv = idx;
3761         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 3, idx_conv, 0, 0, 0, 0, 0);
3762         LDKThirtyTwoBytes ret_ref;
3763         CHECK(ret->arr_len == 32);
3764         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
3765         return ret_ref;
3766 }
3767 LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
3768         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3769         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
3770         uint64_t holder_tx_ref = 0;
3771         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
3772         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
3773         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
3774         LDKCVec_PaymentPreimageZ preimages_var = preimages;
3775         ptrArray preimages_arr = NULL;
3776         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
3777         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
3778         for (size_t m = 0; m < preimages_var.datalen; m++) {
3779                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
3780                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
3781                 preimages_arr_ptr[m] = preimages_conv_12_arr;
3782         }
3783         
3784         FREE(preimages_var.data);
3785         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 4, holder_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
3786         void* ret_ptr = untag_ptr(ret);
3787         CHECK_ACCESS(ret_ptr);
3788         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3789         FREE(untag_ptr(ret));
3790         return ret_conv;
3791 }
3792 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
3793         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3794         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 5, 0, 0, 0, 0, 0, 0);
3795         LDKThirtyTwoBytes ret_ref;
3796         CHECK(ret->arr_len == 32);
3797         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
3798         return ret_ref;
3799 }
3800 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
3801         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3802         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
3803         uint64_t commitment_tx_ref = 0;
3804         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
3805         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3806         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
3807         LDKCVec_PaymentPreimageZ preimages_var = preimages;
3808         ptrArray preimages_arr = NULL;
3809         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
3810         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
3811         for (size_t m = 0; m < preimages_var.datalen; m++) {
3812                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
3813                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
3814                 preimages_arr_ptr[m] = preimages_conv_12_arr;
3815         }
3816         
3817         FREE(preimages_var.data);
3818         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 6, commitment_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
3819         void* ret_ptr = untag_ptr(ret);
3820         CHECK_ACCESS(ret_ptr);
3821         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3822         FREE(untag_ptr(ret));
3823         return ret_conv;
3824 }
3825 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
3826         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3827         int64_t idx_conv = idx;
3828         int8_tArray secret_arr = init_int8_tArray(32, __LINE__);
3829         memcpy(secret_arr->elems, *secret, 32);
3830         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 7, idx_conv, (uint32_t)secret_arr, 0, 0, 0, 0);
3831         void* ret_ptr = untag_ptr(ret);
3832         CHECK_ACCESS(ret_ptr);
3833         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3834         FREE(untag_ptr(ret));
3835         return ret_conv;
3836 }
3837 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
3838         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3839         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
3840         uint64_t commitment_tx_ref = 0;
3841         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
3842         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3843         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
3844         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 8, commitment_tx_ref, 0, 0, 0, 0, 0);
3845         void* ret_ptr = untag_ptr(ret);
3846         CHECK_ACCESS(ret_ptr);
3847         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
3848         FREE(untag_ptr(ret));
3849         return ret_conv;
3850 }
3851 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]) {
3852         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3853         LDKTransaction justice_tx_var = justice_tx;
3854         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
3855         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
3856         Transaction_free(justice_tx_var);
3857         uint32_t input_conv = input;
3858         int64_t amount_conv = amount;
3859         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
3860         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
3861         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);
3862         void* ret_ptr = untag_ptr(ret);
3863         CHECK_ACCESS(ret_ptr);
3864         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3865         FREE(untag_ptr(ret));
3866         return ret_conv;
3867 }
3868 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) {
3869         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3870         LDKTransaction justice_tx_var = justice_tx;
3871         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
3872         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
3873         Transaction_free(justice_tx_var);
3874         uint32_t input_conv = input;
3875         int64_t amount_conv = amount;
3876         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
3877         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
3878         LDKHTLCOutputInCommitment htlc_var = *htlc;
3879         uint64_t htlc_ref = 0;
3880         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3881         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3882         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
3883         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);
3884         void* ret_ptr = untag_ptr(ret);
3885         CHECK_ACCESS(ret_ptr);
3886         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3887         FREE(untag_ptr(ret));
3888         return ret_conv;
3889 }
3890 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) {
3891         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3892         LDKTransaction htlc_tx_var = htlc_tx;
3893         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
3894         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
3895         Transaction_free(htlc_tx_var);
3896         uint32_t input_conv = input;
3897         int64_t amount_conv = amount;
3898         int8_tArray per_commitment_point_arr = init_int8_tArray(33, __LINE__);
3899         memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
3900         LDKHTLCOutputInCommitment htlc_var = *htlc;
3901         uint64_t htlc_ref = 0;
3902         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3903         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3904         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
3905         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);
3906         void* ret_ptr = untag_ptr(ret);
3907         CHECK_ACCESS(ret_ptr);
3908         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3909         FREE(untag_ptr(ret));
3910         return ret_conv;
3911 }
3912 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
3913         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3914         LDKClosingTransaction closing_tx_var = *closing_tx;
3915         uint64_t closing_tx_ref = 0;
3916         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
3917         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
3918         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
3919         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 12, closing_tx_ref, 0, 0, 0, 0, 0);
3920         void* ret_ptr = untag_ptr(ret);
3921         CHECK_ACCESS(ret_ptr);
3922         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
3923         FREE(untag_ptr(ret));
3924         return ret_conv;
3925 }
3926 LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
3927         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3928         LDKUnsignedChannelAnnouncement msg_var = *msg;
3929         uint64_t msg_ref = 0;
3930         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
3931         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3932         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
3933         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 13, msg_ref, 0, 0, 0, 0, 0);
3934         void* ret_ptr = untag_ptr(ret);
3935         CHECK_ACCESS(ret_ptr);
3936         LDKCResult_C2Tuple_SignatureSignatureZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(ret_ptr);
3937         FREE(untag_ptr(ret));
3938         return ret_conv;
3939 }
3940 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
3941         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
3942         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
3943         uint64_t channel_parameters_ref = 0;
3944         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
3945         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
3946         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
3947         js_invoke_function_buuuuu(j_calls->instance_ptr, 14, channel_parameters_ref, 0, 0, 0, 0, 0);
3948 }
3949 static void LDKBaseSign_JCalls_cloned(LDKBaseSign* new_obj) {
3950         LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) new_obj->this_arg;
3951         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3952 }
3953 static inline LDKBaseSign LDKBaseSign_init (JSValue o, uint64_t pubkeys) {
3954         LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
3955         atomic_init(&calls->refcnt, 1);
3956         calls->instance_ptr = o;
3957
3958         LDKChannelPublicKeys pubkeys_conv;
3959         pubkeys_conv.inner = untag_ptr(pubkeys);
3960         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
3961         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3962
3963         LDKBaseSign ret = {
3964                 .this_arg = (void*) calls,
3965                 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
3966                 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
3967                 .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
3968                 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
3969                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
3970                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
3971                 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
3972                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
3973                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
3974                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
3975                 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
3976                 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
3977                 .ready_channel = ready_channel_LDKBaseSign_jcall,
3978                 .free = LDKBaseSign_JCalls_free,
3979                 .pubkeys = pubkeys_conv,
3980                 .set_pubkeys = NULL,
3981         };
3982         return ret;
3983 }
3984 uint64_t  __attribute__((export_name("TS_LDKBaseSign_new"))) TS_LDKBaseSign_new(JSValue o, uint64_t pubkeys) {
3985         LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
3986         *res_ptr = LDKBaseSign_init(o, pubkeys);
3987         return tag_ptr(res_ptr, true);
3988 }
3989 int8_tArray  __attribute__((export_name("TS_BaseSign_get_per_commitment_point"))) TS_BaseSign_get_per_commitment_point(uint64_t this_arg, int64_t idx) {
3990         void* this_arg_ptr = untag_ptr(this_arg);
3991         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3992         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
3993         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3994         memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
3995         return ret_arr;
3996 }
3997
3998 int8_tArray  __attribute__((export_name("TS_BaseSign_release_commitment_secret"))) TS_BaseSign_release_commitment_secret(uint64_t this_arg, int64_t idx) {
3999         void* this_arg_ptr = untag_ptr(this_arg);
4000         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4001         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4002         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4003         memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
4004         return ret_arr;
4005 }
4006
4007 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) {
4008         void* this_arg_ptr = untag_ptr(this_arg);
4009         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4010         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4011         LDKHolderCommitmentTransaction holder_tx_conv;
4012         holder_tx_conv.inner = untag_ptr(holder_tx);
4013         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
4014         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
4015         holder_tx_conv.is_owned = false;
4016         LDKCVec_PaymentPreimageZ preimages_constr;
4017         preimages_constr.datalen = preimages->arr_len;
4018         if (preimages_constr.datalen > 0)
4019                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4020         else
4021                 preimages_constr.data = NULL;
4022         int8_tArray* preimages_vals = (void*) preimages->elems;
4023         for (size_t m = 0; m < preimages_constr.datalen; m++) {
4024                 int8_tArray preimages_conv_12 = preimages_vals[m];
4025                 LDKThirtyTwoBytes preimages_conv_12_ref;
4026                 CHECK(preimages_conv_12->arr_len == 32);
4027                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
4028                 preimages_constr.data[m] = preimages_conv_12_ref;
4029         }
4030         FREE(preimages);
4031         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4032         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
4033         return tag_ptr(ret_conv, true);
4034 }
4035
4036 int8_tArray  __attribute__((export_name("TS_BaseSign_channel_keys_id"))) TS_BaseSign_channel_keys_id(uint64_t this_arg) {
4037         void* this_arg_ptr = untag_ptr(this_arg);
4038         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4039         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4040         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4041         memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
4042         return ret_arr;
4043 }
4044
4045 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) {
4046         void* this_arg_ptr = untag_ptr(this_arg);
4047         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4048         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4049         LDKCommitmentTransaction commitment_tx_conv;
4050         commitment_tx_conv.inner = untag_ptr(commitment_tx);
4051         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
4052         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4053         commitment_tx_conv.is_owned = false;
4054         LDKCVec_PaymentPreimageZ preimages_constr;
4055         preimages_constr.datalen = preimages->arr_len;
4056         if (preimages_constr.datalen > 0)
4057                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
4058         else
4059                 preimages_constr.data = NULL;
4060         int8_tArray* preimages_vals = (void*) preimages->elems;
4061         for (size_t m = 0; m < preimages_constr.datalen; m++) {
4062                 int8_tArray preimages_conv_12 = preimages_vals[m];
4063                 LDKThirtyTwoBytes preimages_conv_12_ref;
4064                 CHECK(preimages_conv_12->arr_len == 32);
4065                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
4066                 preimages_constr.data[m] = preimages_conv_12_ref;
4067         }
4068         FREE(preimages);
4069         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4070         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
4071         return tag_ptr(ret_conv, true);
4072 }
4073
4074 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) {
4075         void* this_arg_ptr = untag_ptr(this_arg);
4076         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4077         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4078         unsigned char secret_arr[32];
4079         CHECK(secret->arr_len == 32);
4080         memcpy(secret_arr, secret->elems, 32); FREE(secret);
4081         unsigned char (*secret_ref)[32] = &secret_arr;
4082         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
4083         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
4084         return tag_ptr(ret_conv, true);
4085 }
4086
4087 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) {
4088         void* this_arg_ptr = untag_ptr(this_arg);
4089         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4090         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4091         LDKHolderCommitmentTransaction commitment_tx_conv;
4092         commitment_tx_conv.inner = untag_ptr(commitment_tx);
4093         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
4094         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
4095         commitment_tx_conv.is_owned = false;
4096         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4097         *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
4098         return tag_ptr(ret_conv, true);
4099 }
4100
4101 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) {
4102         void* this_arg_ptr = untag_ptr(this_arg);
4103         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4104         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4105         LDKTransaction justice_tx_ref;
4106         justice_tx_ref.datalen = justice_tx->arr_len;
4107         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4108         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
4109         justice_tx_ref.data_is_owned = true;
4110         unsigned char per_commitment_key_arr[32];
4111         CHECK(per_commitment_key->arr_len == 32);
4112         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
4113         unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4114         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4115         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
4116         return tag_ptr(ret_conv, true);
4117 }
4118
4119 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) {
4120         void* this_arg_ptr = untag_ptr(this_arg);
4121         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4122         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4123         LDKTransaction justice_tx_ref;
4124         justice_tx_ref.datalen = justice_tx->arr_len;
4125         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
4126         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
4127         justice_tx_ref.data_is_owned = true;
4128         unsigned char per_commitment_key_arr[32];
4129         CHECK(per_commitment_key->arr_len == 32);
4130         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
4131         unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
4132         LDKHTLCOutputInCommitment htlc_conv;
4133         htlc_conv.inner = untag_ptr(htlc);
4134         htlc_conv.is_owned = ptr_is_owned(htlc);
4135         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4136         htlc_conv.is_owned = false;
4137         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4138         *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);
4139         return tag_ptr(ret_conv, true);
4140 }
4141
4142 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) {
4143         void* this_arg_ptr = untag_ptr(this_arg);
4144         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4145         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4146         LDKTransaction htlc_tx_ref;
4147         htlc_tx_ref.datalen = htlc_tx->arr_len;
4148         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
4149         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
4150         htlc_tx_ref.data_is_owned = true;
4151         LDKPublicKey per_commitment_point_ref;
4152         CHECK(per_commitment_point->arr_len == 33);
4153         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
4154         LDKHTLCOutputInCommitment htlc_conv;
4155         htlc_conv.inner = untag_ptr(htlc);
4156         htlc_conv.is_owned = ptr_is_owned(htlc);
4157         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
4158         htlc_conv.is_owned = false;
4159         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4160         *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);
4161         return tag_ptr(ret_conv, true);
4162 }
4163
4164 uint64_t  __attribute__((export_name("TS_BaseSign_sign_closing_transaction"))) TS_BaseSign_sign_closing_transaction(uint64_t this_arg, uint64_t closing_tx) {
4165         void* this_arg_ptr = untag_ptr(this_arg);
4166         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4167         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4168         LDKClosingTransaction closing_tx_conv;
4169         closing_tx_conv.inner = untag_ptr(closing_tx);
4170         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
4171         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
4172         closing_tx_conv.is_owned = false;
4173         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4174         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
4175         return tag_ptr(ret_conv, true);
4176 }
4177
4178 uint64_t  __attribute__((export_name("TS_BaseSign_sign_channel_announcement"))) TS_BaseSign_sign_channel_announcement(uint64_t this_arg, uint64_t msg) {
4179         void* this_arg_ptr = untag_ptr(this_arg);
4180         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4181         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4182         LDKUnsignedChannelAnnouncement msg_conv;
4183         msg_conv.inner = untag_ptr(msg);
4184         msg_conv.is_owned = ptr_is_owned(msg);
4185         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
4186         msg_conv.is_owned = false;
4187         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
4188         *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
4189         return tag_ptr(ret_conv, true);
4190 }
4191
4192 void  __attribute__((export_name("TS_BaseSign_ready_channel"))) TS_BaseSign_ready_channel(uint64_t this_arg, uint64_t channel_parameters) {
4193         void* this_arg_ptr = untag_ptr(this_arg);
4194         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4195         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4196         LDKChannelTransactionParameters channel_parameters_conv;
4197         channel_parameters_conv.inner = untag_ptr(channel_parameters);
4198         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
4199         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
4200         channel_parameters_conv.is_owned = false;
4201         (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
4202 }
4203
4204 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
4205         if (this_arg->set_pubkeys != NULL)
4206                 this_arg->set_pubkeys(this_arg);
4207         return this_arg->pubkeys;
4208 }
4209 uint64_t  __attribute__((export_name("TS_BaseSign_get_pubkeys"))) TS_BaseSign_get_pubkeys(uint64_t this_arg) {
4210         void* this_arg_ptr = untag_ptr(this_arg);
4211         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4212         LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr;
4213         LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
4214         uint64_t ret_ref = 0;
4215         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4216         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4217         return ret_ref;
4218 }
4219
4220 typedef struct LDKSign_JCalls {
4221         atomic_size_t refcnt;
4222         uint32_t instance_ptr;
4223         LDKBaseSign_JCalls* BaseSign;
4224 } LDKSign_JCalls;
4225 static void LDKSign_JCalls_free(void* this_arg) {
4226         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
4227         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4228                 FREE(j_calls);
4229         }
4230 }
4231 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
4232         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
4233         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 15, 0, 0, 0, 0, 0, 0);
4234         LDKCVec_u8Z ret_ref;
4235         ret_ref.datalen = ret->arr_len;
4236         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4237         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
4238         return ret_ref;
4239 }
4240 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
4241         LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
4242         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4243         atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
4244 }
4245 static inline LDKSign LDKSign_init (JSValue o, JSValue BaseSign, uint64_t pubkeys) {
4246         LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
4247         atomic_init(&calls->refcnt, 1);
4248         calls->instance_ptr = o;
4249
4250         LDKChannelPublicKeys pubkeys_conv;
4251         pubkeys_conv.inner = untag_ptr(pubkeys);
4252         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
4253         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
4254
4255         LDKSign ret = {
4256                 .this_arg = (void*) calls,
4257                 .write = write_LDKSign_jcall,
4258                 .cloned = LDKSign_JCalls_cloned,
4259                 .free = LDKSign_JCalls_free,
4260                 .BaseSign = LDKBaseSign_init(BaseSign, pubkeys),
4261         };
4262         calls->BaseSign = ret.BaseSign.this_arg;
4263         return ret;
4264 }
4265 uint64_t  __attribute__((export_name("TS_LDKSign_new"))) TS_LDKSign_new(JSValue o, JSValue BaseSign, uint64_t pubkeys) {
4266         LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
4267         *res_ptr = LDKSign_init(o, BaseSign, pubkeys);
4268         return tag_ptr(res_ptr, true);
4269 }
4270 int8_tArray  __attribute__((export_name("TS_Sign_write"))) TS_Sign_write(uint64_t this_arg) {
4271         void* this_arg_ptr = untag_ptr(this_arg);
4272         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4273         LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr;
4274         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4275         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
4276         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
4277         CVec_u8Z_free(ret_var);
4278         return ret_arr;
4279 }
4280
4281 static inline struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
4282 CHECK(owner->result_ok);
4283         return Sign_clone(&*owner->contents.result);
4284 }
4285 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_get_ok"))) TS_CResult_SignDecodeErrorZ_get_ok(uint64_t owner) {
4286         LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(owner);
4287         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
4288         *ret_ret = CResult_SignDecodeErrorZ_get_ok(owner_conv);
4289         return tag_ptr(ret_ret, true);
4290 }
4291
4292 static inline struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){
4293         LDKDecodeError ret = *owner->contents.err;
4294         ret.is_owned = false;
4295         return ret;
4296 }
4297 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_get_err"))) TS_CResult_SignDecodeErrorZ_get_err(uint64_t owner) {
4298         LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(owner);
4299         LDKDecodeError ret_var = CResult_SignDecodeErrorZ_get_err(owner_conv);
4300         uint64_t ret_ref = 0;
4301         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4302         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4303         return ret_ref;
4304 }
4305
4306 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4307 CHECK(owner->result_ok);
4308         return *owner->contents.result;
4309 }
4310 int8_tArray  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_ok"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint64_t owner) {
4311         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
4312         int8_tArray ret_arr = init_int8_tArray(68, __LINE__);
4313         memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
4314         return ret_arr;
4315 }
4316
4317 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
4318 CHECK(!owner->result_ok);
4319         return *owner->contents.err;
4320 }
4321 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_err"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint64_t owner) {
4322         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
4323         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
4324 }
4325
4326 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
4327         LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
4328         for (size_t i = 0; i < ret.datalen; i++) {
4329                 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
4330         }
4331         return ret;
4332 }
4333 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4334 CHECK(owner->result_ok);
4335         return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
4336 }
4337 ptrArray  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok(uint64_t owner) {
4338         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
4339         LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
4340         ptrArray ret_arr = NULL;
4341         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
4342         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
4343         for (size_t m = 0; m < ret_var.datalen; m++) {
4344                 LDKCVec_u8Z ret_conv_12_var = ret_var.data[m];
4345                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
4346                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
4347                 CVec_u8Z_free(ret_conv_12_var);
4348                 ret_arr_ptr[m] = ret_conv_12_arr;
4349         }
4350         
4351         FREE(ret_var.data);
4352         return ret_arr;
4353 }
4354
4355 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
4356 CHECK(!owner->result_ok);
4357         return *owner->contents.err;
4358 }
4359 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_err(uint64_t owner) {
4360         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
4361         CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
4362 }
4363
4364 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4365         LDKInMemorySigner ret = *owner->contents.result;
4366         ret.is_owned = false;
4367         return ret;
4368 }
4369 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_get_ok(uint64_t owner) {
4370         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
4371         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
4372         uint64_t ret_ref = 0;
4373         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4374         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4375         return ret_ref;
4376 }
4377
4378 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4379         LDKDecodeError ret = *owner->contents.err;
4380         ret.is_owned = false;
4381         return ret;
4382 }
4383 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_err"))) TS_CResult_InMemorySignerDecodeErrorZ_get_err(uint64_t owner) {
4384         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
4385         LDKDecodeError ret_var = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
4386         uint64_t ret_ref = 0;
4387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4389         return ret_ref;
4390 }
4391
4392 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
4393         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
4394         for (size_t i = 0; i < ret.datalen; i++) {
4395                 ret.data[i] = TxOut_clone(&orig->data[i]);
4396         }
4397         return ret;
4398 }
4399 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4400 CHECK(owner->result_ok);
4401         return *owner->contents.result;
4402 }
4403 int8_tArray  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_ok"))) TS_CResult_TransactionNoneZ_get_ok(uint64_t owner) {
4404         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
4405         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
4406         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
4407         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
4408         return ret_arr;
4409 }
4410
4411 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
4412 CHECK(!owner->result_ok);
4413         return *owner->contents.err;
4414 }
4415 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_err"))) TS_CResult_TransactionNoneZ_get_err(uint64_t owner) {
4416         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
4417         CResult_TransactionNoneZ_get_err(owner_conv);
4418 }
4419
4420 uint32_t __attribute__((export_name("TS_LDKCOption_u16Z_ty_from_ptr"))) TS_LDKCOption_u16Z_ty_from_ptr(uint64_t ptr) {
4421         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
4422         switch(obj->tag) {
4423                 case LDKCOption_u16Z_Some: return 0;
4424                 case LDKCOption_u16Z_None: return 1;
4425                 default: abort();
4426         }
4427 }
4428 int16_t __attribute__((export_name("TS_LDKCOption_u16Z_Some_get_some"))) TS_LDKCOption_u16Z_Some_get_some(uint64_t ptr) {
4429         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
4430         assert(obj->tag == LDKCOption_u16Z_Some);
4431                         int16_t some_conv = obj->some;
4432         return some_conv;
4433 }
4434 uint32_t __attribute__((export_name("TS_LDKAPIError_ty_from_ptr"))) TS_LDKAPIError_ty_from_ptr(uint64_t ptr) {
4435         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4436         switch(obj->tag) {
4437                 case LDKAPIError_APIMisuseError: return 0;
4438                 case LDKAPIError_FeeRateTooHigh: return 1;
4439                 case LDKAPIError_RouteError: return 2;
4440                 case LDKAPIError_ChannelUnavailable: return 3;
4441                 case LDKAPIError_MonitorUpdateFailed: return 4;
4442                 case LDKAPIError_IncompatibleShutdownScript: return 5;
4443                 default: abort();
4444         }
4445 }
4446 jstring __attribute__((export_name("TS_LDKAPIError_APIMisuseError_get_err"))) TS_LDKAPIError_APIMisuseError_get_err(uint64_t ptr) {
4447         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4448         assert(obj->tag == LDKAPIError_APIMisuseError);
4449                         LDKStr err_str = obj->api_misuse_error.err;
4450                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4451         return err_conv;
4452 }
4453 jstring __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_err"))) TS_LDKAPIError_FeeRateTooHigh_get_err(uint64_t ptr) {
4454         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4455         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
4456                         LDKStr err_str = obj->fee_rate_too_high.err;
4457                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4458         return err_conv;
4459 }
4460 int32_t __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_feerate"))) TS_LDKAPIError_FeeRateTooHigh_get_feerate(uint64_t ptr) {
4461         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4462         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
4463                         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
4464         return feerate_conv;
4465 }
4466 jstring __attribute__((export_name("TS_LDKAPIError_RouteError_get_err"))) TS_LDKAPIError_RouteError_get_err(uint64_t ptr) {
4467         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4468         assert(obj->tag == LDKAPIError_RouteError);
4469                         LDKStr err_str = obj->route_error.err;
4470                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4471         return err_conv;
4472 }
4473 jstring __attribute__((export_name("TS_LDKAPIError_ChannelUnavailable_get_err"))) TS_LDKAPIError_ChannelUnavailable_get_err(uint64_t ptr) {
4474         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4475         assert(obj->tag == LDKAPIError_ChannelUnavailable);
4476                         LDKStr err_str = obj->channel_unavailable.err;
4477                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
4478         return err_conv;
4479 }
4480 uint64_t __attribute__((export_name("TS_LDKAPIError_IncompatibleShutdownScript_get_script"))) TS_LDKAPIError_IncompatibleShutdownScript_get_script(uint64_t ptr) {
4481         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
4482         assert(obj->tag == LDKAPIError_IncompatibleShutdownScript);
4483                         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
4484                         uint64_t script_ref = 0;
4485                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
4486                         script_ref = tag_ptr(script_var.inner, false);
4487         return script_ref;
4488 }
4489 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
4490 CHECK(owner->result_ok);
4491         return *owner->contents.result;
4492 }
4493 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_ok"))) TS_CResult_NoneAPIErrorZ_get_ok(uint64_t owner) {
4494         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
4495         CResult_NoneAPIErrorZ_get_ok(owner_conv);
4496 }
4497
4498 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
4499 CHECK(!owner->result_ok);
4500         return APIError_clone(&*owner->contents.err);
4501 }
4502 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_err"))) TS_CResult_NoneAPIErrorZ_get_err(uint64_t owner) {
4503         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
4504         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4505         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
4506         uint64_t ret_ref = tag_ptr(ret_copy, true);
4507         return ret_ref;
4508 }
4509
4510 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
4511         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
4512         for (size_t i = 0; i < ret.datalen; i++) {
4513                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
4514         }
4515         return ret;
4516 }
4517 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
4518         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
4519         for (size_t i = 0; i < ret.datalen; i++) {
4520                 ret.data[i] = APIError_clone(&orig->data[i]);
4521         }
4522         return ret;
4523 }
4524 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4525 CHECK(owner->result_ok);
4526         return ThirtyTwoBytes_clone(&*owner->contents.result);
4527 }
4528 int8_tArray  __attribute__((export_name("TS_CResult__u832APIErrorZ_get_ok"))) TS_CResult__u832APIErrorZ_get_ok(uint64_t owner) {
4529         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
4530         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4531         memcpy(ret_arr->elems, CResult__u832APIErrorZ_get_ok(owner_conv).data, 32);
4532         return ret_arr;
4533 }
4534
4535 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
4536 CHECK(!owner->result_ok);
4537         return APIError_clone(&*owner->contents.err);
4538 }
4539 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_get_err"))) TS_CResult__u832APIErrorZ_get_err(uint64_t owner) {
4540         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
4541         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4542         *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
4543         uint64_t ret_ref = tag_ptr(ret_copy, true);
4544         return ret_ref;
4545 }
4546
4547 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ty_from_ptr"))) TS_LDKPaymentSendFailure_ty_from_ptr(uint64_t ptr) {
4548         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4549         switch(obj->tag) {
4550                 case LDKPaymentSendFailure_ParameterError: return 0;
4551                 case LDKPaymentSendFailure_PathParameterError: return 1;
4552                 case LDKPaymentSendFailure_AllFailedRetrySafe: return 2;
4553                 case LDKPaymentSendFailure_PartialFailure: return 3;
4554                 default: abort();
4555         }
4556 }
4557 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_ParameterError_get_parameter_error"))) TS_LDKPaymentSendFailure_ParameterError_get_parameter_error(uint64_t ptr) {
4558         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4559         assert(obj->tag == LDKPaymentSendFailure_ParameterError);
4560                         uint64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
4561         return parameter_error_ref;
4562 }
4563 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error"))) TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(uint64_t ptr) {
4564         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4565         assert(obj->tag == LDKPaymentSendFailure_PathParameterError);
4566                         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
4567                         uint64_tArray path_parameter_error_arr = NULL;
4568                         path_parameter_error_arr = init_uint64_tArray(path_parameter_error_var.datalen, __LINE__);
4569                         uint64_t *path_parameter_error_arr_ptr = (uint64_t*)(((uint8_t*)path_parameter_error_arr) + 8);
4570                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
4571                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4572                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
4573                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
4574                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
4575                         }
4576                         
4577         return path_parameter_error_arr;
4578 }
4579 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_AllFailedRetrySafe_get_all_failed_retry_safe"))) TS_LDKPaymentSendFailure_AllFailedRetrySafe_get_all_failed_retry_safe(uint64_t ptr) {
4580         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4581         assert(obj->tag == LDKPaymentSendFailure_AllFailedRetrySafe);
4582                         LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
4583                         uint64_tArray all_failed_retry_safe_arr = NULL;
4584                         all_failed_retry_safe_arr = init_uint64_tArray(all_failed_retry_safe_var.datalen, __LINE__);
4585                         uint64_t *all_failed_retry_safe_arr_ptr = (uint64_t*)(((uint8_t*)all_failed_retry_safe_arr) + 8);
4586                         for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
4587                                 uint64_t all_failed_retry_safe_conv_10_ref = tag_ptr(&all_failed_retry_safe_var.data[k], false);
4588                                 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
4589                         }
4590                         
4591         return all_failed_retry_safe_arr;
4592 }
4593 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_results"))) TS_LDKPaymentSendFailure_PartialFailure_get_results(uint64_t ptr) {
4594         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4595         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4596                         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
4597                         uint64_tArray results_arr = NULL;
4598                         results_arr = init_uint64_tArray(results_var.datalen, __LINE__);
4599                         uint64_t *results_arr_ptr = (uint64_t*)(((uint8_t*)results_arr) + 8);
4600                         for (size_t w = 0; w < results_var.datalen; w++) {
4601                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4602                                 *results_conv_22_conv = results_var.data[w];
4603                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
4604                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
4605                         }
4606                         
4607         return results_arr;
4608 }
4609 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry"))) TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(uint64_t ptr) {
4610         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4611         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4612                         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
4613                         uint64_t failed_paths_retry_ref = 0;
4614                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
4615                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
4616         return failed_paths_retry_ref;
4617 }
4618 int8_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_payment_id"))) TS_LDKPaymentSendFailure_PartialFailure_get_payment_id(uint64_t ptr) {
4619         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
4620         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
4621                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4622                         memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
4623         return payment_id_arr;
4624 }
4625 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentSendFailureZ_get_ok(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
4626 CHECK(owner->result_ok);
4627         return ThirtyTwoBytes_clone(&*owner->contents.result);
4628 }
4629 int8_tArray  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_get_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_get_ok(uint64_t owner) {
4630         LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(owner);
4631         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4632         memcpy(ret_arr->elems, CResult_PaymentIdPaymentSendFailureZ_get_ok(owner_conv).data, 32);
4633         return ret_arr;
4634 }
4635
4636 static inline struct LDKPaymentSendFailure CResult_PaymentIdPaymentSendFailureZ_get_err(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){
4637 CHECK(!owner->result_ok);
4638         return PaymentSendFailure_clone(&*owner->contents.err);
4639 }
4640 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_get_err"))) TS_CResult_PaymentIdPaymentSendFailureZ_get_err(uint64_t owner) {
4641         LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(owner);
4642         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4643         *ret_copy = CResult_PaymentIdPaymentSendFailureZ_get_err(owner_conv);
4644         uint64_t ret_ref = tag_ptr(ret_copy, true);
4645         return ret_ref;
4646 }
4647
4648 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4649 CHECK(owner->result_ok);
4650         return *owner->contents.result;
4651 }
4652 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_ok"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint64_t owner) {
4653         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
4654         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
4655 }
4656
4657 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
4658 CHECK(!owner->result_ok);
4659         return PaymentSendFailure_clone(&*owner->contents.err);
4660 }
4661 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_err"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint64_t owner) {
4662         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
4663         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4664         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
4665         uint64_t ret_ref = tag_ptr(ret_copy, true);
4666         return ret_ref;
4667 }
4668
4669 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
4670         return ThirtyTwoBytes_clone(&owner->a);
4671 }
4672 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_a"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_a(uint64_t owner) {
4673         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
4674         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4675         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data, 32);
4676         return ret_arr;
4677 }
4678
4679 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
4680         return ThirtyTwoBytes_clone(&owner->b);
4681 }
4682 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_b"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_b(uint64_t owner) {
4683         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
4684         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4685         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data, 32);
4686         return ret_arr;
4687 }
4688
4689 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
4690 CHECK(owner->result_ok);
4691         return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
4692 }
4693 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(uint64_t owner) {
4694         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
4695         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
4696         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
4697         return tag_ptr(ret_conv, true);
4698 }
4699
4700 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
4701 CHECK(!owner->result_ok);
4702         return PaymentSendFailure_clone(&*owner->contents.err);
4703 }
4704 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(uint64_t owner) {
4705         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
4706         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
4707         *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
4708         uint64_t ret_ref = tag_ptr(ret_copy, true);
4709         return ret_ref;
4710 }
4711
4712 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
4713         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
4714         for (size_t i = 0; i < ret.datalen; i++) {
4715                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
4716         }
4717         return ret;
4718 }
4719 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
4720         return ThirtyTwoBytes_clone(&owner->a);
4721 }
4722 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_a"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_a(uint64_t owner) {
4723         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
4724         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4725         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data, 32);
4726         return ret_arr;
4727 }
4728
4729 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
4730         return ThirtyTwoBytes_clone(&owner->b);
4731 }
4732 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_b"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_b(uint64_t owner) {
4733         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
4734         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4735         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data, 32);
4736         return ret_arr;
4737 }
4738
4739 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
4740 CHECK(owner->result_ok);
4741         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
4742 }
4743 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(uint64_t owner) {
4744         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
4745         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
4746         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
4747         return tag_ptr(ret_conv, true);
4748 }
4749
4750 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
4751 CHECK(!owner->result_ok);
4752         return *owner->contents.err;
4753 }
4754 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(uint64_t owner) {
4755         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
4756         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
4757 }
4758
4759 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
4760 CHECK(owner->result_ok);
4761         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
4762 }
4763 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(uint64_t owner) {
4764         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
4765         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
4766         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(owner_conv);
4767         return tag_ptr(ret_conv, true);
4768 }
4769
4770 static inline struct LDKAPIError CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR owner){
4771 CHECK(!owner->result_ok);
4772         return APIError_clone(&*owner->contents.err);
4773 }
4774 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(uint64_t owner) {
4775         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(owner);
4776         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4777         *ret_copy = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(owner_conv);
4778         uint64_t ret_ref = tag_ptr(ret_copy, true);
4779         return ret_ref;
4780 }
4781
4782 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
4783 CHECK(owner->result_ok);
4784         return ThirtyTwoBytes_clone(&*owner->contents.result);
4785 }
4786 int8_tArray  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_ok"))) TS_CResult_PaymentSecretNoneZ_get_ok(uint64_t owner) {
4787         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
4788         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4789         memcpy(ret_arr->elems, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data, 32);
4790         return ret_arr;
4791 }
4792
4793 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
4794 CHECK(!owner->result_ok);
4795         return *owner->contents.err;
4796 }
4797 void  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_err"))) TS_CResult_PaymentSecretNoneZ_get_err(uint64_t owner) {
4798         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
4799         CResult_PaymentSecretNoneZ_get_err(owner_conv);
4800 }
4801
4802 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretAPIErrorZ_get_ok(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
4803 CHECK(owner->result_ok);
4804         return ThirtyTwoBytes_clone(&*owner->contents.result);
4805 }
4806 int8_tArray  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_ok"))) TS_CResult_PaymentSecretAPIErrorZ_get_ok(uint64_t owner) {
4807         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
4808         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4809         memcpy(ret_arr->elems, CResult_PaymentSecretAPIErrorZ_get_ok(owner_conv).data, 32);
4810         return ret_arr;
4811 }
4812
4813 static inline struct LDKAPIError CResult_PaymentSecretAPIErrorZ_get_err(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR owner){
4814 CHECK(!owner->result_ok);
4815         return APIError_clone(&*owner->contents.err);
4816 }
4817 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_get_err"))) TS_CResult_PaymentSecretAPIErrorZ_get_err(uint64_t owner) {
4818         LDKCResult_PaymentSecretAPIErrorZ* owner_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(owner);
4819         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4820         *ret_copy = CResult_PaymentSecretAPIErrorZ_get_err(owner_conv);
4821         uint64_t ret_ref = tag_ptr(ret_copy, true);
4822         return ret_ref;
4823 }
4824
4825 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
4826 CHECK(owner->result_ok);
4827         return ThirtyTwoBytes_clone(&*owner->contents.result);
4828 }
4829 int8_tArray  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_get_ok(uint64_t owner) {
4830         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
4831         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
4832         memcpy(ret_arr->elems, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data, 32);
4833         return ret_arr;
4834 }
4835
4836 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
4837 CHECK(!owner->result_ok);
4838         return APIError_clone(&*owner->contents.err);
4839 }
4840 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_err"))) TS_CResult_PaymentPreimageAPIErrorZ_get_err(uint64_t owner) {
4841         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
4842         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
4843         *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
4844         uint64_t ret_ref = tag_ptr(ret_copy, true);
4845         return ret_ref;
4846 }
4847
4848 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
4849         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
4850         ret.is_owned = false;
4851         return ret;
4852 }
4853 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(uint64_t owner) {
4854         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
4855         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
4856         uint64_t ret_ref = 0;
4857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4859         return ret_ref;
4860 }
4861
4862 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
4863         LDKDecodeError ret = *owner->contents.err;
4864         ret.is_owned = false;
4865         return ret;
4866 }
4867 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(uint64_t owner) {
4868         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
4869         LDKDecodeError ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
4870         uint64_t ret_ref = 0;
4871         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4872         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4873         return ret_ref;
4874 }
4875
4876 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
4877         LDKChannelCounterparty ret = *owner->contents.result;
4878         ret.is_owned = false;
4879         return ret;
4880 }
4881 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok(uint64_t owner) {
4882         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
4883         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
4884         uint64_t ret_ref = 0;
4885         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4886         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4887         return ret_ref;
4888 }
4889
4890 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
4891         LDKDecodeError ret = *owner->contents.err;
4892         ret.is_owned = false;
4893         return ret;
4894 }
4895 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err(uint64_t owner) {
4896         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
4897         LDKDecodeError ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
4898         uint64_t ret_ref = 0;
4899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4901         return ret_ref;
4902 }
4903
4904 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
4905         LDKChannelDetails ret = *owner->contents.result;
4906         ret.is_owned = false;
4907         return ret;
4908 }
4909 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_ok(uint64_t owner) {
4910         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
4911         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
4912         uint64_t ret_ref = 0;
4913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4915         return ret_ref;
4916 }
4917
4918 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
4919         LDKDecodeError ret = *owner->contents.err;
4920         ret.is_owned = false;
4921         return ret;
4922 }
4923 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_err(uint64_t owner) {
4924         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
4925         LDKDecodeError ret_var = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
4926         uint64_t ret_ref = 0;
4927         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4928         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4929         return ret_ref;
4930 }
4931
4932 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
4933         LDKPhantomRouteHints ret = *owner->contents.result;
4934         ret.is_owned = false;
4935         return ret;
4936 }
4937 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok(uint64_t owner) {
4938         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
4939         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
4940         uint64_t ret_ref = 0;
4941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4943         return ret_ref;
4944 }
4945
4946 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
4947         LDKDecodeError ret = *owner->contents.err;
4948         ret.is_owned = false;
4949         return ret;
4950 }
4951 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err(uint64_t owner) {
4952         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
4953         LDKDecodeError ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
4954         uint64_t ret_ref = 0;
4955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4957         return ret_ref;
4958 }
4959
4960 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
4961         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
4962         for (size_t i = 0; i < ret.datalen; i++) {
4963                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
4964         }
4965         return ret;
4966 }
4967 typedef struct LDKWatch_JCalls {
4968         atomic_size_t refcnt;
4969         uint32_t instance_ptr;
4970 } LDKWatch_JCalls;
4971 static void LDKWatch_JCalls_free(void* this_arg) {
4972         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4973         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4974                 FREE(j_calls);
4975         }
4976 }
4977 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
4978         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4979         LDKOutPoint funding_txo_var = funding_txo;
4980         uint64_t funding_txo_ref = 0;
4981         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
4982         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
4983         LDKChannelMonitor monitor_var = monitor;
4984         uint64_t monitor_ref = 0;
4985         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
4986         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
4987         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 16, funding_txo_ref, monitor_ref, 0, 0, 0, 0);
4988         void* ret_ptr = untag_ptr(ret);
4989         CHECK_ACCESS(ret_ptr);
4990         LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
4991         FREE(untag_ptr(ret));
4992         return ret_conv;
4993 }
4994 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
4995         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
4996         LDKOutPoint funding_txo_var = funding_txo;
4997         uint64_t funding_txo_ref = 0;
4998         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
4999         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
5000         LDKChannelMonitorUpdate update_var = update;
5001         uint64_t update_ref = 0;
5002         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
5003         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
5004         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 17, funding_txo_ref, update_ref, 0, 0, 0, 0);
5005         void* ret_ptr = untag_ptr(ret);
5006         CHECK_ACCESS(ret_ptr);
5007         LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
5008         FREE(untag_ptr(ret));
5009         return ret_conv;
5010 }
5011 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
5012         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
5013         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 18, 0, 0, 0, 0, 0, 0);
5014         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
5015         ret_constr.datalen = ret->arr_len;
5016         if (ret_constr.datalen > 0)
5017                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
5018         else
5019                 ret_constr.data = NULL;
5020         uint64_t* ret_vals = ret->elems;
5021         for (size_t x = 0; x < ret_constr.datalen; x++) {
5022                 uint64_t ret_conv_49 = ret_vals[x];
5023                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
5024                 CHECK_ACCESS(ret_conv_49_ptr);
5025                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
5026                 FREE(untag_ptr(ret_conv_49));
5027                 ret_constr.data[x] = ret_conv_49_conv;
5028         }
5029         FREE(ret);
5030         return ret_constr;
5031 }
5032 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
5033         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
5034         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5035 }
5036 static inline LDKWatch LDKWatch_init (JSValue o) {
5037         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
5038         atomic_init(&calls->refcnt, 1);
5039         calls->instance_ptr = o;
5040
5041         LDKWatch ret = {
5042                 .this_arg = (void*) calls,
5043                 .watch_channel = watch_channel_LDKWatch_jcall,
5044                 .update_channel = update_channel_LDKWatch_jcall,
5045                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
5046                 .free = LDKWatch_JCalls_free,
5047         };
5048         return ret;
5049 }
5050 uint64_t  __attribute__((export_name("TS_LDKWatch_new"))) TS_LDKWatch_new(JSValue o) {
5051         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
5052         *res_ptr = LDKWatch_init(o);
5053         return tag_ptr(res_ptr, true);
5054 }
5055 uint64_t  __attribute__((export_name("TS_Watch_watch_channel"))) TS_Watch_watch_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t monitor) {
5056         void* this_arg_ptr = untag_ptr(this_arg);
5057         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5058         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5059         LDKOutPoint funding_txo_conv;
5060         funding_txo_conv.inner = untag_ptr(funding_txo);
5061         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
5062         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5063         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5064         LDKChannelMonitor monitor_conv;
5065         monitor_conv.inner = untag_ptr(monitor);
5066         monitor_conv.is_owned = ptr_is_owned(monitor);
5067         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
5068         monitor_conv = ChannelMonitor_clone(&monitor_conv);
5069         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5070         *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
5071         return tag_ptr(ret_conv, true);
5072 }
5073
5074 uint64_t  __attribute__((export_name("TS_Watch_update_channel"))) TS_Watch_update_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t update) {
5075         void* this_arg_ptr = untag_ptr(this_arg);
5076         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5077         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5078         LDKOutPoint funding_txo_conv;
5079         funding_txo_conv.inner = untag_ptr(funding_txo);
5080         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
5081         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
5082         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
5083         LDKChannelMonitorUpdate update_conv;
5084         update_conv.inner = untag_ptr(update);
5085         update_conv.is_owned = ptr_is_owned(update);
5086         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
5087         update_conv = ChannelMonitorUpdate_clone(&update_conv);
5088         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5089         *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
5090         return tag_ptr(ret_conv, true);
5091 }
5092
5093 uint64_tArray  __attribute__((export_name("TS_Watch_release_pending_monitor_events"))) TS_Watch_release_pending_monitor_events(uint64_t this_arg) {
5094         void* this_arg_ptr = untag_ptr(this_arg);
5095         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5096         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
5097         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
5098         uint64_tArray ret_arr = NULL;
5099         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
5100         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
5101         for (size_t x = 0; x < ret_var.datalen; x++) {
5102                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
5103                 *ret_conv_49_conv = ret_var.data[x];
5104                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
5105         }
5106         
5107         FREE(ret_var.data);
5108         return ret_arr;
5109 }
5110
5111 typedef struct LDKBroadcasterInterface_JCalls {
5112         atomic_size_t refcnt;
5113         uint32_t instance_ptr;
5114 } LDKBroadcasterInterface_JCalls;
5115 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
5116         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5117         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5118                 FREE(j_calls);
5119         }
5120 }
5121 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
5122         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
5123         LDKTransaction tx_var = tx;
5124         int8_tArray tx_arr = init_int8_tArray(tx_var.datalen, __LINE__);
5125         memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
5126         Transaction_free(tx_var);
5127         js_invoke_function_uuuuuu(j_calls->instance_ptr, 19, (uint32_t)tx_arr, 0, 0, 0, 0, 0);
5128 }
5129 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
5130         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
5131         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5132 }
5133 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JSValue o) {
5134         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
5135         atomic_init(&calls->refcnt, 1);
5136         calls->instance_ptr = o;
5137
5138         LDKBroadcasterInterface ret = {
5139                 .this_arg = (void*) calls,
5140                 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
5141                 .free = LDKBroadcasterInterface_JCalls_free,
5142         };
5143         return ret;
5144 }
5145 uint64_t  __attribute__((export_name("TS_LDKBroadcasterInterface_new"))) TS_LDKBroadcasterInterface_new(JSValue o) {
5146         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
5147         *res_ptr = LDKBroadcasterInterface_init(o);
5148         return tag_ptr(res_ptr, true);
5149 }
5150 void  __attribute__((export_name("TS_BroadcasterInterface_broadcast_transaction"))) TS_BroadcasterInterface_broadcast_transaction(uint64_t this_arg, int8_tArray tx) {
5151         void* this_arg_ptr = untag_ptr(this_arg);
5152         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5153         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
5154         LDKTransaction tx_ref;
5155         tx_ref.datalen = tx->arr_len;
5156         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
5157         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
5158         tx_ref.data_is_owned = true;
5159         (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
5160 }
5161
5162 typedef struct LDKKeysInterface_JCalls {
5163         atomic_size_t refcnt;
5164         uint32_t instance_ptr;
5165 } LDKKeysInterface_JCalls;
5166 static void LDKKeysInterface_JCalls_free(void* this_arg) {
5167         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5168         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5169                 FREE(j_calls);
5170         }
5171 }
5172 LDKCResult_SecretKeyNoneZ get_node_secret_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) {
5173         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5174         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5175         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 20, recipient_conv, 0, 0, 0, 0, 0);
5176         void* ret_ptr = untag_ptr(ret);
5177         CHECK_ACCESS(ret_ptr);
5178         LDKCResult_SecretKeyNoneZ ret_conv = *(LDKCResult_SecretKeyNoneZ*)(ret_ptr);
5179         FREE(untag_ptr(ret));
5180         return ret_conv;
5181 }
5182 LDKCResult_SharedSecretNoneZ ecdh_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_ScalarZ tweak) {
5183         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5184         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
5185         int8_tArray other_key_arr = init_int8_tArray(33, __LINE__);
5186         memcpy(other_key_arr->elems, other_key.compressed_form, 33);
5187         LDKCOption_ScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
5188         *tweak_copy = tweak;
5189         uint64_t tweak_ref = tag_ptr(tweak_copy, true);
5190         uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 21, recipient_conv, (uint32_t)other_key_arr, tweak_ref, 0, 0, 0);
5191         void* ret_ptr = untag_ptr(ret);
5192         CHECK_ACCESS(ret_ptr);
5193         LDKCResult_SharedSecretNoneZ ret_conv = *(LDKCResult_SharedSecretNoneZ*)(ret_ptr);
5194         FREE(untag_ptr(ret));
5195         return ret_conv;
5196 }
5197 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
5198         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5199         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 22, 0, 0, 0, 0, 0, 0);
5200         LDKCVec_u8Z ret_ref;
5201         ret_ref.datalen = ret->arr_len;
5202         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5203         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
5204         return ret_ref;
5205 }
5206 LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
5207         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5208         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 23, 0, 0, 0, 0, 0, 0);
5209         LDKShutdownScript ret_conv;
5210         ret_conv.inner = untag_ptr(ret);
5211         ret_conv.is_owned = ptr_is_owned(ret);
5212         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
5213         return ret_conv;
5214 }
5215 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
5216         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5217         jboolean inbound_conv = inbound;
5218         int64_t channel_value_satoshis_conv = channel_value_satoshis;
5219         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 24, inbound_conv, channel_value_satoshis_conv, 0, 0, 0, 0);
5220         void* ret_ptr = untag_ptr(ret);
5221         CHECK_ACCESS(ret_ptr);
5222         LDKSign ret_conv = *(LDKSign*)(ret_ptr);
5223         FREE(untag_ptr(ret));
5224         return ret_conv;
5225 }
5226 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
5227         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5228         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 25, 0, 0, 0, 0, 0, 0);
5229         LDKThirtyTwoBytes ret_ref;
5230         CHECK(ret->arr_len == 32);
5231         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5232         return ret_ref;
5233 }
5234 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
5235         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5236         LDKu8slice reader_var = reader;
5237         int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__);
5238         memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
5239         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 26, (uint32_t)reader_arr, 0, 0, 0, 0, 0);
5240         void* ret_ptr = untag_ptr(ret);
5241         CHECK_ACCESS(ret_ptr);
5242         LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr);
5243         FREE(untag_ptr(ret));
5244         return ret_conv;
5245 }
5246 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_u5Z invoice_data, LDKRecipient receipient) {
5247         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5248         LDKu8slice hrp_bytes_var = hrp_bytes;
5249         int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__);
5250         memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen);
5251         LDKCVec_u5Z invoice_data_var = invoice_data;
5252         ptrArray invoice_data_arr = NULL;
5253         invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__);
5254         int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 8);
5255         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
5256                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
5257                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
5258         }
5259         
5260         FREE(invoice_data_var.data);
5261         uint32_t receipient_conv = LDKRecipient_to_js(receipient);
5262         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 27, (uint32_t)hrp_bytes_arr, (uint32_t)invoice_data_arr, receipient_conv, 0, 0, 0);
5263         void* ret_ptr = untag_ptr(ret);
5264         CHECK_ACCESS(ret_ptr);
5265         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
5266         FREE(untag_ptr(ret));
5267         return ret_conv;
5268 }
5269 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) {
5270         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
5271         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 28, 0, 0, 0, 0, 0, 0);
5272         LDKThirtyTwoBytes ret_ref;
5273         CHECK(ret->arr_len == 32);
5274         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
5275         return ret_ref;
5276 }
5277 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
5278         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
5279         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5280 }
5281 static inline LDKKeysInterface LDKKeysInterface_init (JSValue o) {
5282         LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
5283         atomic_init(&calls->refcnt, 1);
5284         calls->instance_ptr = o;
5285
5286         LDKKeysInterface ret = {
5287                 .this_arg = (void*) calls,
5288                 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
5289                 .ecdh = ecdh_LDKKeysInterface_jcall,
5290                 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
5291                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
5292                 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
5293                 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
5294                 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
5295                 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
5296                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall,
5297                 .free = LDKKeysInterface_JCalls_free,
5298         };
5299         return ret;
5300 }
5301 uint64_t  __attribute__((export_name("TS_LDKKeysInterface_new"))) TS_LDKKeysInterface_new(JSValue o) {
5302         LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
5303         *res_ptr = LDKKeysInterface_init(o);
5304         return tag_ptr(res_ptr, true);
5305 }
5306 uint64_t  __attribute__((export_name("TS_KeysInterface_get_node_secret"))) TS_KeysInterface_get_node_secret(uint64_t this_arg, uint32_t recipient) {
5307         void* this_arg_ptr = untag_ptr(this_arg);
5308         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5309         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5310         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5311         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
5312         *ret_conv = (this_arg_conv->get_node_secret)(this_arg_conv->this_arg, recipient_conv);
5313         return tag_ptr(ret_conv, true);
5314 }
5315
5316 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) {
5317         void* this_arg_ptr = untag_ptr(this_arg);
5318         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5319         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5320         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
5321         LDKPublicKey other_key_ref;
5322         CHECK(other_key->arr_len == 33);
5323         memcpy(other_key_ref.compressed_form, other_key->elems, 33); FREE(other_key);
5324         void* tweak_ptr = untag_ptr(tweak);
5325         CHECK_ACCESS(tweak_ptr);
5326         LDKCOption_ScalarZ tweak_conv = *(LDKCOption_ScalarZ*)(tweak_ptr);
5327         // WARNING: we may need a move here but no clone is available for LDKCOption_ScalarZ
5328         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
5329         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
5330         return tag_ptr(ret_conv, true);
5331 }
5332
5333 int8_tArray  __attribute__((export_name("TS_KeysInterface_get_destination_script"))) TS_KeysInterface_get_destination_script(uint64_t this_arg) {
5334         void* this_arg_ptr = untag_ptr(this_arg);
5335         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5336         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5337         LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
5338         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5339         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5340         CVec_u8Z_free(ret_var);
5341         return ret_arr;
5342 }
5343
5344 uint64_t  __attribute__((export_name("TS_KeysInterface_get_shutdown_scriptpubkey"))) TS_KeysInterface_get_shutdown_scriptpubkey(uint64_t this_arg) {
5345         void* this_arg_ptr = untag_ptr(this_arg);
5346         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5347         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5348         LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
5349         uint64_t ret_ref = 0;
5350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5352         return ret_ref;
5353 }
5354
5355 uint64_t  __attribute__((export_name("TS_KeysInterface_get_channel_signer"))) TS_KeysInterface_get_channel_signer(uint64_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
5356         void* this_arg_ptr = untag_ptr(this_arg);
5357         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5358         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5359         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
5360         *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
5361         return tag_ptr(ret_ret, true);
5362 }
5363
5364 int8_tArray  __attribute__((export_name("TS_KeysInterface_get_secure_random_bytes"))) TS_KeysInterface_get_secure_random_bytes(uint64_t this_arg) {
5365         void* this_arg_ptr = untag_ptr(this_arg);
5366         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5367         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5368         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5369         memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
5370         return ret_arr;
5371 }
5372
5373 uint64_t  __attribute__((export_name("TS_KeysInterface_read_chan_signer"))) TS_KeysInterface_read_chan_signer(uint64_t this_arg, int8_tArray reader) {
5374         void* this_arg_ptr = untag_ptr(this_arg);
5375         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5376         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5377         LDKu8slice reader_ref;
5378         reader_ref.datalen = reader->arr_len;
5379         reader_ref.data = reader->elems;
5380         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
5381         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
5382         FREE(reader);
5383         return tag_ptr(ret_conv, true);
5384 }
5385
5386 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) {
5387         void* this_arg_ptr = untag_ptr(this_arg);
5388         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5389         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5390         LDKu8slice hrp_bytes_ref;
5391         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
5392         hrp_bytes_ref.data = hrp_bytes->elems;
5393         LDKCVec_u5Z invoice_data_constr;
5394         invoice_data_constr.datalen = invoice_data->arr_len;
5395         if (invoice_data_constr.datalen > 0)
5396                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
5397         else
5398                 invoice_data_constr.data = NULL;
5399         int8_t* invoice_data_vals = (void*) invoice_data->elems;
5400         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
5401                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
5402                 
5403                 invoice_data_constr.data[h] = (LDKu5){ ._0 = invoice_data_conv_7 };
5404         }
5405         FREE(invoice_data);
5406         LDKRecipient receipient_conv = LDKRecipient_from_js(receipient);
5407         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
5408         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, receipient_conv);
5409         FREE(hrp_bytes);
5410         return tag_ptr(ret_conv, true);
5411 }
5412
5413 int8_tArray  __attribute__((export_name("TS_KeysInterface_get_inbound_payment_key_material"))) TS_KeysInterface_get_inbound_payment_key_material(uint64_t this_arg) {
5414         void* this_arg_ptr = untag_ptr(this_arg);
5415         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5416         LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr;
5417         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5418         memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
5419         return ret_arr;
5420 }
5421
5422 typedef struct LDKFeeEstimator_JCalls {
5423         atomic_size_t refcnt;
5424         uint32_t instance_ptr;
5425 } LDKFeeEstimator_JCalls;
5426 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
5427         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5428         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5429                 FREE(j_calls);
5430         }
5431 }
5432 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
5433         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
5434         uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
5435         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 29, confirmation_target_conv, 0, 0, 0, 0, 0);
5436 }
5437 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
5438         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
5439         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5440 }
5441 static inline LDKFeeEstimator LDKFeeEstimator_init (JSValue o) {
5442         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
5443         atomic_init(&calls->refcnt, 1);
5444         calls->instance_ptr = o;
5445
5446         LDKFeeEstimator ret = {
5447                 .this_arg = (void*) calls,
5448                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
5449                 .free = LDKFeeEstimator_JCalls_free,
5450         };
5451         return ret;
5452 }
5453 uint64_t  __attribute__((export_name("TS_LDKFeeEstimator_new"))) TS_LDKFeeEstimator_new(JSValue o) {
5454         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
5455         *res_ptr = LDKFeeEstimator_init(o);
5456         return tag_ptr(res_ptr, true);
5457 }
5458 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) {
5459         void* this_arg_ptr = untag_ptr(this_arg);
5460         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5461         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
5462         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
5463         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
5464         return ret_conv;
5465 }
5466
5467 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
5468         return ThirtyTwoBytes_clone(&owner->a);
5469 }
5470 int8_tArray  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_a"))) TS_C2Tuple_BlockHashChannelManagerZ_get_a(uint64_t owner) {
5471         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
5472         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5473         memcpy(ret_arr->elems, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data, 32);
5474         return ret_arr;
5475 }
5476
5477 static inline struct LDKChannelManager C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
5478         LDKChannelManager ret = owner->b;
5479         ret.is_owned = false;
5480         return ret;
5481 }
5482 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_b"))) TS_C2Tuple_BlockHashChannelManagerZ_get_b(uint64_t owner) {
5483         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
5484         LDKChannelManager ret_var = C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
5485         uint64_t ret_ref = 0;
5486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5488         return ret_ref;
5489 }
5490
5491 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
5492 CHECK(owner->result_ok);
5493         return &*owner->contents.result;
5494 }
5495 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint64_t owner) {
5496         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
5497         uint64_t ret_ret = tag_ptr(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
5498         return ret_ret;
5499 }
5500
5501 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
5502         LDKDecodeError ret = *owner->contents.err;
5503         ret.is_owned = false;
5504         return ret;
5505 }
5506 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint64_t owner) {
5507         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
5508         LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
5509         uint64_t ret_ref = 0;
5510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5512         return ret_ref;
5513 }
5514
5515 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
5516         LDKChannelConfig ret = *owner->contents.result;
5517         ret.is_owned = false;
5518         return ret;
5519 }
5520 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_get_ok(uint64_t owner) {
5521         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
5522         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
5523         uint64_t ret_ref = 0;
5524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5526         return ret_ref;
5527 }
5528
5529 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
5530         LDKDecodeError ret = *owner->contents.err;
5531         ret.is_owned = false;
5532         return ret;
5533 }
5534 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_err"))) TS_CResult_ChannelConfigDecodeErrorZ_get_err(uint64_t owner) {
5535         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
5536         LDKDecodeError ret_var = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
5537         uint64_t ret_ref = 0;
5538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5540         return ret_ref;
5541 }
5542
5543 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
5544         LDKOutPoint ret = *owner->contents.result;
5545         ret.is_owned = false;
5546         return ret;
5547 }
5548 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_ok"))) TS_CResult_OutPointDecodeErrorZ_get_ok(uint64_t owner) {
5549         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
5550         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
5551         uint64_t ret_ref = 0;
5552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5554         return ret_ref;
5555 }
5556
5557 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
5558         LDKDecodeError ret = *owner->contents.err;
5559         ret.is_owned = false;
5560         return ret;
5561 }
5562 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_err"))) TS_CResult_OutPointDecodeErrorZ_get_err(uint64_t owner) {
5563         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
5564         LDKDecodeError ret_var = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
5565         uint64_t ret_ref = 0;
5566         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5567         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5568         return ret_ref;
5569 }
5570
5571 typedef struct LDKType_JCalls {
5572         atomic_size_t refcnt;
5573         uint32_t instance_ptr;
5574 } LDKType_JCalls;
5575 static void LDKType_JCalls_free(void* this_arg) {
5576         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5577         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5578                 FREE(j_calls);
5579         }
5580 }
5581 uint16_t type_id_LDKType_jcall(const void* this_arg) {
5582         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5583         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 30, 0, 0, 0, 0, 0, 0);
5584 }
5585 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
5586         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5587         jstring ret = (jstring)js_invoke_function_uuuuuu(j_calls->instance_ptr, 31, 0, 0, 0, 0, 0, 0);
5588         LDKStr ret_conv = str_ref_to_owned_c(ret);
5589         return ret_conv;
5590 }
5591 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
5592         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
5593         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 32, 0, 0, 0, 0, 0, 0);
5594         LDKCVec_u8Z ret_ref;
5595         ret_ref.datalen = ret->arr_len;
5596         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
5597         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
5598         return ret_ref;
5599 }
5600 static void LDKType_JCalls_cloned(LDKType* new_obj) {
5601         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
5602         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5603 }
5604 static inline LDKType LDKType_init (JSValue o) {
5605         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
5606         atomic_init(&calls->refcnt, 1);
5607         calls->instance_ptr = o;
5608
5609         LDKType ret = {
5610                 .this_arg = (void*) calls,
5611                 .type_id = type_id_LDKType_jcall,
5612                 .debug_str = debug_str_LDKType_jcall,
5613                 .write = write_LDKType_jcall,
5614                 .cloned = LDKType_JCalls_cloned,
5615                 .free = LDKType_JCalls_free,
5616         };
5617         return ret;
5618 }
5619 uint64_t  __attribute__((export_name("TS_LDKType_new"))) TS_LDKType_new(JSValue o) {
5620         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
5621         *res_ptr = LDKType_init(o);
5622         return tag_ptr(res_ptr, true);
5623 }
5624 int16_t  __attribute__((export_name("TS_Type_type_id"))) TS_Type_type_id(uint64_t this_arg) {
5625         void* this_arg_ptr = untag_ptr(this_arg);
5626         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5627         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5628         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
5629         return ret_conv;
5630 }
5631
5632 jstring  __attribute__((export_name("TS_Type_debug_str"))) TS_Type_debug_str(uint64_t this_arg) {
5633         void* this_arg_ptr = untag_ptr(this_arg);
5634         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5635         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5636         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
5637         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
5638         Str_free(ret_str);
5639         return ret_conv;
5640 }
5641
5642 int8_tArray  __attribute__((export_name("TS_Type_write"))) TS_Type_write(uint64_t this_arg) {
5643         void* this_arg_ptr = untag_ptr(this_arg);
5644         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5645         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
5646         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
5647         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
5648         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
5649         CVec_u8Z_free(ret_var);
5650         return ret_arr;
5651 }
5652
5653 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_ty_from_ptr"))) TS_LDKCOption_TypeZ_ty_from_ptr(uint64_t ptr) {
5654         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
5655         switch(obj->tag) {
5656                 case LDKCOption_TypeZ_Some: return 0;
5657                 case LDKCOption_TypeZ_None: return 1;
5658                 default: abort();
5659         }
5660 }
5661 uint64_t __attribute__((export_name("TS_LDKCOption_TypeZ_Some_get_some"))) TS_LDKCOption_TypeZ_Some_get_some(uint64_t ptr) {
5662         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
5663         assert(obj->tag == LDKCOption_TypeZ_Some);
5664                         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
5665                         *some_ret = Type_clone(&obj->some);
5666         return tag_ptr(some_ret, true);
5667 }
5668 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
5669 CHECK(owner->result_ok);
5670         return COption_TypeZ_clone(&*owner->contents.result);
5671 }
5672 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_get_ok(uint64_t owner) {
5673         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
5674         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
5675         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
5676         uint64_t ret_ref = tag_ptr(ret_copy, true);
5677         return ret_ref;
5678 }
5679
5680 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
5681         LDKDecodeError ret = *owner->contents.err;
5682         ret.is_owned = false;
5683         return ret;
5684 }
5685 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_err"))) TS_CResult_COption_TypeZDecodeErrorZ_get_err(uint64_t owner) {
5686         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
5687         LDKDecodeError ret_var = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
5688         uint64_t ret_ref = 0;
5689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5691         return ret_ref;
5692 }
5693
5694 uint32_t __attribute__((export_name("TS_LDKPaymentError_ty_from_ptr"))) TS_LDKPaymentError_ty_from_ptr(uint64_t ptr) {
5695         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
5696         switch(obj->tag) {
5697                 case LDKPaymentError_Invoice: return 0;
5698                 case LDKPaymentError_Routing: return 1;
5699                 case LDKPaymentError_Sending: return 2;
5700                 default: abort();
5701         }
5702 }
5703 jstring __attribute__((export_name("TS_LDKPaymentError_Invoice_get_invoice"))) TS_LDKPaymentError_Invoice_get_invoice(uint64_t ptr) {
5704         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
5705         assert(obj->tag == LDKPaymentError_Invoice);
5706                         LDKStr invoice_str = obj->invoice;
5707                         jstring invoice_conv = str_ref_to_ts(invoice_str.chars, invoice_str.len);
5708         return invoice_conv;
5709 }
5710 uint64_t __attribute__((export_name("TS_LDKPaymentError_Routing_get_routing"))) TS_LDKPaymentError_Routing_get_routing(uint64_t ptr) {
5711         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
5712         assert(obj->tag == LDKPaymentError_Routing);
5713                         LDKLightningError routing_var = obj->routing;
5714                         uint64_t routing_ref = 0;
5715                         CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var);
5716                         routing_ref = tag_ptr(routing_var.inner, false);
5717         return routing_ref;
5718 }
5719 uint64_t __attribute__((export_name("TS_LDKPaymentError_Sending_get_sending"))) TS_LDKPaymentError_Sending_get_sending(uint64_t ptr) {
5720         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
5721         assert(obj->tag == LDKPaymentError_Sending);
5722                         uint64_t sending_ref = tag_ptr(&obj->sending, false);
5723         return sending_ref;
5724 }
5725 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
5726 CHECK(owner->result_ok);
5727         return ThirtyTwoBytes_clone(&*owner->contents.result);
5728 }
5729 int8_tArray  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_ok"))) TS_CResult_PaymentIdPaymentErrorZ_get_ok(uint64_t owner) {
5730         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
5731         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5732         memcpy(ret_arr->elems, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data, 32);
5733         return ret_arr;
5734 }
5735
5736 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
5737 CHECK(!owner->result_ok);
5738         return PaymentError_clone(&*owner->contents.err);
5739 }
5740 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_err"))) TS_CResult_PaymentIdPaymentErrorZ_get_err(uint64_t owner) {
5741         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
5742         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
5743         *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
5744         uint64_t ret_ref = tag_ptr(ret_copy, true);
5745         return ret_ref;
5746 }
5747
5748 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
5749         LDKInFlightHtlcs ret = *owner->contents.result;
5750         ret.is_owned = false;
5751         return ret;
5752 }
5753 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok(uint64_t owner) {
5754         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
5755         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
5756         uint64_t ret_ref = 0;
5757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5759         return ret_ref;
5760 }
5761
5762 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
5763         LDKDecodeError ret = *owner->contents.err;
5764         ret.is_owned = false;
5765         return ret;
5766 }
5767 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_err(uint64_t owner) {
5768         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
5769         LDKDecodeError ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
5770         uint64_t ret_ref = 0;
5771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5773         return ret_ref;
5774 }
5775
5776 uint32_t __attribute__((export_name("TS_LDKParseError_ty_from_ptr"))) TS_LDKParseError_ty_from_ptr(uint64_t ptr) {
5777         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5778         switch(obj->tag) {
5779                 case LDKParseError_Bech32Error: return 0;
5780                 case LDKParseError_ParseAmountError: return 1;
5781                 case LDKParseError_MalformedSignature: return 2;
5782                 case LDKParseError_BadPrefix: return 3;
5783                 case LDKParseError_UnknownCurrency: return 4;
5784                 case LDKParseError_UnknownSiPrefix: return 5;
5785                 case LDKParseError_MalformedHRP: return 6;
5786                 case LDKParseError_TooShortDataPart: return 7;
5787                 case LDKParseError_UnexpectedEndOfTaggedFields: return 8;
5788                 case LDKParseError_DescriptionDecodeError: return 9;
5789                 case LDKParseError_PaddingError: return 10;
5790                 case LDKParseError_IntegerOverflowError: return 11;
5791                 case LDKParseError_InvalidSegWitProgramLength: return 12;
5792                 case LDKParseError_InvalidPubKeyHashLength: return 13;
5793                 case LDKParseError_InvalidScriptHashLength: return 14;
5794                 case LDKParseError_InvalidRecoveryId: return 15;
5795                 case LDKParseError_InvalidSliceLength: return 16;
5796                 case LDKParseError_Skip: return 17;
5797                 default: abort();
5798         }
5799 }
5800 uint64_t __attribute__((export_name("TS_LDKParseError_Bech32Error_get_bech32_error"))) TS_LDKParseError_Bech32Error_get_bech32_error(uint64_t ptr) {
5801         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5802         assert(obj->tag == LDKParseError_Bech32Error);
5803                         uint64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
5804         return bech32_error_ref;
5805 }
5806 int32_t __attribute__((export_name("TS_LDKParseError_ParseAmountError_get_parse_amount_error"))) TS_LDKParseError_ParseAmountError_get_parse_amount_error(uint64_t ptr) {
5807         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5808         assert(obj->tag == LDKParseError_ParseAmountError);
5809                         /*obj->parse_amount_error*/
5810         return 0;
5811 }
5812 uint32_t __attribute__((export_name("TS_LDKParseError_MalformedSignature_get_malformed_signature"))) TS_LDKParseError_MalformedSignature_get_malformed_signature(uint64_t ptr) {
5813         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5814         assert(obj->tag == LDKParseError_MalformedSignature);
5815                         uint32_t malformed_signature_conv = LDKSecp256k1Error_to_js(obj->malformed_signature);
5816         return malformed_signature_conv;
5817 }
5818 int32_t __attribute__((export_name("TS_LDKParseError_DescriptionDecodeError_get_description_decode_error"))) TS_LDKParseError_DescriptionDecodeError_get_description_decode_error(uint64_t ptr) {
5819         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5820         assert(obj->tag == LDKParseError_DescriptionDecodeError);
5821                         /*obj->description_decode_error*/
5822         return 0;
5823 }
5824 jstring __attribute__((export_name("TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length"))) TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length(uint64_t ptr) {
5825         LDKParseError *obj = (LDKParseError*)untag_ptr(ptr);
5826         assert(obj->tag == LDKParseError_InvalidSliceLength);
5827                         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
5828                         jstring invalid_slice_length_conv = str_ref_to_ts(invalid_slice_length_str.chars, invalid_slice_length_str.len);
5829         return invalid_slice_length_conv;
5830 }
5831 static inline enum LDKSiPrefix CResult_SiPrefixParseErrorZ_get_ok(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
5832 CHECK(owner->result_ok);
5833         return SiPrefix_clone(&*owner->contents.result);
5834 }
5835 uint32_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_ok"))) TS_CResult_SiPrefixParseErrorZ_get_ok(uint64_t owner) {
5836         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
5837         uint32_t ret_conv = LDKSiPrefix_to_js(CResult_SiPrefixParseErrorZ_get_ok(owner_conv));
5838         return ret_conv;
5839 }
5840
5841 static inline struct LDKParseError CResult_SiPrefixParseErrorZ_get_err(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){
5842 CHECK(!owner->result_ok);
5843         return ParseError_clone(&*owner->contents.err);
5844 }
5845 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_err"))) TS_CResult_SiPrefixParseErrorZ_get_err(uint64_t owner) {
5846         LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner);
5847         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
5848         *ret_copy = CResult_SiPrefixParseErrorZ_get_err(owner_conv);
5849         uint64_t ret_ref = tag_ptr(ret_copy, true);
5850         return ret_ref;
5851 }
5852
5853 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_ty_from_ptr"))) TS_LDKParseOrSemanticError_ty_from_ptr(uint64_t ptr) {
5854         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
5855         switch(obj->tag) {
5856                 case LDKParseOrSemanticError_ParseError: return 0;
5857                 case LDKParseOrSemanticError_SemanticError: return 1;
5858                 default: abort();
5859         }
5860 }
5861 uint64_t __attribute__((export_name("TS_LDKParseOrSemanticError_ParseError_get_parse_error"))) TS_LDKParseOrSemanticError_ParseError_get_parse_error(uint64_t ptr) {
5862         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
5863         assert(obj->tag == LDKParseOrSemanticError_ParseError);
5864                         uint64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
5865         return parse_error_ref;
5866 }
5867 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_SemanticError_get_semantic_error"))) TS_LDKParseOrSemanticError_SemanticError_get_semantic_error(uint64_t ptr) {
5868         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
5869         assert(obj->tag == LDKParseOrSemanticError_SemanticError);
5870                         uint32_t semantic_error_conv = LDKSemanticError_to_js(obj->semantic_error);
5871         return semantic_error_conv;
5872 }
5873 static inline struct LDKInvoice CResult_InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
5874         LDKInvoice ret = *owner->contents.result;
5875         ret.is_owned = false;
5876         return ret;
5877 }
5878 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok(uint64_t owner) {
5879         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
5880         LDKInvoice ret_var = CResult_InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
5881         uint64_t ret_ref = 0;
5882         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5883         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5884         return ret_ref;
5885 }
5886
5887 static inline struct LDKParseOrSemanticError CResult_InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
5888 CHECK(!owner->result_ok);
5889         return ParseOrSemanticError_clone(&*owner->contents.err);
5890 }
5891 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_err(uint64_t owner) {
5892         LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
5893         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
5894         *ret_copy = CResult_InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
5895         uint64_t ret_ref = tag_ptr(ret_copy, true);
5896         return ret_ref;
5897 }
5898
5899 static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceParseErrorZ_get_ok(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
5900         LDKSignedRawInvoice ret = *owner->contents.result;
5901         ret.is_owned = false;
5902         return ret;
5903 }
5904 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_ok(uint64_t owner) {
5905         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
5906         LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceParseErrorZ_get_ok(owner_conv);
5907         uint64_t ret_ref = 0;
5908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5910         return ret_ref;
5911 }
5912
5913 static inline struct LDKParseError CResult_SignedRawInvoiceParseErrorZ_get_err(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){
5914 CHECK(!owner->result_ok);
5915         return ParseError_clone(&*owner->contents.err);
5916 }
5917 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_err(uint64_t owner) {
5918         LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner);
5919         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
5920         *ret_copy = CResult_SignedRawInvoiceParseErrorZ_get_err(owner_conv);
5921         uint64_t ret_ref = tag_ptr(ret_copy, true);
5922         return ret_ref;
5923 }
5924
5925 static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
5926         LDKRawInvoice ret = owner->a;
5927         ret.is_owned = false;
5928         return ret;
5929 }
5930 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(uint64_t owner) {
5931         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
5932         LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv);
5933         uint64_t ret_ref = 0;
5934         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5935         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5936         return ret_ref;
5937 }
5938
5939 static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
5940         return ThirtyTwoBytes_clone(&owner->b);
5941 }
5942 int8_tArray  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(uint64_t owner) {
5943         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
5944         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5945         memcpy(ret_arr->elems, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data, 32);
5946         return ret_arr;
5947 }
5948
5949 static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){
5950         LDKInvoiceSignature ret = owner->c;
5951         ret.is_owned = false;
5952         return ret;
5953 }
5954 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(uint64_t owner) {
5955         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner);
5956         LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(owner_conv);
5957         uint64_t ret_ref = 0;
5958         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5959         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5960         return ret_ref;
5961 }
5962
5963 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
5964         LDKPayeePubKey ret = *owner->contents.result;
5965         ret.is_owned = false;
5966         return ret;
5967 }
5968 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_ok"))) TS_CResult_PayeePubKeyErrorZ_get_ok(uint64_t owner) {
5969         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
5970         LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
5971         uint64_t ret_ref = 0;
5972         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5973         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5974         return ret_ref;
5975 }
5976
5977 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
5978 CHECK(!owner->result_ok);
5979         return *owner->contents.err;
5980 }
5981 uint32_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_err"))) TS_CResult_PayeePubKeyErrorZ_get_err(uint64_t owner) {
5982         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
5983         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PayeePubKeyErrorZ_get_err(owner_conv));
5984         return ret_conv;
5985 }
5986
5987 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
5988         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
5989         for (size_t i = 0; i < ret.datalen; i++) {
5990                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
5991         }
5992         return ret;
5993 }
5994 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
5995         LDKPositiveTimestamp ret = *owner->contents.result;
5996         ret.is_owned = false;
5997         return ret;
5998 }
5999 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_get_ok(uint64_t owner) {
6000         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
6001         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
6002         uint64_t ret_ref = 0;
6003         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6004         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6005         return ret_ref;
6006 }
6007
6008 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
6009 CHECK(!owner->result_ok);
6010         return CreationError_clone(&*owner->contents.err);
6011 }
6012 uint32_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_err"))) TS_CResult_PositiveTimestampCreationErrorZ_get_err(uint64_t owner) {
6013         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
6014         uint32_t ret_conv = LDKCreationError_to_js(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
6015         return ret_conv;
6016 }
6017
6018 static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
6019 CHECK(owner->result_ok);
6020         return *owner->contents.result;
6021 }
6022 void  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_ok"))) TS_CResult_NoneSemanticErrorZ_get_ok(uint64_t owner) {
6023         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
6024         CResult_NoneSemanticErrorZ_get_ok(owner_conv);
6025 }
6026
6027 static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){
6028 CHECK(!owner->result_ok);
6029         return SemanticError_clone(&*owner->contents.err);
6030 }
6031 uint32_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_err"))) TS_CResult_NoneSemanticErrorZ_get_err(uint64_t owner) {
6032         LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner);
6033         uint32_t ret_conv = LDKSemanticError_to_js(CResult_NoneSemanticErrorZ_get_err(owner_conv));
6034         return ret_conv;
6035 }
6036
6037 static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
6038         LDKInvoice ret = *owner->contents.result;
6039         ret.is_owned = false;
6040         return ret;
6041 }
6042 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_ok"))) TS_CResult_InvoiceSemanticErrorZ_get_ok(uint64_t owner) {
6043         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
6044         LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv);
6045         uint64_t ret_ref = 0;
6046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6048         return ret_ref;
6049 }
6050
6051 static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){
6052 CHECK(!owner->result_ok);
6053         return SemanticError_clone(&*owner->contents.err);
6054 }
6055 uint32_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_err"))) TS_CResult_InvoiceSemanticErrorZ_get_err(uint64_t owner) {
6056         LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner);
6057         uint32_t ret_conv = LDKSemanticError_to_js(CResult_InvoiceSemanticErrorZ_get_err(owner_conv));
6058         return ret_conv;
6059 }
6060
6061 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
6062         LDKDescription ret = *owner->contents.result;
6063         ret.is_owned = false;
6064         return ret;
6065 }
6066 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_ok"))) TS_CResult_DescriptionCreationErrorZ_get_ok(uint64_t owner) {
6067         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
6068         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
6069         uint64_t ret_ref = 0;
6070         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6071         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6072         return ret_ref;
6073 }
6074
6075 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
6076 CHECK(!owner->result_ok);
6077         return CreationError_clone(&*owner->contents.err);
6078 }
6079 uint32_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_err"))) TS_CResult_DescriptionCreationErrorZ_get_err(uint64_t owner) {
6080         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
6081         uint32_t ret_conv = LDKCreationError_to_js(CResult_DescriptionCreationErrorZ_get_err(owner_conv));
6082         return ret_conv;
6083 }
6084
6085 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
6086         LDKPrivateRoute ret = *owner->contents.result;
6087         ret.is_owned = false;
6088         return ret;
6089 }
6090 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_ok"))) TS_CResult_PrivateRouteCreationErrorZ_get_ok(uint64_t owner) {
6091         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
6092         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
6093         uint64_t ret_ref = 0;
6094         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6095         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6096         return ret_ref;
6097 }
6098
6099 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
6100 CHECK(!owner->result_ok);
6101         return CreationError_clone(&*owner->contents.err);
6102 }
6103 uint32_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_err"))) TS_CResult_PrivateRouteCreationErrorZ_get_err(uint64_t owner) {
6104         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
6105         uint32_t ret_conv = LDKCreationError_to_js(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
6106         return ret_conv;
6107 }
6108
6109 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
6110 CHECK(owner->result_ok);
6111         return *owner->contents.result;
6112 }
6113 jstring  __attribute__((export_name("TS_CResult_StringErrorZ_get_ok"))) TS_CResult_StringErrorZ_get_ok(uint64_t owner) {
6114         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
6115         LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
6116         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
6117         return ret_conv;
6118 }
6119
6120 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
6121 CHECK(!owner->result_ok);
6122         return *owner->contents.err;
6123 }
6124 uint32_t  __attribute__((export_name("TS_CResult_StringErrorZ_get_err"))) TS_CResult_StringErrorZ_get_err(uint64_t owner) {
6125         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
6126         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StringErrorZ_get_err(owner_conv));
6127         return ret_conv;
6128 }
6129
6130 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6131         LDKChannelMonitorUpdate ret = *owner->contents.result;
6132         ret.is_owned = false;
6133         return ret;
6134 }
6135 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint64_t owner) {
6136         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
6137         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
6138         uint64_t ret_ref = 0;
6139         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6140         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6141         return ret_ref;
6142 }
6143
6144 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
6145         LDKDecodeError ret = *owner->contents.err;
6146         ret.is_owned = false;
6147         return ret;
6148 }
6149 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint64_t owner) {
6150         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
6151         LDKDecodeError ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
6152         uint64_t ret_ref = 0;
6153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6155         return ret_ref;
6156 }
6157
6158 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_ty_from_ptr"))) TS_LDKCOption_MonitorEventZ_ty_from_ptr(uint64_t ptr) {
6159         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
6160         switch(obj->tag) {
6161                 case LDKCOption_MonitorEventZ_Some: return 0;
6162                 case LDKCOption_MonitorEventZ_None: return 1;
6163                 default: abort();
6164         }
6165 }
6166 uint64_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_Some_get_some"))) TS_LDKCOption_MonitorEventZ_Some_get_some(uint64_t ptr) {
6167         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
6168         assert(obj->tag == LDKCOption_MonitorEventZ_Some);
6169                         uint64_t some_ref = tag_ptr(&obj->some, false);
6170         return some_ref;
6171 }
6172 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6173 CHECK(owner->result_ok);
6174         return COption_MonitorEventZ_clone(&*owner->contents.result);
6175 }
6176 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint64_t owner) {
6177         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
6178         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
6179         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
6180         uint64_t ret_ref = tag_ptr(ret_copy, true);
6181         return ret_ref;
6182 }
6183
6184 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
6185         LDKDecodeError ret = *owner->contents.err;
6186         ret.is_owned = false;
6187         return ret;
6188 }
6189 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint64_t owner) {
6190         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
6191         LDKDecodeError ret_var = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
6192         uint64_t ret_ref = 0;
6193         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6194         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6195         return ret_ref;
6196 }
6197
6198 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6199         LDKHTLCUpdate ret = *owner->contents.result;
6200         ret.is_owned = false;
6201         return ret;
6202 }
6203 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint64_t owner) {
6204         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
6205         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
6206         uint64_t ret_ref = 0;
6207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6209         return ret_ref;
6210 }
6211
6212 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
6213         LDKDecodeError ret = *owner->contents.err;
6214         ret.is_owned = false;
6215         return ret;
6216 }
6217 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint64_t owner) {
6218         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
6219         LDKDecodeError ret_var = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
6220         uint64_t ret_ref = 0;
6221         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6222         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6223         return ret_ref;
6224 }
6225
6226 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
6227         LDKOutPoint ret = owner->a;
6228         ret.is_owned = false;
6229         return ret;
6230 }
6231 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_a"))) TS_C2Tuple_OutPointScriptZ_get_a(uint64_t owner) {
6232         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
6233         LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
6234         uint64_t ret_ref = 0;
6235         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6236         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6237         return ret_ref;
6238 }
6239
6240 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
6241         return CVec_u8Z_clone(&owner->b);
6242 }
6243 int8_tArray  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_b"))) TS_C2Tuple_OutPointScriptZ_get_b(uint64_t owner) {
6244         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
6245         LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
6246         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6247         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6248         CVec_u8Z_free(ret_var);
6249         return ret_arr;
6250 }
6251
6252 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
6253         return owner->a;
6254 }
6255 int32_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_a"))) TS_C2Tuple_u32ScriptZ_get_a(uint64_t owner) {
6256         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
6257         int32_t ret_conv = C2Tuple_u32ScriptZ_get_a(owner_conv);
6258         return ret_conv;
6259 }
6260
6261 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
6262         return CVec_u8Z_clone(&owner->b);
6263 }
6264 int8_tArray  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_b"))) TS_C2Tuple_u32ScriptZ_get_b(uint64_t owner) {
6265         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
6266         LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
6267         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6268         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6269         CVec_u8Z_free(ret_var);
6270         return ret_arr;
6271 }
6272
6273 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
6274         LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
6275         for (size_t i = 0; i < ret.datalen; i++) {
6276                 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
6277         }
6278         return ret;
6279 }
6280 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
6281         return ThirtyTwoBytes_clone(&owner->a);
6282 }
6283 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint64_t owner) {
6284         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
6285         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6286         memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data, 32);
6287         return ret_arr;
6288 }
6289
6290 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
6291         return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
6292 }
6293 uint64_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint64_t owner) {
6294         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
6295         LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
6296         uint64_tArray ret_arr = NULL;
6297         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6298         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6299         for (size_t v = 0; v < ret_var.datalen; v++) {
6300                 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
6301                 *ret_conv_21_conv = ret_var.data[v];
6302                 ret_arr_ptr[v] = tag_ptr(ret_conv_21_conv, true);
6303         }
6304         
6305         FREE(ret_var.data);
6306         return ret_arr;
6307 }
6308
6309 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
6310         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 };
6311         for (size_t i = 0; i < ret.datalen; i++) {
6312                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
6313         }
6314         return ret;
6315 }
6316 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
6317         LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
6318         for (size_t i = 0; i < ret.datalen; i++) {
6319                 ret.data[i] = Event_clone(&orig->data[i]);
6320         }
6321         return ret;
6322 }
6323 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6324         return owner->a;
6325 }
6326 int32_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_a"))) TS_C2Tuple_u32TxOutZ_get_a(uint64_t owner) {
6327         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
6328         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
6329         return ret_conv;
6330 }
6331
6332 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
6333         return TxOut_clone(&owner->b);
6334 }
6335 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_b"))) TS_C2Tuple_u32TxOutZ_get_b(uint64_t owner) {
6336         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
6337         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6338         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
6339         return tag_ptr(ret_ref, true);
6340 }
6341
6342 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
6343         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
6344         for (size_t i = 0; i < ret.datalen; i++) {
6345                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
6346         }
6347         return ret;
6348 }
6349 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6350         return ThirtyTwoBytes_clone(&owner->a);
6351 }
6352 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint64_t owner) {
6353         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
6354         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6355         memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
6356         return ret_arr;
6357 }
6358
6359 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
6360         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
6361 }
6362 uint64_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint64_t owner) {
6363         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
6364         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
6365         uint64_tArray ret_arr = NULL;
6366         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6367         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6368         for (size_t u = 0; u < ret_var.datalen; u++) {
6369                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
6370                 *ret_conv_20_conv = ret_var.data[u];
6371                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
6372         }
6373         
6374         FREE(ret_var.data);
6375         return ret_arr;
6376 }
6377
6378 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
6379         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 };
6380         for (size_t i = 0; i < ret.datalen; i++) {
6381                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
6382         }
6383         return ret;
6384 }
6385 uint32_t __attribute__((export_name("TS_LDKBalance_ty_from_ptr"))) TS_LDKBalance_ty_from_ptr(uint64_t ptr) {
6386         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6387         switch(obj->tag) {
6388                 case LDKBalance_ClaimableOnChannelClose: return 0;
6389                 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
6390                 case LDKBalance_ContentiousClaimable: return 2;
6391                 case LDKBalance_MaybeTimeoutClaimableHTLC: return 3;
6392                 case LDKBalance_MaybePreimageClaimableHTLC: return 4;
6393                 case LDKBalance_CounterpartyRevokedOutputClaimable: return 5;
6394                 default: abort();
6395         }
6396 }
6397 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableOnChannelClose_get_claimable_amount_satoshis(uint64_t ptr) {
6398         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6399         assert(obj->tag == LDKBalance_ClaimableOnChannelClose);
6400                         int64_t claimable_amount_satoshis_conv = obj->claimable_on_channel_close.claimable_amount_satoshis;
6401         return claimable_amount_satoshis_conv;
6402 }
6403 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_claimable_amount_satoshis(uint64_t ptr) {
6404         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6405         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6406                         int64_t claimable_amount_satoshis_conv = obj->claimable_awaiting_confirmations.claimable_amount_satoshis;
6407         return claimable_amount_satoshis_conv;
6408 }
6409 int32_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(uint64_t ptr) {
6410         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6411         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
6412                         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
6413         return confirmation_height_conv;
6414 }
6415 int64_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis"))) TS_LDKBalance_ContentiousClaimable_get_claimable_amount_satoshis(uint64_t ptr) {
6416         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6417         assert(obj->tag == LDKBalance_ContentiousClaimable);
6418                         int64_t claimable_amount_satoshis_conv = obj->contentious_claimable.claimable_amount_satoshis;
6419         return claimable_amount_satoshis_conv;
6420 }
6421 int32_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_timeout_height"))) TS_LDKBalance_ContentiousClaimable_get_timeout_height(uint64_t ptr) {
6422         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6423         assert(obj->tag == LDKBalance_ContentiousClaimable);
6424                         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
6425         return timeout_height_conv;
6426 }
6427 int64_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_amount_satoshis"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_amount_satoshis(uint64_t ptr) {
6428         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6429         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
6430                         int64_t claimable_amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.claimable_amount_satoshis;
6431         return claimable_amount_satoshis_conv;
6432 }
6433 int32_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height(uint64_t ptr) {
6434         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6435         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
6436                         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
6437         return claimable_height_conv;
6438 }
6439 int64_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_claimable_amount_satoshis"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_claimable_amount_satoshis(uint64_t ptr) {
6440         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6441         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
6442                         int64_t claimable_amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.claimable_amount_satoshis;
6443         return claimable_amount_satoshis_conv;
6444 }
6445 int32_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height(uint64_t ptr) {
6446         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6447         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
6448                         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
6449         return expiry_height_conv;
6450 }
6451 int64_t __attribute__((export_name("TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_claimable_amount_satoshis"))) TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_claimable_amount_satoshis(uint64_t ptr) {
6452         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
6453         assert(obj->tag == LDKBalance_CounterpartyRevokedOutputClaimable);
6454                         int64_t claimable_amount_satoshis_conv = obj->counterparty_revoked_output_claimable.claimable_amount_satoshis;
6455         return claimable_amount_satoshis_conv;
6456 }
6457 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
6458         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
6459         for (size_t i = 0; i < ret.datalen; i++) {
6460                 ret.data[i] = Balance_clone(&orig->data[i]);
6461         }
6462         return ret;
6463 }
6464 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
6465         return ThirtyTwoBytes_clone(&owner->a);
6466 }
6467 int8_tArray  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_a"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_a(uint64_t owner) {
6468         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
6469         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6470         memcpy(ret_arr->elems, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data, 32);
6471         return ret_arr;
6472 }
6473
6474 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
6475         LDKChannelMonitor ret = owner->b;
6476         ret.is_owned = false;
6477         return ret;
6478 }
6479 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_b"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_b(uint64_t owner) {
6480         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
6481         LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
6482         uint64_t ret_ref = 0;
6483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6485         return ret_ref;
6486 }
6487
6488 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6489 CHECK(owner->result_ok);
6490         return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
6491 }
6492 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint64_t owner) {
6493         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
6494         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
6495         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
6496         return tag_ptr(ret_conv, true);
6497 }
6498
6499 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
6500         LDKDecodeError ret = *owner->contents.err;
6501         ret.is_owned = false;
6502         return ret;
6503 }
6504 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint64_t owner) {
6505         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
6506         LDKDecodeError ret_var = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
6507         uint64_t ret_ref = 0;
6508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6510         return ret_ref;
6511 }
6512
6513 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6514         return owner->a;
6515 }
6516 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_a"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint64_t owner) {
6517         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
6518         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
6519         memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
6520         return ret_arr;
6521 }
6522
6523 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
6524         return Type_clone(&owner->b);
6525 }
6526 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_b"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint64_t owner) {
6527         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
6528         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
6529         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
6530         return tag_ptr(ret_ret, true);
6531 }
6532
6533 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
6534         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
6535         for (size_t i = 0; i < ret.datalen; i++) {
6536                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
6537         }
6538         return ret;
6539 }
6540 uint32_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_ty_from_ptr"))) TS_LDKCOption_NetAddressZ_ty_from_ptr(uint64_t ptr) {
6541         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
6542         switch(obj->tag) {
6543                 case LDKCOption_NetAddressZ_Some: return 0;
6544                 case LDKCOption_NetAddressZ_None: return 1;
6545                 default: abort();
6546         }
6547 }
6548 uint64_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_Some_get_some"))) TS_LDKCOption_NetAddressZ_Some_get_some(uint64_t ptr) {
6549         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
6550         assert(obj->tag == LDKCOption_NetAddressZ_Some);
6551                         uint64_t some_ref = tag_ptr(&obj->some, false);
6552         return some_ref;
6553 }
6554 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
6555 CHECK(owner->result_ok);
6556         return CVec_u8Z_clone(&*owner->contents.result);
6557 }
6558 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint64_t owner) {
6559         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
6560         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
6561         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
6562         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
6563         CVec_u8Z_free(ret_var);
6564         return ret_arr;
6565 }
6566
6567 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
6568         LDKPeerHandleError ret = *owner->contents.err;
6569         ret.is_owned = false;
6570         return ret;
6571 }
6572 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err(uint64_t owner) {
6573         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
6574         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
6575         uint64_t ret_ref = 0;
6576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6578         return ret_ref;
6579 }
6580
6581 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
6582 CHECK(owner->result_ok);
6583         return *owner->contents.result;
6584 }
6585 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_ok"))) TS_CResult_NonePeerHandleErrorZ_get_ok(uint64_t owner) {
6586         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
6587         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
6588 }
6589
6590 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
6591         LDKPeerHandleError ret = *owner->contents.err;
6592         ret.is_owned = false;
6593         return ret;
6594 }
6595 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_err"))) TS_CResult_NonePeerHandleErrorZ_get_err(uint64_t owner) {
6596         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
6597         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
6598         uint64_t ret_ref = 0;
6599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6601         return ret_ref;
6602 }
6603
6604 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
6605 CHECK(owner->result_ok);
6606         return *owner->contents.result;
6607 }
6608 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_ok"))) TS_CResult_boolPeerHandleErrorZ_get_ok(uint64_t owner) {
6609         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
6610         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
6611         return ret_conv;
6612 }
6613
6614 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
6615         LDKPeerHandleError ret = *owner->contents.err;
6616         ret.is_owned = false;
6617         return ret;
6618 }
6619 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_err"))) TS_CResult_boolPeerHandleErrorZ_get_err(uint64_t owner) {
6620         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
6621         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
6622         uint64_t ret_ref = 0;
6623         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6624         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6625         return ret_ref;
6626 }
6627
6628 uint32_t __attribute__((export_name("TS_LDKSendError_ty_from_ptr"))) TS_LDKSendError_ty_from_ptr(uint64_t ptr) {
6629         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
6630         switch(obj->tag) {
6631                 case LDKSendError_Secp256k1: return 0;
6632                 case LDKSendError_TooBigPacket: return 1;
6633                 case LDKSendError_TooFewBlindedHops: return 2;
6634                 case LDKSendError_InvalidFirstHop: return 3;
6635                 case LDKSendError_BufferFull: return 4;
6636                 default: abort();
6637         }
6638 }
6639 uint32_t __attribute__((export_name("TS_LDKSendError_Secp256k1_get_secp256k1"))) TS_LDKSendError_Secp256k1_get_secp256k1(uint64_t ptr) {
6640         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
6641         assert(obj->tag == LDKSendError_Secp256k1);
6642                         uint32_t secp256k1_conv = LDKSecp256k1Error_to_js(obj->secp256k1);
6643         return secp256k1_conv;
6644 }
6645 static inline void CResult_NoneSendErrorZ_get_ok(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
6646 CHECK(owner->result_ok);
6647         return *owner->contents.result;
6648 }
6649 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_get_ok"))) TS_CResult_NoneSendErrorZ_get_ok(uint64_t owner) {
6650         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
6651         CResult_NoneSendErrorZ_get_ok(owner_conv);
6652 }
6653
6654 static inline struct LDKSendError CResult_NoneSendErrorZ_get_err(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
6655 CHECK(!owner->result_ok);
6656         return SendError_clone(&*owner->contents.err);
6657 }
6658 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_get_err"))) TS_CResult_NoneSendErrorZ_get_err(uint64_t owner) {
6659         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
6660         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
6661         *ret_copy = CResult_NoneSendErrorZ_get_err(owner_conv);
6662         uint64_t ret_ref = tag_ptr(ret_copy, true);
6663         return ret_ref;
6664 }
6665
6666 uint32_t __attribute__((export_name("TS_LDKGraphSyncError_ty_from_ptr"))) TS_LDKGraphSyncError_ty_from_ptr(uint64_t ptr) {
6667         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
6668         switch(obj->tag) {
6669                 case LDKGraphSyncError_DecodeError: return 0;
6670                 case LDKGraphSyncError_LightningError: return 1;
6671                 default: abort();
6672         }
6673 }
6674 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_DecodeError_get_decode_error"))) TS_LDKGraphSyncError_DecodeError_get_decode_error(uint64_t ptr) {
6675         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
6676         assert(obj->tag == LDKGraphSyncError_DecodeError);
6677                         LDKDecodeError decode_error_var = obj->decode_error;
6678                         uint64_t decode_error_ref = 0;
6679                         CHECK_INNER_FIELD_ACCESS_OR_NULL(decode_error_var);
6680                         decode_error_ref = tag_ptr(decode_error_var.inner, false);
6681         return decode_error_ref;
6682 }
6683 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_LightningError_get_lightning_error"))) TS_LDKGraphSyncError_LightningError_get_lightning_error(uint64_t ptr) {
6684         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
6685         assert(obj->tag == LDKGraphSyncError_LightningError);
6686                         LDKLightningError lightning_error_var = obj->lightning_error;
6687                         uint64_t lightning_error_ref = 0;
6688                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
6689                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
6690         return lightning_error_ref;
6691 }
6692 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
6693 CHECK(owner->result_ok);
6694         return *owner->contents.result;
6695 }
6696 int32_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_ok"))) TS_CResult_u32GraphSyncErrorZ_get_ok(uint64_t owner) {
6697         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
6698         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
6699         return ret_conv;
6700 }
6701
6702 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
6703 CHECK(!owner->result_ok);
6704         return GraphSyncError_clone(&*owner->contents.err);
6705 }
6706 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_err"))) TS_CResult_u32GraphSyncErrorZ_get_err(uint64_t owner) {
6707         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
6708         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
6709         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
6710         uint64_t ret_ref = tag_ptr(ret_copy, true);
6711         return ret_ref;
6712 }
6713
6714 static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
6715 CHECK(owner->result_ok);
6716         return *owner->contents.result;
6717 }
6718 void  __attribute__((export_name("TS_CResult_NoneErrorZ_get_ok"))) TS_CResult_NoneErrorZ_get_ok(uint64_t owner) {
6719         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
6720         CResult_NoneErrorZ_get_ok(owner_conv);
6721 }
6722
6723 static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
6724 CHECK(!owner->result_ok);
6725         return *owner->contents.err;
6726 }
6727 uint32_t  __attribute__((export_name("TS_CResult_NoneErrorZ_get_err"))) TS_CResult_NoneErrorZ_get_err(uint64_t owner) {
6728         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
6729         uint32_t ret_conv = LDKIOError_to_js(CResult_NoneErrorZ_get_err(owner_conv));
6730         return ret_conv;
6731 }
6732
6733 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
6734 CHECK(owner->result_ok);
6735         return NetAddress_clone(&*owner->contents.result);
6736 }
6737 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_ok"))) TS_CResult_NetAddressDecodeErrorZ_get_ok(uint64_t owner) {
6738         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
6739         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
6740         *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
6741         uint64_t ret_ref = tag_ptr(ret_copy, true);
6742         return ret_ref;
6743 }
6744
6745 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
6746         LDKDecodeError ret = *owner->contents.err;
6747         ret.is_owned = false;
6748         return ret;
6749 }
6750 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_err"))) TS_CResult_NetAddressDecodeErrorZ_get_err(uint64_t owner) {
6751         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
6752         LDKDecodeError ret_var = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
6753         uint64_t ret_ref = 0;
6754         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6755         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6756         return ret_ref;
6757 }
6758
6759 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
6760         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
6761         for (size_t i = 0; i < ret.datalen; i++) {
6762                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
6763         }
6764         return ret;
6765 }
6766 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
6767         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
6768         for (size_t i = 0; i < ret.datalen; i++) {
6769                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
6770         }
6771         return ret;
6772 }
6773 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
6774         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
6775         for (size_t i = 0; i < ret.datalen; i++) {
6776                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
6777         }
6778         return ret;
6779 }
6780 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
6781         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
6782         for (size_t i = 0; i < ret.datalen; i++) {
6783                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
6784         }
6785         return ret;
6786 }
6787 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
6788         LDKAcceptChannel ret = *owner->contents.result;
6789         ret.is_owned = false;
6790         return ret;
6791 }
6792 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint64_t owner) {
6793         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
6794         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_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 LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
6802         LDKDecodeError ret = *owner->contents.err;
6803         ret.is_owned = false;
6804         return ret;
6805 }
6806 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_err"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint64_t owner) {
6807         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
6808         LDKDecodeError ret_var = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
6809         uint64_t ret_ref = 0;
6810         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6811         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6812         return ret_ref;
6813 }
6814
6815 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
6816         LDKAnnouncementSignatures ret = *owner->contents.result;
6817         ret.is_owned = false;
6818         return ret;
6819 }
6820 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
6821         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
6822         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
6823         uint64_t ret_ref = 0;
6824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6826         return ret_ref;
6827 }
6828
6829 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
6830         LDKDecodeError ret = *owner->contents.err;
6831         ret.is_owned = false;
6832         return ret;
6833 }
6834 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint64_t owner) {
6835         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
6836         LDKDecodeError ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
6837         uint64_t ret_ref = 0;
6838         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6839         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6840         return ret_ref;
6841 }
6842
6843 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
6844         LDKChannelReestablish ret = *owner->contents.result;
6845         ret.is_owned = false;
6846         return ret;
6847 }
6848 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint64_t owner) {
6849         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
6850         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
6851         uint64_t ret_ref = 0;
6852         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6853         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6854         return ret_ref;
6855 }
6856
6857 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
6858         LDKDecodeError ret = *owner->contents.err;
6859         ret.is_owned = false;
6860         return ret;
6861 }
6862 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint64_t owner) {
6863         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
6864         LDKDecodeError ret_var = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
6865         uint64_t ret_ref = 0;
6866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6868         return ret_ref;
6869 }
6870
6871 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
6872         LDKClosingSigned ret = *owner->contents.result;
6873         ret.is_owned = false;
6874         return ret;
6875 }
6876 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint64_t owner) {
6877         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
6878         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
6879         uint64_t ret_ref = 0;
6880         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6881         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6882         return ret_ref;
6883 }
6884
6885 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
6886         LDKDecodeError ret = *owner->contents.err;
6887         ret.is_owned = false;
6888         return ret;
6889 }
6890 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint64_t owner) {
6891         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
6892         LDKDecodeError ret_var = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
6893         uint64_t ret_ref = 0;
6894         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6895         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6896         return ret_ref;
6897 }
6898
6899 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
6900         LDKClosingSignedFeeRange ret = *owner->contents.result;
6901         ret.is_owned = false;
6902         return ret;
6903 }
6904 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint64_t owner) {
6905         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
6906         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
6907         uint64_t ret_ref = 0;
6908         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6909         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6910         return ret_ref;
6911 }
6912
6913 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
6914         LDKDecodeError ret = *owner->contents.err;
6915         ret.is_owned = false;
6916         return ret;
6917 }
6918 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint64_t owner) {
6919         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
6920         LDKDecodeError ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
6921         uint64_t ret_ref = 0;
6922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6924         return ret_ref;
6925 }
6926
6927 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
6928         LDKCommitmentSigned ret = *owner->contents.result;
6929         ret.is_owned = false;
6930         return ret;
6931 }
6932 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_ok(uint64_t owner) {
6933         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
6934         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
6935         uint64_t ret_ref = 0;
6936         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6937         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6938         return ret_ref;
6939 }
6940
6941 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
6942         LDKDecodeError ret = *owner->contents.err;
6943         ret.is_owned = false;
6944         return ret;
6945 }
6946 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_err(uint64_t owner) {
6947         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
6948         LDKDecodeError ret_var = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
6949         uint64_t ret_ref = 0;
6950         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6951         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6952         return ret_ref;
6953 }
6954
6955 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
6956         LDKFundingCreated ret = *owner->contents.result;
6957         ret.is_owned = false;
6958         return ret;
6959 }
6960 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_get_ok(uint64_t owner) {
6961         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
6962         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
6963         uint64_t ret_ref = 0;
6964         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6965         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6966         return ret_ref;
6967 }
6968
6969 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
6970         LDKDecodeError ret = *owner->contents.err;
6971         ret.is_owned = false;
6972         return ret;
6973 }
6974 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_err"))) TS_CResult_FundingCreatedDecodeErrorZ_get_err(uint64_t owner) {
6975         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
6976         LDKDecodeError ret_var = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
6977         uint64_t ret_ref = 0;
6978         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6979         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6980         return ret_ref;
6981 }
6982
6983 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
6984         LDKFundingSigned ret = *owner->contents.result;
6985         ret.is_owned = false;
6986         return ret;
6987 }
6988 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_ok"))) TS_CResult_FundingSignedDecodeErrorZ_get_ok(uint64_t owner) {
6989         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
6990         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
6991         uint64_t ret_ref = 0;
6992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6994         return ret_ref;
6995 }
6996
6997 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
6998         LDKDecodeError ret = *owner->contents.err;
6999         ret.is_owned = false;
7000         return ret;
7001 }
7002 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_err"))) TS_CResult_FundingSignedDecodeErrorZ_get_err(uint64_t owner) {
7003         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
7004         LDKDecodeError ret_var = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
7005         uint64_t ret_ref = 0;
7006         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7007         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7008         return ret_ref;
7009 }
7010
7011 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7012         LDKChannelReady ret = *owner->contents.result;
7013         ret.is_owned = false;
7014         return ret;
7015 }
7016 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_get_ok(uint64_t owner) {
7017         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
7018         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
7019         uint64_t ret_ref = 0;
7020         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7021         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7022         return ret_ref;
7023 }
7024
7025 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
7026         LDKDecodeError ret = *owner->contents.err;
7027         ret.is_owned = false;
7028         return ret;
7029 }
7030 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_err"))) TS_CResult_ChannelReadyDecodeErrorZ_get_err(uint64_t owner) {
7031         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
7032         LDKDecodeError ret_var = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
7033         uint64_t ret_ref = 0;
7034         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7035         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7036         return ret_ref;
7037 }
7038
7039 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7040         LDKInit ret = *owner->contents.result;
7041         ret.is_owned = false;
7042         return ret;
7043 }
7044 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_ok"))) TS_CResult_InitDecodeErrorZ_get_ok(uint64_t owner) {
7045         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
7046         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
7047         uint64_t ret_ref = 0;
7048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7050         return ret_ref;
7051 }
7052
7053 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
7054         LDKDecodeError ret = *owner->contents.err;
7055         ret.is_owned = false;
7056         return ret;
7057 }
7058 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_err"))) TS_CResult_InitDecodeErrorZ_get_err(uint64_t owner) {
7059         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
7060         LDKDecodeError ret_var = CResult_InitDecodeErrorZ_get_err(owner_conv);
7061         uint64_t ret_ref = 0;
7062         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7063         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7064         return ret_ref;
7065 }
7066
7067 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
7068         LDKOpenChannel ret = *owner->contents.result;
7069         ret.is_owned = false;
7070         return ret;
7071 }
7072 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_ok"))) TS_CResult_OpenChannelDecodeErrorZ_get_ok(uint64_t owner) {
7073         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
7074         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
7075         uint64_t ret_ref = 0;
7076         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7077         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7078         return ret_ref;
7079 }
7080
7081 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
7082         LDKDecodeError ret = *owner->contents.err;
7083         ret.is_owned = false;
7084         return ret;
7085 }
7086 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_err"))) TS_CResult_OpenChannelDecodeErrorZ_get_err(uint64_t owner) {
7087         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
7088         LDKDecodeError ret_var = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
7089         uint64_t ret_ref = 0;
7090         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7091         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7092         return ret_ref;
7093 }
7094
7095 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
7096         LDKRevokeAndACK ret = *owner->contents.result;
7097         ret.is_owned = false;
7098         return ret;
7099 }
7100 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_ok(uint64_t owner) {
7101         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
7102         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
7103         uint64_t ret_ref = 0;
7104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7106         return ret_ref;
7107 }
7108
7109 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
7110         LDKDecodeError ret = *owner->contents.err;
7111         ret.is_owned = false;
7112         return ret;
7113 }
7114 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_err(uint64_t owner) {
7115         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
7116         LDKDecodeError ret_var = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
7117         uint64_t ret_ref = 0;
7118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7120         return ret_ref;
7121 }
7122
7123 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
7124         LDKShutdown ret = *owner->contents.result;
7125         ret.is_owned = false;
7126         return ret;
7127 }
7128 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_ok"))) TS_CResult_ShutdownDecodeErrorZ_get_ok(uint64_t owner) {
7129         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
7130         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
7131         uint64_t ret_ref = 0;
7132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7134         return ret_ref;
7135 }
7136
7137 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
7138         LDKDecodeError ret = *owner->contents.err;
7139         ret.is_owned = false;
7140         return ret;
7141 }
7142 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_err"))) TS_CResult_ShutdownDecodeErrorZ_get_err(uint64_t owner) {
7143         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
7144         LDKDecodeError ret_var = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
7145         uint64_t ret_ref = 0;
7146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7148         return ret_ref;
7149 }
7150
7151 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
7152         LDKUpdateFailHTLC ret = *owner->contents.result;
7153         ret.is_owned = false;
7154         return ret;
7155 }
7156 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint64_t owner) {
7157         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
7158         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
7159         uint64_t ret_ref = 0;
7160         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7161         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7162         return ret_ref;
7163 }
7164
7165 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
7166         LDKDecodeError ret = *owner->contents.err;
7167         ret.is_owned = false;
7168         return ret;
7169 }
7170 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err(uint64_t owner) {
7171         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
7172         LDKDecodeError ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
7173         uint64_t ret_ref = 0;
7174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7176         return ret_ref;
7177 }
7178
7179 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
7180         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
7181         ret.is_owned = false;
7182         return ret;
7183 }
7184 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint64_t owner) {
7185         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
7186         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
7187         uint64_t ret_ref = 0;
7188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7190         return ret_ref;
7191 }
7192
7193 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
7194         LDKDecodeError ret = *owner->contents.err;
7195         ret.is_owned = false;
7196         return ret;
7197 }
7198 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint64_t owner) {
7199         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
7200         LDKDecodeError ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
7201         uint64_t ret_ref = 0;
7202         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7203         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7204         return ret_ref;
7205 }
7206
7207 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
7208         LDKUpdateFee ret = *owner->contents.result;
7209         ret.is_owned = false;
7210         return ret;
7211 }
7212 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_get_ok(uint64_t owner) {
7213         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
7214         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
7215         uint64_t ret_ref = 0;
7216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7218         return ret_ref;
7219 }
7220
7221 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
7222         LDKDecodeError ret = *owner->contents.err;
7223         ret.is_owned = false;
7224         return ret;
7225 }
7226 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_err"))) TS_CResult_UpdateFeeDecodeErrorZ_get_err(uint64_t owner) {
7227         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
7228         LDKDecodeError ret_var = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
7229         uint64_t ret_ref = 0;
7230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7232         return ret_ref;
7233 }
7234
7235 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
7236         LDKUpdateFulfillHTLC ret = *owner->contents.result;
7237         ret.is_owned = false;
7238         return ret;
7239 }
7240 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint64_t owner) {
7241         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
7242         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
7243         uint64_t ret_ref = 0;
7244         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7245         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7246         return ret_ref;
7247 }
7248
7249 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
7250         LDKDecodeError ret = *owner->contents.err;
7251         ret.is_owned = false;
7252         return ret;
7253 }
7254 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint64_t owner) {
7255         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
7256         LDKDecodeError ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
7257         uint64_t ret_ref = 0;
7258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7260         return ret_ref;
7261 }
7262
7263 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
7264         LDKUpdateAddHTLC ret = *owner->contents.result;
7265         ret.is_owned = false;
7266         return ret;
7267 }
7268 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint64_t owner) {
7269         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
7270         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
7271         uint64_t ret_ref = 0;
7272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7274         return ret_ref;
7275 }
7276
7277 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
7278         LDKDecodeError ret = *owner->contents.err;
7279         ret.is_owned = false;
7280         return ret;
7281 }
7282 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err(uint64_t owner) {
7283         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
7284         LDKDecodeError ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
7285         uint64_t ret_ref = 0;
7286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7288         return ret_ref;
7289 }
7290
7291 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
7292         LDKOnionMessage ret = *owner->contents.result;
7293         ret.is_owned = false;
7294         return ret;
7295 }
7296 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_ok"))) TS_CResult_OnionMessageDecodeErrorZ_get_ok(uint64_t owner) {
7297         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
7298         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
7299         uint64_t ret_ref = 0;
7300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7302         return ret_ref;
7303 }
7304
7305 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
7306         LDKDecodeError ret = *owner->contents.err;
7307         ret.is_owned = false;
7308         return ret;
7309 }
7310 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_err"))) TS_CResult_OnionMessageDecodeErrorZ_get_err(uint64_t owner) {
7311         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
7312         LDKDecodeError ret_var = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
7313         uint64_t ret_ref = 0;
7314         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7315         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7316         return ret_ref;
7317 }
7318
7319 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
7320         LDKPing ret = *owner->contents.result;
7321         ret.is_owned = false;
7322         return ret;
7323 }
7324 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_ok"))) TS_CResult_PingDecodeErrorZ_get_ok(uint64_t owner) {
7325         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
7326         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
7327         uint64_t ret_ref = 0;
7328         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7329         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7330         return ret_ref;
7331 }
7332
7333 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
7334         LDKDecodeError ret = *owner->contents.err;
7335         ret.is_owned = false;
7336         return ret;
7337 }
7338 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_err"))) TS_CResult_PingDecodeErrorZ_get_err(uint64_t owner) {
7339         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
7340         LDKDecodeError ret_var = CResult_PingDecodeErrorZ_get_err(owner_conv);
7341         uint64_t ret_ref = 0;
7342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7344         return ret_ref;
7345 }
7346
7347 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
7348         LDKPong ret = *owner->contents.result;
7349         ret.is_owned = false;
7350         return ret;
7351 }
7352 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_ok"))) TS_CResult_PongDecodeErrorZ_get_ok(uint64_t owner) {
7353         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
7354         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
7355         uint64_t ret_ref = 0;
7356         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7357         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7358         return ret_ref;
7359 }
7360
7361 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
7362         LDKDecodeError ret = *owner->contents.err;
7363         ret.is_owned = false;
7364         return ret;
7365 }
7366 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_err"))) TS_CResult_PongDecodeErrorZ_get_err(uint64_t owner) {
7367         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
7368         LDKDecodeError ret_var = CResult_PongDecodeErrorZ_get_err(owner_conv);
7369         uint64_t ret_ref = 0;
7370         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7371         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7372         return ret_ref;
7373 }
7374
7375 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7376         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
7377         ret.is_owned = false;
7378         return ret;
7379 }
7380 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
7381         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
7382         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
7383         uint64_t ret_ref = 0;
7384         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7385         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7386         return ret_ref;
7387 }
7388
7389 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7390         LDKDecodeError ret = *owner->contents.err;
7391         ret.is_owned = false;
7392         return ret;
7393 }
7394 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
7395         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
7396         LDKDecodeError ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
7397         uint64_t ret_ref = 0;
7398         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7399         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7400         return ret_ref;
7401 }
7402
7403 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7404         LDKChannelAnnouncement ret = *owner->contents.result;
7405         ret.is_owned = false;
7406         return ret;
7407 }
7408 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
7409         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
7410         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
7411         uint64_t ret_ref = 0;
7412         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7413         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7414         return ret_ref;
7415 }
7416
7417 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7418         LDKDecodeError ret = *owner->contents.err;
7419         ret.is_owned = false;
7420         return ret;
7421 }
7422 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
7423         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
7424         LDKDecodeError ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
7425         uint64_t ret_ref = 0;
7426         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7427         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7428         return ret_ref;
7429 }
7430
7431 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7432         LDKUnsignedChannelUpdate ret = *owner->contents.result;
7433         ret.is_owned = false;
7434         return ret;
7435 }
7436 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
7437         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
7438         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
7439         uint64_t ret_ref = 0;
7440         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7441         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7442         return ret_ref;
7443 }
7444
7445 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7446         LDKDecodeError ret = *owner->contents.err;
7447         ret.is_owned = false;
7448         return ret;
7449 }
7450 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
7451         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
7452         LDKDecodeError ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
7453         uint64_t ret_ref = 0;
7454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7456         return ret_ref;
7457 }
7458
7459 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7460         LDKChannelUpdate ret = *owner->contents.result;
7461         ret.is_owned = false;
7462         return ret;
7463 }
7464 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
7465         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
7466         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
7467         uint64_t ret_ref = 0;
7468         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7469         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7470         return ret_ref;
7471 }
7472
7473 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
7474         LDKDecodeError ret = *owner->contents.err;
7475         ret.is_owned = false;
7476         return ret;
7477 }
7478 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
7479         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
7480         LDKDecodeError ret_var = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
7481         uint64_t ret_ref = 0;
7482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7484         return ret_ref;
7485 }
7486
7487 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
7488         LDKErrorMessage ret = *owner->contents.result;
7489         ret.is_owned = false;
7490         return ret;
7491 }
7492 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_get_ok(uint64_t owner) {
7493         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
7494         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
7495         uint64_t ret_ref = 0;
7496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7498         return ret_ref;
7499 }
7500
7501 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
7502         LDKDecodeError ret = *owner->contents.err;
7503         ret.is_owned = false;
7504         return ret;
7505 }
7506 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_err"))) TS_CResult_ErrorMessageDecodeErrorZ_get_err(uint64_t owner) {
7507         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
7508         LDKDecodeError ret_var = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
7509         uint64_t ret_ref = 0;
7510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7512         return ret_ref;
7513 }
7514
7515 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
7516         LDKWarningMessage ret = *owner->contents.result;
7517         ret.is_owned = false;
7518         return ret;
7519 }
7520 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_ok"))) TS_CResult_WarningMessageDecodeErrorZ_get_ok(uint64_t owner) {
7521         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
7522         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
7523         uint64_t ret_ref = 0;
7524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7526         return ret_ref;
7527 }
7528
7529 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
7530         LDKDecodeError ret = *owner->contents.err;
7531         ret.is_owned = false;
7532         return ret;
7533 }
7534 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_err"))) TS_CResult_WarningMessageDecodeErrorZ_get_err(uint64_t owner) {
7535         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
7536         LDKDecodeError ret_var = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
7537         uint64_t ret_ref = 0;
7538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7540         return ret_ref;
7541 }
7542
7543 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7544         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
7545         ret.is_owned = false;
7546         return ret;
7547 }
7548 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
7549         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
7550         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
7551         uint64_t ret_ref = 0;
7552         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7553         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7554         return ret_ref;
7555 }
7556
7557 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7558         LDKDecodeError ret = *owner->contents.err;
7559         ret.is_owned = false;
7560         return ret;
7561 }
7562 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
7563         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
7564         LDKDecodeError ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
7565         uint64_t ret_ref = 0;
7566         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7567         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7568         return ret_ref;
7569 }
7570
7571 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7572         LDKNodeAnnouncement ret = *owner->contents.result;
7573         ret.is_owned = false;
7574         return ret;
7575 }
7576 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
7577         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
7578         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
7579         uint64_t ret_ref = 0;
7580         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7581         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7582         return ret_ref;
7583 }
7584
7585 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
7586         LDKDecodeError ret = *owner->contents.err;
7587         ret.is_owned = false;
7588         return ret;
7589 }
7590 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
7591         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
7592         LDKDecodeError ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
7593         uint64_t ret_ref = 0;
7594         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7595         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7596         return ret_ref;
7597 }
7598
7599 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
7600         LDKQueryShortChannelIds ret = *owner->contents.result;
7601         ret.is_owned = false;
7602         return ret;
7603 }
7604 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint64_t owner) {
7605         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
7606         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
7607         uint64_t ret_ref = 0;
7608         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7609         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7610         return ret_ref;
7611 }
7612
7613 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
7614         LDKDecodeError ret = *owner->contents.err;
7615         ret.is_owned = false;
7616         return ret;
7617 }
7618 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint64_t owner) {
7619         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
7620         LDKDecodeError ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
7621         uint64_t ret_ref = 0;
7622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7624         return ret_ref;
7625 }
7626
7627 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
7628         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
7629         ret.is_owned = false;
7630         return ret;
7631 }
7632 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint64_t owner) {
7633         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
7634         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
7635         uint64_t ret_ref = 0;
7636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7638         return ret_ref;
7639 }
7640
7641 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
7642         LDKDecodeError ret = *owner->contents.err;
7643         ret.is_owned = false;
7644         return ret;
7645 }
7646 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint64_t owner) {
7647         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
7648         LDKDecodeError ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
7649         uint64_t ret_ref = 0;
7650         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7651         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7652         return ret_ref;
7653 }
7654
7655 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7656         LDKQueryChannelRange ret = *owner->contents.result;
7657         ret.is_owned = false;
7658         return ret;
7659 }
7660 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
7661         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
7662         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
7663         uint64_t ret_ref = 0;
7664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7666         return ret_ref;
7667 }
7668
7669 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7670         LDKDecodeError ret = *owner->contents.err;
7671         ret.is_owned = false;
7672         return ret;
7673 }
7674 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
7675         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
7676         LDKDecodeError ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
7677         uint64_t ret_ref = 0;
7678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7680         return ret_ref;
7681 }
7682
7683 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7684         LDKReplyChannelRange ret = *owner->contents.result;
7685         ret.is_owned = false;
7686         return ret;
7687 }
7688 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
7689         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
7690         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
7691         uint64_t ret_ref = 0;
7692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7694         return ret_ref;
7695 }
7696
7697 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
7698         LDKDecodeError ret = *owner->contents.err;
7699         ret.is_owned = false;
7700         return ret;
7701 }
7702 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
7703         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
7704         LDKDecodeError ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
7705         uint64_t ret_ref = 0;
7706         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7707         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7708         return ret_ref;
7709 }
7710
7711 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
7712         LDKGossipTimestampFilter ret = *owner->contents.result;
7713         ret.is_owned = false;
7714         return ret;
7715 }
7716 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint64_t owner) {
7717         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
7718         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
7719         uint64_t ret_ref = 0;
7720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7722         return ret_ref;
7723 }
7724
7725 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
7726         LDKDecodeError ret = *owner->contents.err;
7727         ret.is_owned = false;
7728         return ret;
7729 }
7730 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err(uint64_t owner) {
7731         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
7732         LDKDecodeError ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
7733         uint64_t ret_ref = 0;
7734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7736         return ret_ref;
7737 }
7738
7739 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_ty_from_ptr"))) TS_LDKSignOrCreationError_ty_from_ptr(uint64_t ptr) {
7740         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
7741         switch(obj->tag) {
7742                 case LDKSignOrCreationError_SignError: return 0;
7743                 case LDKSignOrCreationError_CreationError: return 1;
7744                 default: abort();
7745         }
7746 }
7747 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_CreationError_get_creation_error"))) TS_LDKSignOrCreationError_CreationError_get_creation_error(uint64_t ptr) {
7748         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
7749         assert(obj->tag == LDKSignOrCreationError_CreationError);
7750                         uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
7751         return creation_error_conv;
7752 }
7753 static inline struct LDKInvoice CResult_InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
7754         LDKInvoice ret = *owner->contents.result;
7755         ret.is_owned = false;
7756         return ret;
7757 }
7758 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_ok(uint64_t owner) {
7759         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
7760         LDKInvoice ret_var = CResult_InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
7761         uint64_t ret_ref = 0;
7762         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7763         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7764         return ret_ref;
7765 }
7766
7767 static inline struct LDKSignOrCreationError CResult_InvoiceSignOrCreationErrorZ_get_err(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
7768 CHECK(!owner->result_ok);
7769         return SignOrCreationError_clone(&*owner->contents.err);
7770 }
7771 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_get_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_get_err(uint64_t owner) {
7772         LDKCResult_InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
7773         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
7774         *ret_copy = CResult_InvoiceSignOrCreationErrorZ_get_err(owner_conv);
7775         uint64_t ret_ref = tag_ptr(ret_copy, true);
7776         return ret_ref;
7777 }
7778
7779 typedef struct LDKFilter_JCalls {
7780         atomic_size_t refcnt;
7781         uint32_t instance_ptr;
7782 } LDKFilter_JCalls;
7783 static void LDKFilter_JCalls_free(void* this_arg) {
7784         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7785         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7786                 FREE(j_calls);
7787         }
7788 }
7789 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
7790         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7791         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
7792         memcpy(txid_arr->elems, *txid, 32);
7793         LDKu8slice script_pubkey_var = script_pubkey;
7794         int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__);
7795         memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
7796         js_invoke_function_uuuuuu(j_calls->instance_ptr, 33, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr, 0, 0, 0, 0);
7797 }
7798 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
7799         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
7800         LDKWatchedOutput output_var = output;
7801         uint64_t output_ref = 0;
7802         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
7803         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
7804         js_invoke_function_buuuuu(j_calls->instance_ptr, 34, output_ref, 0, 0, 0, 0, 0);
7805 }
7806 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
7807         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
7808         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7809 }
7810 static inline LDKFilter LDKFilter_init (JSValue o) {
7811         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
7812         atomic_init(&calls->refcnt, 1);
7813         calls->instance_ptr = o;
7814
7815         LDKFilter ret = {
7816                 .this_arg = (void*) calls,
7817                 .register_tx = register_tx_LDKFilter_jcall,
7818                 .register_output = register_output_LDKFilter_jcall,
7819                 .free = LDKFilter_JCalls_free,
7820         };
7821         return ret;
7822 }
7823 uint64_t  __attribute__((export_name("TS_LDKFilter_new"))) TS_LDKFilter_new(JSValue o) {
7824         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
7825         *res_ptr = LDKFilter_init(o);
7826         return tag_ptr(res_ptr, true);
7827 }
7828 void  __attribute__((export_name("TS_Filter_register_tx"))) TS_Filter_register_tx(uint64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
7829         void* this_arg_ptr = untag_ptr(this_arg);
7830         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7831         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
7832         unsigned char txid_arr[32];
7833         CHECK(txid->arr_len == 32);
7834         memcpy(txid_arr, txid->elems, 32); FREE(txid);
7835         unsigned char (*txid_ref)[32] = &txid_arr;
7836         LDKu8slice script_pubkey_ref;
7837         script_pubkey_ref.datalen = script_pubkey->arr_len;
7838         script_pubkey_ref.data = script_pubkey->elems;
7839         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
7840         FREE(script_pubkey);
7841 }
7842
7843 void  __attribute__((export_name("TS_Filter_register_output"))) TS_Filter_register_output(uint64_t this_arg, uint64_t output) {
7844         void* this_arg_ptr = untag_ptr(this_arg);
7845         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7846         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
7847         LDKWatchedOutput output_conv;
7848         output_conv.inner = untag_ptr(output);
7849         output_conv.is_owned = ptr_is_owned(output);
7850         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
7851         output_conv = WatchedOutput_clone(&output_conv);
7852         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
7853 }
7854
7855 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_ty_from_ptr"))) TS_LDKCOption_FilterZ_ty_from_ptr(uint64_t ptr) {
7856         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
7857         switch(obj->tag) {
7858                 case LDKCOption_FilterZ_Some: return 0;
7859                 case LDKCOption_FilterZ_None: return 1;
7860                 default: abort();
7861         }
7862 }
7863 uint64_t __attribute__((export_name("TS_LDKCOption_FilterZ_Some_get_some"))) TS_LDKCOption_FilterZ_Some_get_some(uint64_t ptr) {
7864         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
7865         assert(obj->tag == LDKCOption_FilterZ_Some);
7866                         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
7867                         *some_ret = obj->some;
7868                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
7869                         if ((*some_ret).free == LDKFilter_JCalls_free) {
7870                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7871                                 LDKFilter_JCalls_cloned(&(*some_ret));
7872                         }
7873         return tag_ptr(some_ret, true);
7874 }
7875 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
7876         LDKLockedChannelMonitor ret = *owner->contents.result;
7877         ret.is_owned = false;
7878         return ret;
7879 }
7880 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_ok"))) TS_CResult_LockedChannelMonitorNoneZ_get_ok(uint64_t owner) {
7881         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
7882         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
7883         uint64_t ret_ref = 0;
7884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7886         return ret_ref;
7887 }
7888
7889 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
7890 CHECK(!owner->result_ok);
7891         return *owner->contents.err;
7892 }
7893 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_err"))) TS_CResult_LockedChannelMonitorNoneZ_get_err(uint64_t owner) {
7894         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
7895         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
7896 }
7897
7898 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
7899         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
7900         for (size_t i = 0; i < ret.datalen; i++) {
7901                 ret.data[i] = OutPoint_clone(&orig->data[i]);
7902         }
7903         return ret;
7904 }
7905 typedef struct LDKMessageSendEventsProvider_JCalls {
7906         atomic_size_t refcnt;
7907         uint32_t instance_ptr;
7908 } LDKMessageSendEventsProvider_JCalls;
7909 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
7910         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
7911         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7912                 FREE(j_calls);
7913         }
7914 }
7915 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
7916         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
7917         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 35, 0, 0, 0, 0, 0, 0);
7918         LDKCVec_MessageSendEventZ ret_constr;
7919         ret_constr.datalen = ret->arr_len;
7920         if (ret_constr.datalen > 0)
7921                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
7922         else
7923                 ret_constr.data = NULL;
7924         uint64_t* ret_vals = ret->elems;
7925         for (size_t s = 0; s < ret_constr.datalen; s++) {
7926                 uint64_t ret_conv_18 = ret_vals[s];
7927                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
7928                 CHECK_ACCESS(ret_conv_18_ptr);
7929                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
7930                 FREE(untag_ptr(ret_conv_18));
7931                 ret_constr.data[s] = ret_conv_18_conv;
7932         }
7933         FREE(ret);
7934         return ret_constr;
7935 }
7936 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
7937         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
7938         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7939 }
7940 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JSValue o) {
7941         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
7942         atomic_init(&calls->refcnt, 1);
7943         calls->instance_ptr = o;
7944
7945         LDKMessageSendEventsProvider ret = {
7946                 .this_arg = (void*) calls,
7947                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
7948                 .free = LDKMessageSendEventsProvider_JCalls_free,
7949         };
7950         return ret;
7951 }
7952 uint64_t  __attribute__((export_name("TS_LDKMessageSendEventsProvider_new"))) TS_LDKMessageSendEventsProvider_new(JSValue o) {
7953         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
7954         *res_ptr = LDKMessageSendEventsProvider_init(o);
7955         return tag_ptr(res_ptr, true);
7956 }
7957 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) {
7958         void* this_arg_ptr = untag_ptr(this_arg);
7959         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7960         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
7961         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
7962         uint64_tArray ret_arr = NULL;
7963         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
7964         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
7965         for (size_t s = 0; s < ret_var.datalen; s++) {
7966                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
7967                 *ret_conv_18_copy = ret_var.data[s];
7968                 uint64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
7969                 ret_arr_ptr[s] = ret_conv_18_ref;
7970         }
7971         
7972         FREE(ret_var.data);
7973         return ret_arr;
7974 }
7975
7976 typedef struct LDKOnionMessageProvider_JCalls {
7977         atomic_size_t refcnt;
7978         uint32_t instance_ptr;
7979 } LDKOnionMessageProvider_JCalls;
7980 static void LDKOnionMessageProvider_JCalls_free(void* this_arg) {
7981         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
7982         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7983                 FREE(j_calls);
7984         }
7985 }
7986 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageProvider_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
7987         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
7988         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
7989         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
7990         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 36, (uint32_t)peer_node_id_arr, 0, 0, 0, 0, 0);
7991         LDKOnionMessage ret_conv;
7992         ret_conv.inner = untag_ptr(ret);
7993         ret_conv.is_owned = ptr_is_owned(ret);
7994         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
7995         return ret_conv;
7996 }
7997 static void LDKOnionMessageProvider_JCalls_cloned(LDKOnionMessageProvider* new_obj) {
7998         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) new_obj->this_arg;
7999         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8000 }
8001 static inline LDKOnionMessageProvider LDKOnionMessageProvider_init (JSValue o) {
8002         LDKOnionMessageProvider_JCalls *calls = MALLOC(sizeof(LDKOnionMessageProvider_JCalls), "LDKOnionMessageProvider_JCalls");
8003         atomic_init(&calls->refcnt, 1);
8004         calls->instance_ptr = o;
8005
8006         LDKOnionMessageProvider ret = {
8007                 .this_arg = (void*) calls,
8008                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageProvider_jcall,
8009                 .free = LDKOnionMessageProvider_JCalls_free,
8010         };
8011         return ret;
8012 }
8013 uint64_t  __attribute__((export_name("TS_LDKOnionMessageProvider_new"))) TS_LDKOnionMessageProvider_new(JSValue o) {
8014         LDKOnionMessageProvider *res_ptr = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
8015         *res_ptr = LDKOnionMessageProvider_init(o);
8016         return tag_ptr(res_ptr, true);
8017 }
8018 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) {
8019         void* this_arg_ptr = untag_ptr(this_arg);
8020         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8021         LDKOnionMessageProvider* this_arg_conv = (LDKOnionMessageProvider*)this_arg_ptr;
8022         LDKPublicKey peer_node_id_ref;
8023         CHECK(peer_node_id->arr_len == 33);
8024         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
8025         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
8026         uint64_t ret_ref = 0;
8027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8029         return ret_ref;
8030 }
8031
8032 typedef struct LDKEventHandler_JCalls {
8033         atomic_size_t refcnt;
8034         uint32_t instance_ptr;
8035 } LDKEventHandler_JCalls;
8036 static void LDKEventHandler_JCalls_free(void* this_arg) {
8037         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
8038         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8039                 FREE(j_calls);
8040         }
8041 }
8042 void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
8043         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
8044         LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
8045         *ret_event = Event_clone(event);
8046         uint64_t ref_event = tag_ptr(ret_event, true);
8047         js_invoke_function_buuuuu(j_calls->instance_ptr, 37, ref_event, 0, 0, 0, 0, 0);
8048 }
8049 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
8050         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
8051         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8052 }
8053 static inline LDKEventHandler LDKEventHandler_init (JSValue o) {
8054         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
8055         atomic_init(&calls->refcnt, 1);
8056         calls->instance_ptr = o;
8057
8058         LDKEventHandler ret = {
8059                 .this_arg = (void*) calls,
8060                 .handle_event = handle_event_LDKEventHandler_jcall,
8061                 .free = LDKEventHandler_JCalls_free,
8062         };
8063         return ret;
8064 }
8065 uint64_t  __attribute__((export_name("TS_LDKEventHandler_new"))) TS_LDKEventHandler_new(JSValue o) {
8066         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
8067         *res_ptr = LDKEventHandler_init(o);
8068         return tag_ptr(res_ptr, true);
8069 }
8070 void  __attribute__((export_name("TS_EventHandler_handle_event"))) TS_EventHandler_handle_event(uint64_t this_arg, uint64_t event) {
8071         void* this_arg_ptr = untag_ptr(this_arg);
8072         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8073         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
8074         LDKEvent* event_conv = (LDKEvent*)untag_ptr(event);
8075         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
8076 }
8077
8078 typedef struct LDKEventsProvider_JCalls {
8079         atomic_size_t refcnt;
8080         uint32_t instance_ptr;
8081 } LDKEventsProvider_JCalls;
8082 static void LDKEventsProvider_JCalls_free(void* this_arg) {
8083         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
8084         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8085                 FREE(j_calls);
8086         }
8087 }
8088 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
8089         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
8090         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
8091         *handler_ret = handler;
8092         js_invoke_function_buuuuu(j_calls->instance_ptr, 38, tag_ptr(handler_ret, true), 0, 0, 0, 0, 0);
8093 }
8094 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
8095         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
8096         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8097 }
8098 static inline LDKEventsProvider LDKEventsProvider_init (JSValue o) {
8099         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
8100         atomic_init(&calls->refcnt, 1);
8101         calls->instance_ptr = o;
8102
8103         LDKEventsProvider ret = {
8104                 .this_arg = (void*) calls,
8105                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
8106                 .free = LDKEventsProvider_JCalls_free,
8107         };
8108         return ret;
8109 }
8110 uint64_t  __attribute__((export_name("TS_LDKEventsProvider_new"))) TS_LDKEventsProvider_new(JSValue o) {
8111         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
8112         *res_ptr = LDKEventsProvider_init(o);
8113         return tag_ptr(res_ptr, true);
8114 }
8115 void  __attribute__((export_name("TS_EventsProvider_process_pending_events"))) TS_EventsProvider_process_pending_events(uint64_t this_arg, uint64_t handler) {
8116         void* this_arg_ptr = untag_ptr(this_arg);
8117         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8118         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
8119         void* handler_ptr = untag_ptr(handler);
8120         CHECK_ACCESS(handler_ptr);
8121         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
8122         if (handler_conv.free == LDKEventHandler_JCalls_free) {
8123                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8124                 LDKEventHandler_JCalls_cloned(&handler_conv);
8125         }
8126         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
8127 }
8128
8129 typedef struct LDKScore_JCalls {
8130         atomic_size_t refcnt;
8131         uint32_t instance_ptr;
8132 } LDKScore_JCalls;
8133 static void LDKScore_JCalls_free(void* this_arg) {
8134         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8135         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8136                 FREE(j_calls);
8137         }
8138 }
8139 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target, LDKChannelUsage usage) {
8140         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8141         int64_t short_channel_id_conv = short_channel_id;
8142         LDKNodeId source_var = *source;
8143         uint64_t source_ref = 0;
8144         source_var = NodeId_clone(&source_var);
8145         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
8146         source_ref = tag_ptr(source_var.inner, source_var.is_owned);
8147         LDKNodeId target_var = *target;
8148         uint64_t target_ref = 0;
8149         target_var = NodeId_clone(&target_var);
8150         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
8151         target_ref = tag_ptr(target_var.inner, target_var.is_owned);
8152         LDKChannelUsage usage_var = usage;
8153         uint64_t usage_ref = 0;
8154         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
8155         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
8156         return js_invoke_function_bbbbuu(j_calls->instance_ptr, 39, short_channel_id_conv, source_ref, target_ref, usage_ref, 0, 0);
8157 }
8158 void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
8159         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8160         LDKCVec_RouteHopZ path_var = path;
8161         uint64_tArray path_arr = NULL;
8162         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
8163         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
8164         for (size_t k = 0; k < path_var.datalen; k++) {
8165                 LDKRouteHop path_conv_10_var = path_var.data[k];
8166                 uint64_t path_conv_10_ref = 0;
8167                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8168                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
8169                 path_arr_ptr[k] = path_conv_10_ref;
8170         }
8171         
8172         FREE(path_var.data);
8173         int64_t short_channel_id_conv = short_channel_id;
8174         js_invoke_function_ubuuuu(j_calls->instance_ptr, 40, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0);
8175 }
8176 void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
8177         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8178         LDKCVec_RouteHopZ path_var = path;
8179         uint64_tArray path_arr = NULL;
8180         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
8181         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
8182         for (size_t k = 0; k < path_var.datalen; k++) {
8183                 LDKRouteHop path_conv_10_var = path_var.data[k];
8184                 uint64_t path_conv_10_ref = 0;
8185                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8186                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
8187                 path_arr_ptr[k] = path_conv_10_ref;
8188         }
8189         
8190         FREE(path_var.data);
8191         js_invoke_function_uuuuuu(j_calls->instance_ptr, 41, (uint32_t)path_arr, 0, 0, 0, 0, 0);
8192 }
8193 void probe_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
8194         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8195         LDKCVec_RouteHopZ path_var = path;
8196         uint64_tArray path_arr = NULL;
8197         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
8198         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
8199         for (size_t k = 0; k < path_var.datalen; k++) {
8200                 LDKRouteHop path_conv_10_var = path_var.data[k];
8201                 uint64_t path_conv_10_ref = 0;
8202                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8203                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
8204                 path_arr_ptr[k] = path_conv_10_ref;
8205         }
8206         
8207         FREE(path_var.data);
8208         int64_t short_channel_id_conv = short_channel_id;
8209         js_invoke_function_ubuuuu(j_calls->instance_ptr, 42, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0);
8210 }
8211 void probe_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) {
8212         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8213         LDKCVec_RouteHopZ path_var = path;
8214         uint64_tArray path_arr = NULL;
8215         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
8216         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
8217         for (size_t k = 0; k < path_var.datalen; k++) {
8218                 LDKRouteHop path_conv_10_var = path_var.data[k];
8219                 uint64_t path_conv_10_ref = 0;
8220                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
8221                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
8222                 path_arr_ptr[k] = path_conv_10_ref;
8223         }
8224         
8225         FREE(path_var.data);
8226         js_invoke_function_uuuuuu(j_calls->instance_ptr, 43, (uint32_t)path_arr, 0, 0, 0, 0, 0);
8227 }
8228 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
8229         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
8230         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 44, 0, 0, 0, 0, 0, 0);
8231         LDKCVec_u8Z ret_ref;
8232         ret_ref.datalen = ret->arr_len;
8233         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8234         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
8235         return ret_ref;
8236 }
8237 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
8238         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
8239         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8240 }
8241 static inline LDKScore LDKScore_init (JSValue o) {
8242         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
8243         atomic_init(&calls->refcnt, 1);
8244         calls->instance_ptr = o;
8245
8246         LDKScore ret = {
8247                 .this_arg = (void*) calls,
8248                 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
8249                 .payment_path_failed = payment_path_failed_LDKScore_jcall,
8250                 .payment_path_successful = payment_path_successful_LDKScore_jcall,
8251                 .probe_failed = probe_failed_LDKScore_jcall,
8252                 .probe_successful = probe_successful_LDKScore_jcall,
8253                 .write = write_LDKScore_jcall,
8254                 .free = LDKScore_JCalls_free,
8255         };
8256         return ret;
8257 }
8258 uint64_t  __attribute__((export_name("TS_LDKScore_new"))) TS_LDKScore_new(JSValue o) {
8259         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
8260         *res_ptr = LDKScore_init(o);
8261         return tag_ptr(res_ptr, true);
8262 }
8263 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) {
8264         void* this_arg_ptr = untag_ptr(this_arg);
8265         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8266         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8267         LDKNodeId source_conv;
8268         source_conv.inner = untag_ptr(source);
8269         source_conv.is_owned = ptr_is_owned(source);
8270         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
8271         source_conv.is_owned = false;
8272         LDKNodeId target_conv;
8273         target_conv.inner = untag_ptr(target);
8274         target_conv.is_owned = ptr_is_owned(target);
8275         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
8276         target_conv.is_owned = false;
8277         LDKChannelUsage usage_conv;
8278         usage_conv.inner = untag_ptr(usage);
8279         usage_conv.is_owned = ptr_is_owned(usage);
8280         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
8281         usage_conv = ChannelUsage_clone(&usage_conv);
8282         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv, usage_conv);
8283         return ret_conv;
8284 }
8285
8286 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) {
8287         void* this_arg_ptr = untag_ptr(this_arg);
8288         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8289         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8290         LDKCVec_RouteHopZ path_constr;
8291         path_constr.datalen = path->arr_len;
8292         if (path_constr.datalen > 0)
8293                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8294         else
8295                 path_constr.data = NULL;
8296         uint64_t* path_vals = path->elems;
8297         for (size_t k = 0; k < path_constr.datalen; k++) {
8298                 uint64_t path_conv_10 = path_vals[k];
8299                 LDKRouteHop path_conv_10_conv;
8300                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
8301                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
8302                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8303                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8304                 path_constr.data[k] = path_conv_10_conv;
8305         }
8306         FREE(path);
8307         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
8308 }
8309
8310 void  __attribute__((export_name("TS_Score_payment_path_successful"))) TS_Score_payment_path_successful(uint64_t this_arg, uint64_tArray path) {
8311         void* this_arg_ptr = untag_ptr(this_arg);
8312         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8313         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8314         LDKCVec_RouteHopZ path_constr;
8315         path_constr.datalen = path->arr_len;
8316         if (path_constr.datalen > 0)
8317                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8318         else
8319                 path_constr.data = NULL;
8320         uint64_t* path_vals = path->elems;
8321         for (size_t k = 0; k < path_constr.datalen; k++) {
8322                 uint64_t path_conv_10 = path_vals[k];
8323                 LDKRouteHop path_conv_10_conv;
8324                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
8325                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
8326                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8327                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8328                 path_constr.data[k] = path_conv_10_conv;
8329         }
8330         FREE(path);
8331         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr);
8332 }
8333
8334 void  __attribute__((export_name("TS_Score_probe_failed"))) TS_Score_probe_failed(uint64_t this_arg, uint64_tArray path, int64_t short_channel_id) {
8335         void* this_arg_ptr = untag_ptr(this_arg);
8336         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8337         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8338         LDKCVec_RouteHopZ path_constr;
8339         path_constr.datalen = path->arr_len;
8340         if (path_constr.datalen > 0)
8341                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8342         else
8343                 path_constr.data = NULL;
8344         uint64_t* path_vals = path->elems;
8345         for (size_t k = 0; k < path_constr.datalen; k++) {
8346                 uint64_t path_conv_10 = path_vals[k];
8347                 LDKRouteHop path_conv_10_conv;
8348                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
8349                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
8350                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8351                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8352                 path_constr.data[k] = path_conv_10_conv;
8353         }
8354         FREE(path);
8355         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
8356 }
8357
8358 void  __attribute__((export_name("TS_Score_probe_successful"))) TS_Score_probe_successful(uint64_t this_arg, uint64_tArray path) {
8359         void* this_arg_ptr = untag_ptr(this_arg);
8360         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8361         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8362         LDKCVec_RouteHopZ path_constr;
8363         path_constr.datalen = path->arr_len;
8364         if (path_constr.datalen > 0)
8365                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
8366         else
8367                 path_constr.data = NULL;
8368         uint64_t* path_vals = path->elems;
8369         for (size_t k = 0; k < path_constr.datalen; k++) {
8370                 uint64_t path_conv_10 = path_vals[k];
8371                 LDKRouteHop path_conv_10_conv;
8372                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
8373                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
8374                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
8375                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
8376                 path_constr.data[k] = path_conv_10_conv;
8377         }
8378         FREE(path);
8379         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, path_constr);
8380 }
8381
8382 int8_tArray  __attribute__((export_name("TS_Score_write"))) TS_Score_write(uint64_t this_arg) {
8383         void* this_arg_ptr = untag_ptr(this_arg);
8384         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8385         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
8386         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8387         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8388         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8389         CVec_u8Z_free(ret_var);
8390         return ret_arr;
8391 }
8392
8393 typedef struct LDKLockableScore_JCalls {
8394         atomic_size_t refcnt;
8395         uint32_t instance_ptr;
8396 } LDKLockableScore_JCalls;
8397 static void LDKLockableScore_JCalls_free(void* this_arg) {
8398         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
8399         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8400                 FREE(j_calls);
8401         }
8402 }
8403 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
8404         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
8405         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 45, 0, 0, 0, 0, 0, 0);
8406         void* ret_ptr = untag_ptr(ret);
8407         CHECK_ACCESS(ret_ptr);
8408         LDKScore ret_conv = *(LDKScore*)(ret_ptr);
8409         if (ret_conv.free == LDKScore_JCalls_free) {
8410                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8411                 LDKScore_JCalls_cloned(&ret_conv);
8412         }// WARNING: we may need a move here but no clone is available for LDKScore
8413         
8414         return ret_conv;
8415 }
8416 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
8417         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
8418         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8419 }
8420 static inline LDKLockableScore LDKLockableScore_init (JSValue o) {
8421         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
8422         atomic_init(&calls->refcnt, 1);
8423         calls->instance_ptr = o;
8424
8425         LDKLockableScore ret = {
8426                 .this_arg = (void*) calls,
8427                 .lock = lock_LDKLockableScore_jcall,
8428                 .free = LDKLockableScore_JCalls_free,
8429         };
8430         return ret;
8431 }
8432 uint64_t  __attribute__((export_name("TS_LDKLockableScore_new"))) TS_LDKLockableScore_new(JSValue o) {
8433         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
8434         *res_ptr = LDKLockableScore_init(o);
8435         return tag_ptr(res_ptr, true);
8436 }
8437 uint64_t  __attribute__((export_name("TS_LockableScore_lock"))) TS_LockableScore_lock(uint64_t this_arg) {
8438         void* this_arg_ptr = untag_ptr(this_arg);
8439         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8440         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
8441         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
8442         *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
8443         return tag_ptr(ret_ret, true);
8444 }
8445
8446 typedef struct LDKWriteableScore_JCalls {
8447         atomic_size_t refcnt;
8448         uint32_t instance_ptr;
8449         LDKLockableScore_JCalls* LockableScore;
8450 } LDKWriteableScore_JCalls;
8451 static void LDKWriteableScore_JCalls_free(void* this_arg) {
8452         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
8453         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8454                 FREE(j_calls);
8455         }
8456 }
8457 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
8458         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
8459         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 46, 0, 0, 0, 0, 0, 0);
8460         LDKCVec_u8Z ret_ref;
8461         ret_ref.datalen = ret->arr_len;
8462         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8463         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
8464         return ret_ref;
8465 }
8466 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
8467         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
8468         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8469         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
8470 }
8471 static inline LDKWriteableScore LDKWriteableScore_init (JSValue o, JSValue LockableScore) {
8472         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
8473         atomic_init(&calls->refcnt, 1);
8474         calls->instance_ptr = o;
8475
8476         LDKWriteableScore ret = {
8477                 .this_arg = (void*) calls,
8478                 .write = write_LDKWriteableScore_jcall,
8479                 .free = LDKWriteableScore_JCalls_free,
8480                 .LockableScore = LDKLockableScore_init(LockableScore),
8481         };
8482         calls->LockableScore = ret.LockableScore.this_arg;
8483         return ret;
8484 }
8485 uint64_t  __attribute__((export_name("TS_LDKWriteableScore_new"))) TS_LDKWriteableScore_new(JSValue o, JSValue LockableScore) {
8486         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
8487         *res_ptr = LDKWriteableScore_init(o, LockableScore);
8488         return tag_ptr(res_ptr, true);
8489 }
8490 int8_tArray  __attribute__((export_name("TS_WriteableScore_write"))) TS_WriteableScore_write(uint64_t this_arg) {
8491         void* this_arg_ptr = untag_ptr(this_arg);
8492         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8493         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
8494         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8495         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8496         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8497         CVec_u8Z_free(ret_var);
8498         return ret_arr;
8499 }
8500
8501 typedef struct LDKPersister_JCalls {
8502         atomic_size_t refcnt;
8503         uint32_t instance_ptr;
8504 } LDKPersister_JCalls;
8505 static void LDKPersister_JCalls_free(void* this_arg) {
8506         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8507         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8508                 FREE(j_calls);
8509         }
8510 }
8511 LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
8512         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8513         LDKChannelManager channel_manager_var = *channel_manager;
8514         uint64_t channel_manager_ref = 0;
8515         // WARNING: we may need a move here but no clone is available for LDKChannelManager
8516         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
8517         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
8518         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 47, channel_manager_ref, 0, 0, 0, 0, 0);
8519         void* ret_ptr = untag_ptr(ret);
8520         CHECK_ACCESS(ret_ptr);
8521         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8522         FREE(untag_ptr(ret));
8523         return ret_conv;
8524 }
8525 LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
8526         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8527         LDKNetworkGraph network_graph_var = *network_graph;
8528         uint64_t network_graph_ref = 0;
8529         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
8530         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
8531         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
8532         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 48, network_graph_ref, 0, 0, 0, 0, 0);
8533         void* ret_ptr = untag_ptr(ret);
8534         CHECK_ACCESS(ret_ptr);
8535         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8536         FREE(untag_ptr(ret));
8537         return ret_conv;
8538 }
8539 LDKCResult_NoneErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
8540         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
8541         // WARNING: This object doesn't live past this scope, needs clone!
8542         uint64_t ret_scorer = tag_ptr(scorer, false);
8543         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 49, ret_scorer, 0, 0, 0, 0, 0);
8544         void* ret_ptr = untag_ptr(ret);
8545         CHECK_ACCESS(ret_ptr);
8546         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
8547         FREE(untag_ptr(ret));
8548         return ret_conv;
8549 }
8550 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
8551         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
8552         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8553 }
8554 static inline LDKPersister LDKPersister_init (JSValue o) {
8555         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
8556         atomic_init(&calls->refcnt, 1);
8557         calls->instance_ptr = o;
8558
8559         LDKPersister ret = {
8560                 .this_arg = (void*) calls,
8561                 .persist_manager = persist_manager_LDKPersister_jcall,
8562                 .persist_graph = persist_graph_LDKPersister_jcall,
8563                 .persist_scorer = persist_scorer_LDKPersister_jcall,
8564                 .free = LDKPersister_JCalls_free,
8565         };
8566         return ret;
8567 }
8568 uint64_t  __attribute__((export_name("TS_LDKPersister_new"))) TS_LDKPersister_new(JSValue o) {
8569         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
8570         *res_ptr = LDKPersister_init(o);
8571         return tag_ptr(res_ptr, true);
8572 }
8573 uint64_t  __attribute__((export_name("TS_Persister_persist_manager"))) TS_Persister_persist_manager(uint64_t this_arg, uint64_t channel_manager) {
8574         void* this_arg_ptr = untag_ptr(this_arg);
8575         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8576         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
8577         LDKChannelManager channel_manager_conv;
8578         channel_manager_conv.inner = untag_ptr(channel_manager);
8579         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
8580         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
8581         channel_manager_conv.is_owned = false;
8582         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8583         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
8584         return tag_ptr(ret_conv, true);
8585 }
8586
8587 uint64_t  __attribute__((export_name("TS_Persister_persist_graph"))) TS_Persister_persist_graph(uint64_t this_arg, uint64_t network_graph) {
8588         void* this_arg_ptr = untag_ptr(this_arg);
8589         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8590         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
8591         LDKNetworkGraph network_graph_conv;
8592         network_graph_conv.inner = untag_ptr(network_graph);
8593         network_graph_conv.is_owned = ptr_is_owned(network_graph);
8594         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
8595         network_graph_conv.is_owned = false;
8596         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8597         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
8598         return tag_ptr(ret_conv, true);
8599 }
8600
8601 uint64_t  __attribute__((export_name("TS_Persister_persist_scorer"))) TS_Persister_persist_scorer(uint64_t this_arg, uint64_t scorer) {
8602         void* this_arg_ptr = untag_ptr(this_arg);
8603         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8604         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
8605         void* scorer_ptr = untag_ptr(scorer);
8606         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
8607         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
8608         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
8609         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
8610         return tag_ptr(ret_conv, true);
8611 }
8612
8613 typedef struct LDKFutureCallback_JCalls {
8614         atomic_size_t refcnt;
8615         uint32_t instance_ptr;
8616 } LDKFutureCallback_JCalls;
8617 static void LDKFutureCallback_JCalls_free(void* this_arg) {
8618         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
8619         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8620                 FREE(j_calls);
8621         }
8622 }
8623 void call_LDKFutureCallback_jcall(const void* this_arg) {
8624         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
8625         js_invoke_function_uuuuuu(j_calls->instance_ptr, 50, 0, 0, 0, 0, 0, 0);
8626 }
8627 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
8628         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
8629         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8630 }
8631 static inline LDKFutureCallback LDKFutureCallback_init (JSValue o) {
8632         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
8633         atomic_init(&calls->refcnt, 1);
8634         calls->instance_ptr = o;
8635
8636         LDKFutureCallback ret = {
8637                 .this_arg = (void*) calls,
8638                 .call = call_LDKFutureCallback_jcall,
8639                 .free = LDKFutureCallback_JCalls_free,
8640         };
8641         return ret;
8642 }
8643 uint64_t  __attribute__((export_name("TS_LDKFutureCallback_new"))) TS_LDKFutureCallback_new(JSValue o) {
8644         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
8645         *res_ptr = LDKFutureCallback_init(o);
8646         return tag_ptr(res_ptr, true);
8647 }
8648 void  __attribute__((export_name("TS_FutureCallback_call"))) TS_FutureCallback_call(uint64_t this_arg) {
8649         void* this_arg_ptr = untag_ptr(this_arg);
8650         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8651         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
8652         (this_arg_conv->call)(this_arg_conv->this_arg);
8653 }
8654
8655 typedef struct LDKListen_JCalls {
8656         atomic_size_t refcnt;
8657         uint32_t instance_ptr;
8658 } LDKListen_JCalls;
8659 static void LDKListen_JCalls_free(void* this_arg) {
8660         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8661         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8662                 FREE(j_calls);
8663         }
8664 }
8665 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
8666         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8667         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8668         memcpy(header_arr->elems, *header, 80);
8669         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
8670         uint64_tArray txdata_arr = NULL;
8671         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
8672         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
8673         for (size_t c = 0; c < txdata_var.datalen; c++) {
8674                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
8675                 *txdata_conv_28_conv = txdata_var.data[c];
8676                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
8677         }
8678         
8679         FREE(txdata_var.data);
8680         int32_t height_conv = height;
8681         js_invoke_function_uuuuuu(j_calls->instance_ptr, 51, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
8682 }
8683 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
8684         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8685         LDKu8slice block_var = block;
8686         int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__);
8687         memcpy(block_arr->elems, block_var.data, block_var.datalen);
8688         int32_t height_conv = height;
8689         js_invoke_function_uuuuuu(j_calls->instance_ptr, 52, (uint32_t)block_arr, height_conv, 0, 0, 0, 0);
8690 }
8691 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
8692         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
8693         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8694         memcpy(header_arr->elems, *header, 80);
8695         int32_t height_conv = height;
8696         js_invoke_function_uuuuuu(j_calls->instance_ptr, 53, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
8697 }
8698 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
8699         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
8700         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8701 }
8702 static inline LDKListen LDKListen_init (JSValue o) {
8703         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
8704         atomic_init(&calls->refcnt, 1);
8705         calls->instance_ptr = o;
8706
8707         LDKListen ret = {
8708                 .this_arg = (void*) calls,
8709                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
8710                 .block_connected = block_connected_LDKListen_jcall,
8711                 .block_disconnected = block_disconnected_LDKListen_jcall,
8712                 .free = LDKListen_JCalls_free,
8713         };
8714         return ret;
8715 }
8716 uint64_t  __attribute__((export_name("TS_LDKListen_new"))) TS_LDKListen_new(JSValue o) {
8717         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
8718         *res_ptr = LDKListen_init(o);
8719         return tag_ptr(res_ptr, true);
8720 }
8721 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) {
8722         void* this_arg_ptr = untag_ptr(this_arg);
8723         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8724         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8725         unsigned char header_arr[80];
8726         CHECK(header->arr_len == 80);
8727         memcpy(header_arr, header->elems, 80); FREE(header);
8728         unsigned char (*header_ref)[80] = &header_arr;
8729         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
8730         txdata_constr.datalen = txdata->arr_len;
8731         if (txdata_constr.datalen > 0)
8732                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8733         else
8734                 txdata_constr.data = NULL;
8735         uint64_t* txdata_vals = txdata->elems;
8736         for (size_t c = 0; c < txdata_constr.datalen; c++) {
8737                 uint64_t txdata_conv_28 = txdata_vals[c];
8738                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
8739                 CHECK_ACCESS(txdata_conv_28_ptr);
8740                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
8741                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
8742                 txdata_constr.data[c] = txdata_conv_28_conv;
8743         }
8744         FREE(txdata);
8745         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
8746 }
8747
8748 void  __attribute__((export_name("TS_Listen_block_connected"))) TS_Listen_block_connected(uint64_t this_arg, int8_tArray block, int32_t height) {
8749         void* this_arg_ptr = untag_ptr(this_arg);
8750         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8751         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8752         LDKu8slice block_ref;
8753         block_ref.datalen = block->arr_len;
8754         block_ref.data = block->elems;
8755         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
8756         FREE(block);
8757 }
8758
8759 void  __attribute__((export_name("TS_Listen_block_disconnected"))) TS_Listen_block_disconnected(uint64_t this_arg, int8_tArray header, int32_t height) {
8760         void* this_arg_ptr = untag_ptr(this_arg);
8761         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8762         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
8763         unsigned char header_arr[80];
8764         CHECK(header->arr_len == 80);
8765         memcpy(header_arr, header->elems, 80); FREE(header);
8766         unsigned char (*header_ref)[80] = &header_arr;
8767         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
8768 }
8769
8770 typedef struct LDKConfirm_JCalls {
8771         atomic_size_t refcnt;
8772         uint32_t instance_ptr;
8773 } LDKConfirm_JCalls;
8774 static void LDKConfirm_JCalls_free(void* this_arg) {
8775         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8776         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8777                 FREE(j_calls);
8778         }
8779 }
8780 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
8781         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8782         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8783         memcpy(header_arr->elems, *header, 80);
8784         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
8785         uint64_tArray txdata_arr = NULL;
8786         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
8787         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
8788         for (size_t c = 0; c < txdata_var.datalen; c++) {
8789                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
8790                 *txdata_conv_28_conv = txdata_var.data[c];
8791                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
8792         }
8793         
8794         FREE(txdata_var.data);
8795         int32_t height_conv = height;
8796         js_invoke_function_uuuuuu(j_calls->instance_ptr, 54, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
8797 }
8798 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
8799         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8800         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
8801         memcpy(txid_arr->elems, *txid, 32);
8802         js_invoke_function_uuuuuu(j_calls->instance_ptr, 55, (uint32_t)txid_arr, 0, 0, 0, 0, 0);
8803 }
8804 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
8805         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8806         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
8807         memcpy(header_arr->elems, *header, 80);
8808         int32_t height_conv = height;
8809         js_invoke_function_uuuuuu(j_calls->instance_ptr, 56, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
8810 }
8811 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
8812         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
8813         ptrArray ret = (ptrArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 57, 0, 0, 0, 0, 0, 0);
8814         LDKCVec_TxidZ ret_constr;
8815         ret_constr.datalen = ret->arr_len;
8816         if (ret_constr.datalen > 0)
8817                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
8818         else
8819                 ret_constr.data = NULL;
8820         int8_tArray* ret_vals = (void*) ret->elems;
8821         for (size_t m = 0; m < ret_constr.datalen; m++) {
8822                 int8_tArray ret_conv_12 = ret_vals[m];
8823                 LDKThirtyTwoBytes ret_conv_12_ref;
8824                 CHECK(ret_conv_12->arr_len == 32);
8825                 memcpy(ret_conv_12_ref.data, ret_conv_12->elems, 32); FREE(ret_conv_12);
8826                 ret_constr.data[m] = ret_conv_12_ref;
8827         }
8828         FREE(ret);
8829         return ret_constr;
8830 }
8831 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
8832         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
8833         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8834 }
8835 static inline LDKConfirm LDKConfirm_init (JSValue o) {
8836         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
8837         atomic_init(&calls->refcnt, 1);
8838         calls->instance_ptr = o;
8839
8840         LDKConfirm ret = {
8841                 .this_arg = (void*) calls,
8842                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
8843                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
8844                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
8845                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
8846                 .free = LDKConfirm_JCalls_free,
8847         };
8848         return ret;
8849 }
8850 uint64_t  __attribute__((export_name("TS_LDKConfirm_new"))) TS_LDKConfirm_new(JSValue o) {
8851         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
8852         *res_ptr = LDKConfirm_init(o);
8853         return tag_ptr(res_ptr, true);
8854 }
8855 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) {
8856         void* this_arg_ptr = untag_ptr(this_arg);
8857         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8858         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8859         unsigned char header_arr[80];
8860         CHECK(header->arr_len == 80);
8861         memcpy(header_arr, header->elems, 80); FREE(header);
8862         unsigned char (*header_ref)[80] = &header_arr;
8863         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
8864         txdata_constr.datalen = txdata->arr_len;
8865         if (txdata_constr.datalen > 0)
8866                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8867         else
8868                 txdata_constr.data = NULL;
8869         uint64_t* txdata_vals = txdata->elems;
8870         for (size_t c = 0; c < txdata_constr.datalen; c++) {
8871                 uint64_t txdata_conv_28 = txdata_vals[c];
8872                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
8873                 CHECK_ACCESS(txdata_conv_28_ptr);
8874                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
8875                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
8876                 txdata_constr.data[c] = txdata_conv_28_conv;
8877         }
8878         FREE(txdata);
8879         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
8880 }
8881
8882 void  __attribute__((export_name("TS_Confirm_transaction_unconfirmed"))) TS_Confirm_transaction_unconfirmed(uint64_t this_arg, int8_tArray txid) {
8883         void* this_arg_ptr = untag_ptr(this_arg);
8884         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8885         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8886         unsigned char txid_arr[32];
8887         CHECK(txid->arr_len == 32);
8888         memcpy(txid_arr, txid->elems, 32); FREE(txid);
8889         unsigned char (*txid_ref)[32] = &txid_arr;
8890         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
8891 }
8892
8893 void  __attribute__((export_name("TS_Confirm_best_block_updated"))) TS_Confirm_best_block_updated(uint64_t this_arg, int8_tArray header, int32_t height) {
8894         void* this_arg_ptr = untag_ptr(this_arg);
8895         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8896         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8897         unsigned char header_arr[80];
8898         CHECK(header->arr_len == 80);
8899         memcpy(header_arr, header->elems, 80); FREE(header);
8900         unsigned char (*header_ref)[80] = &header_arr;
8901         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
8902 }
8903
8904 ptrArray  __attribute__((export_name("TS_Confirm_get_relevant_txids"))) TS_Confirm_get_relevant_txids(uint64_t this_arg) {
8905         void* this_arg_ptr = untag_ptr(this_arg);
8906         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8907         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
8908         LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
8909         ptrArray ret_arr = NULL;
8910         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
8911         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
8912         for (size_t m = 0; m < ret_var.datalen; m++) {
8913                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
8914                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
8915                 ret_arr_ptr[m] = ret_conv_12_arr;
8916         }
8917         
8918         FREE(ret_var.data);
8919         return ret_arr;
8920 }
8921
8922 typedef struct LDKPersist_JCalls {
8923         atomic_size_t refcnt;
8924         uint32_t instance_ptr;
8925 } LDKPersist_JCalls;
8926 static void LDKPersist_JCalls_free(void* this_arg) {
8927         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8928         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8929                 FREE(j_calls);
8930         }
8931 }
8932 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
8933         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8934         LDKOutPoint channel_id_var = channel_id;
8935         uint64_t channel_id_ref = 0;
8936         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
8937         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
8938         LDKChannelMonitor data_var = *data;
8939         uint64_t data_ref = 0;
8940         data_var = ChannelMonitor_clone(&data_var);
8941         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
8942         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
8943         LDKMonitorUpdateId update_id_var = update_id;
8944         uint64_t update_id_ref = 0;
8945         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
8946         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
8947         uint64_t ret = js_invoke_function_bbbuuu(j_calls->instance_ptr, 58, channel_id_ref, data_ref, update_id_ref, 0, 0, 0);
8948         void* ret_ptr = untag_ptr(ret);
8949         CHECK_ACCESS(ret_ptr);
8950         LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
8951         FREE(untag_ptr(ret));
8952         return ret_conv;
8953 }
8954 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
8955         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
8956         LDKOutPoint channel_id_var = channel_id;
8957         uint64_t channel_id_ref = 0;
8958         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
8959         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
8960         LDKChannelMonitorUpdate update_var = *update;
8961         uint64_t update_ref = 0;
8962         update_var = ChannelMonitorUpdate_clone(&update_var);
8963         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
8964         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
8965         LDKChannelMonitor data_var = *data;
8966         uint64_t data_ref = 0;
8967         data_var = ChannelMonitor_clone(&data_var);
8968         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
8969         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
8970         LDKMonitorUpdateId update_id_var = update_id;
8971         uint64_t update_id_ref = 0;
8972         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
8973         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
8974         uint64_t ret = js_invoke_function_bbbbuu(j_calls->instance_ptr, 59, channel_id_ref, update_ref, data_ref, update_id_ref, 0, 0);
8975         void* ret_ptr = untag_ptr(ret);
8976         CHECK_ACCESS(ret_ptr);
8977         LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(ret_ptr);
8978         FREE(untag_ptr(ret));
8979         return ret_conv;
8980 }
8981 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
8982         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
8983         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8984 }
8985 static inline LDKPersist LDKPersist_init (JSValue o) {
8986         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
8987         atomic_init(&calls->refcnt, 1);
8988         calls->instance_ptr = o;
8989
8990         LDKPersist ret = {
8991                 .this_arg = (void*) calls,
8992                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
8993                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
8994                 .free = LDKPersist_JCalls_free,
8995         };
8996         return ret;
8997 }
8998 uint64_t  __attribute__((export_name("TS_LDKPersist_new"))) TS_LDKPersist_new(JSValue o) {
8999         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
9000         *res_ptr = LDKPersist_init(o);
9001         return tag_ptr(res_ptr, true);
9002 }
9003 uint64_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) {
9004         void* this_arg_ptr = untag_ptr(this_arg);
9005         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9006         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
9007         LDKOutPoint channel_id_conv;
9008         channel_id_conv.inner = untag_ptr(channel_id);
9009         channel_id_conv.is_owned = ptr_is_owned(channel_id);
9010         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
9011         channel_id_conv = OutPoint_clone(&channel_id_conv);
9012         LDKChannelMonitor data_conv;
9013         data_conv.inner = untag_ptr(data);
9014         data_conv.is_owned = ptr_is_owned(data);
9015         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
9016         data_conv.is_owned = false;
9017         LDKMonitorUpdateId update_id_conv;
9018         update_id_conv.inner = untag_ptr(update_id);
9019         update_id_conv.is_owned = ptr_is_owned(update_id);
9020         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
9021         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
9022         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9023         *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_id_conv, &data_conv, update_id_conv);
9024         return tag_ptr(ret_conv, true);
9025 }
9026
9027 uint64_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) {
9028         void* this_arg_ptr = untag_ptr(this_arg);
9029         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9030         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
9031         LDKOutPoint channel_id_conv;
9032         channel_id_conv.inner = untag_ptr(channel_id);
9033         channel_id_conv.is_owned = ptr_is_owned(channel_id);
9034         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
9035         channel_id_conv = OutPoint_clone(&channel_id_conv);
9036         LDKChannelMonitorUpdate update_conv;
9037         update_conv.inner = untag_ptr(update);
9038         update_conv.is_owned = ptr_is_owned(update);
9039         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
9040         update_conv.is_owned = false;
9041         LDKChannelMonitor data_conv;
9042         data_conv.inner = untag_ptr(data);
9043         data_conv.is_owned = ptr_is_owned(data);
9044         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
9045         data_conv.is_owned = false;
9046         LDKMonitorUpdateId update_id_conv;
9047         update_id_conv.inner = untag_ptr(update_id);
9048         update_id_conv.is_owned = ptr_is_owned(update_id);
9049         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
9050         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
9051         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9052         *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv);
9053         return tag_ptr(ret_conv, true);
9054 }
9055
9056 typedef struct LDKChannelMessageHandler_JCalls {
9057         atomic_size_t refcnt;
9058         uint32_t instance_ptr;
9059         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
9060 } LDKChannelMessageHandler_JCalls;
9061 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
9062         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9063         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9064                 FREE(j_calls);
9065         }
9066 }
9067 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
9068         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9069         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9070         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9071         LDKInitFeatures their_features_var = their_features;
9072         uint64_t their_features_ref = 0;
9073         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
9074         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
9075         LDKOpenChannel msg_var = *msg;
9076         uint64_t msg_ref = 0;
9077         msg_var = OpenChannel_clone(&msg_var);
9078         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9079         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9080         js_invoke_function_ubbuuu(j_calls->instance_ptr, 60, (uint32_t)their_node_id_arr, their_features_ref, msg_ref, 0, 0, 0);
9081 }
9082 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
9083         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9084         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9085         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9086         LDKInitFeatures their_features_var = their_features;
9087         uint64_t their_features_ref = 0;
9088         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
9089         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
9090         LDKAcceptChannel msg_var = *msg;
9091         uint64_t msg_ref = 0;
9092         msg_var = AcceptChannel_clone(&msg_var);
9093         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9094         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9095         js_invoke_function_ubbuuu(j_calls->instance_ptr, 61, (uint32_t)their_node_id_arr, their_features_ref, msg_ref, 0, 0, 0);
9096 }
9097 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
9098         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9099         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9100         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9101         LDKFundingCreated msg_var = *msg;
9102         uint64_t msg_ref = 0;
9103         msg_var = FundingCreated_clone(&msg_var);
9104         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9105         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9106         js_invoke_function_ubuuuu(j_calls->instance_ptr, 62, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9107 }
9108 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
9109         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9110         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9111         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9112         LDKFundingSigned msg_var = *msg;
9113         uint64_t msg_ref = 0;
9114         msg_var = FundingSigned_clone(&msg_var);
9115         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9116         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9117         js_invoke_function_ubuuuu(j_calls->instance_ptr, 63, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9118 }
9119 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
9120         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9121         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9122         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9123         LDKChannelReady msg_var = *msg;
9124         uint64_t msg_ref = 0;
9125         msg_var = ChannelReady_clone(&msg_var);
9126         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9127         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9128         js_invoke_function_ubuuuu(j_calls->instance_ptr, 64, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9129 }
9130 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
9131         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9132         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9133         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9134         LDKInitFeatures their_features_var = *their_features;
9135         uint64_t their_features_ref = 0;
9136         their_features_var = InitFeatures_clone(&their_features_var);
9137         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var);
9138         their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned);
9139         LDKShutdown msg_var = *msg;
9140         uint64_t msg_ref = 0;
9141         msg_var = Shutdown_clone(&msg_var);
9142         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9143         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9144         js_invoke_function_ubbuuu(j_calls->instance_ptr, 65, (uint32_t)their_node_id_arr, their_features_ref, msg_ref, 0, 0, 0);
9145 }
9146 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
9147         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9148         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9149         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9150         LDKClosingSigned msg_var = *msg;
9151         uint64_t msg_ref = 0;
9152         msg_var = ClosingSigned_clone(&msg_var);
9153         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9154         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9155         js_invoke_function_ubuuuu(j_calls->instance_ptr, 66, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9156 }
9157 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
9158         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9159         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9160         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9161         LDKUpdateAddHTLC msg_var = *msg;
9162         uint64_t msg_ref = 0;
9163         msg_var = UpdateAddHTLC_clone(&msg_var);
9164         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9165         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9166         js_invoke_function_ubuuuu(j_calls->instance_ptr, 67, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9167 }
9168 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
9169         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9170         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9171         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9172         LDKUpdateFulfillHTLC msg_var = *msg;
9173         uint64_t msg_ref = 0;
9174         msg_var = UpdateFulfillHTLC_clone(&msg_var);
9175         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9176         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9177         js_invoke_function_ubuuuu(j_calls->instance_ptr, 68, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9178 }
9179 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
9180         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9181         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9182         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9183         LDKUpdateFailHTLC msg_var = *msg;
9184         uint64_t msg_ref = 0;
9185         msg_var = UpdateFailHTLC_clone(&msg_var);
9186         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9187         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9188         js_invoke_function_ubuuuu(j_calls->instance_ptr, 69, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9189 }
9190 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
9191         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9192         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9193         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9194         LDKUpdateFailMalformedHTLC msg_var = *msg;
9195         uint64_t msg_ref = 0;
9196         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
9197         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9198         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9199         js_invoke_function_ubuuuu(j_calls->instance_ptr, 70, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9200 }
9201 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
9202         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9203         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9204         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9205         LDKCommitmentSigned msg_var = *msg;
9206         uint64_t msg_ref = 0;
9207         msg_var = CommitmentSigned_clone(&msg_var);
9208         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9209         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9210         js_invoke_function_ubuuuu(j_calls->instance_ptr, 71, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9211 }
9212 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
9213         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9214         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9215         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9216         LDKRevokeAndACK msg_var = *msg;
9217         uint64_t msg_ref = 0;
9218         msg_var = RevokeAndACK_clone(&msg_var);
9219         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9220         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9221         js_invoke_function_ubuuuu(j_calls->instance_ptr, 72, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9222 }
9223 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
9224         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9225         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9226         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9227         LDKUpdateFee msg_var = *msg;
9228         uint64_t msg_ref = 0;
9229         msg_var = UpdateFee_clone(&msg_var);
9230         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9231         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9232         js_invoke_function_ubuuuu(j_calls->instance_ptr, 73, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9233 }
9234 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
9235         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9236         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9237         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9238         LDKAnnouncementSignatures msg_var = *msg;
9239         uint64_t msg_ref = 0;
9240         msg_var = AnnouncementSignatures_clone(&msg_var);
9241         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9242         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9243         js_invoke_function_ubuuuu(j_calls->instance_ptr, 74, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9244 }
9245 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
9246         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9247         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9248         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9249         jboolean no_connection_possible_conv = no_connection_possible;
9250         js_invoke_function_uuuuuu(j_calls->instance_ptr, 75, (uint32_t)their_node_id_arr, no_connection_possible_conv, 0, 0, 0, 0);
9251 }
9252 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
9253         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9254         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9255         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9256         LDKInit msg_var = *msg;
9257         uint64_t msg_ref = 0;
9258         msg_var = Init_clone(&msg_var);
9259         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9260         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9261         js_invoke_function_ubuuuu(j_calls->instance_ptr, 76, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9262 }
9263 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
9264         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9265         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9266         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9267         LDKChannelReestablish msg_var = *msg;
9268         uint64_t msg_ref = 0;
9269         msg_var = ChannelReestablish_clone(&msg_var);
9270         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9271         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9272         js_invoke_function_ubuuuu(j_calls->instance_ptr, 77, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9273 }
9274 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
9275         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9276         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9277         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9278         LDKChannelUpdate msg_var = *msg;
9279         uint64_t msg_ref = 0;
9280         msg_var = ChannelUpdate_clone(&msg_var);
9281         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9282         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9283         js_invoke_function_ubuuuu(j_calls->instance_ptr, 78, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9284 }
9285 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
9286         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9287         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9288         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9289         LDKErrorMessage msg_var = *msg;
9290         uint64_t msg_ref = 0;
9291         msg_var = ErrorMessage_clone(&msg_var);
9292         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9293         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9294         js_invoke_function_ubuuuu(j_calls->instance_ptr, 79, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9295 }
9296 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
9297         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9298         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 80, 0, 0, 0, 0, 0, 0);
9299         LDKNodeFeatures ret_conv;
9300         ret_conv.inner = untag_ptr(ret);
9301         ret_conv.is_owned = ptr_is_owned(ret);
9302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
9303         return ret_conv;
9304 }
9305 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
9306         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
9307         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9308         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9309         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 81, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
9310         LDKInitFeatures ret_conv;
9311         ret_conv.inner = untag_ptr(ret);
9312         ret_conv.is_owned = ptr_is_owned(ret);
9313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
9314         return ret_conv;
9315 }
9316 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
9317         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
9318         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9319         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
9320 }
9321 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
9322         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
9323         atomic_init(&calls->refcnt, 1);
9324         calls->instance_ptr = o;
9325
9326         LDKChannelMessageHandler ret = {
9327                 .this_arg = (void*) calls,
9328                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
9329                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
9330                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
9331                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
9332                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
9333                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
9334                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
9335                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
9336                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
9337                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
9338                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
9339                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
9340                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
9341                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
9342                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
9343                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
9344                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
9345                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
9346                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
9347                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
9348                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
9349                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
9350                 .free = LDKChannelMessageHandler_JCalls_free,
9351                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
9352         };
9353         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
9354         return ret;
9355 }
9356 uint64_t  __attribute__((export_name("TS_LDKChannelMessageHandler_new"))) TS_LDKChannelMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
9357         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
9358         *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
9359         return tag_ptr(res_ptr, true);
9360 }
9361 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) {
9362         void* this_arg_ptr = untag_ptr(this_arg);
9363         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9364         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9365         LDKPublicKey their_node_id_ref;
9366         CHECK(their_node_id->arr_len == 33);
9367         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9368         LDKInitFeatures their_features_conv;
9369         their_features_conv.inner = untag_ptr(their_features);
9370         their_features_conv.is_owned = ptr_is_owned(their_features);
9371         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
9372         their_features_conv = InitFeatures_clone(&their_features_conv);
9373         LDKOpenChannel msg_conv;
9374         msg_conv.inner = untag_ptr(msg);
9375         msg_conv.is_owned = ptr_is_owned(msg);
9376         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9377         msg_conv.is_owned = false;
9378         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
9379 }
9380
9381 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) {
9382         void* this_arg_ptr = untag_ptr(this_arg);
9383         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9384         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9385         LDKPublicKey their_node_id_ref;
9386         CHECK(their_node_id->arr_len == 33);
9387         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9388         LDKInitFeatures their_features_conv;
9389         their_features_conv.inner = untag_ptr(their_features);
9390         their_features_conv.is_owned = ptr_is_owned(their_features);
9391         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
9392         their_features_conv = InitFeatures_clone(&their_features_conv);
9393         LDKAcceptChannel msg_conv;
9394         msg_conv.inner = untag_ptr(msg);
9395         msg_conv.is_owned = ptr_is_owned(msg);
9396         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9397         msg_conv.is_owned = false;
9398         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
9399 }
9400
9401 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) {
9402         void* this_arg_ptr = untag_ptr(this_arg);
9403         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9404         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9405         LDKPublicKey their_node_id_ref;
9406         CHECK(their_node_id->arr_len == 33);
9407         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9408         LDKFundingCreated msg_conv;
9409         msg_conv.inner = untag_ptr(msg);
9410         msg_conv.is_owned = ptr_is_owned(msg);
9411         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9412         msg_conv.is_owned = false;
9413         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9414 }
9415
9416 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) {
9417         void* this_arg_ptr = untag_ptr(this_arg);
9418         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9419         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9420         LDKPublicKey their_node_id_ref;
9421         CHECK(their_node_id->arr_len == 33);
9422         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9423         LDKFundingSigned msg_conv;
9424         msg_conv.inner = untag_ptr(msg);
9425         msg_conv.is_owned = ptr_is_owned(msg);
9426         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9427         msg_conv.is_owned = false;
9428         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9429 }
9430
9431 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) {
9432         void* this_arg_ptr = untag_ptr(this_arg);
9433         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9434         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9435         LDKPublicKey their_node_id_ref;
9436         CHECK(their_node_id->arr_len == 33);
9437         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9438         LDKChannelReady msg_conv;
9439         msg_conv.inner = untag_ptr(msg);
9440         msg_conv.is_owned = ptr_is_owned(msg);
9441         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9442         msg_conv.is_owned = false;
9443         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9444 }
9445
9446 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) {
9447         void* this_arg_ptr = untag_ptr(this_arg);
9448         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9449         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9450         LDKPublicKey their_node_id_ref;
9451         CHECK(their_node_id->arr_len == 33);
9452         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9453         LDKInitFeatures their_features_conv;
9454         their_features_conv.inner = untag_ptr(their_features);
9455         their_features_conv.is_owned = ptr_is_owned(their_features);
9456         CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv);
9457         their_features_conv.is_owned = false;
9458         LDKShutdown msg_conv;
9459         msg_conv.inner = untag_ptr(msg);
9460         msg_conv.is_owned = ptr_is_owned(msg);
9461         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9462         msg_conv.is_owned = false;
9463         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
9464 }
9465
9466 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) {
9467         void* this_arg_ptr = untag_ptr(this_arg);
9468         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9469         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9470         LDKPublicKey their_node_id_ref;
9471         CHECK(their_node_id->arr_len == 33);
9472         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9473         LDKClosingSigned msg_conv;
9474         msg_conv.inner = untag_ptr(msg);
9475         msg_conv.is_owned = ptr_is_owned(msg);
9476         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9477         msg_conv.is_owned = false;
9478         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9479 }
9480
9481 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) {
9482         void* this_arg_ptr = untag_ptr(this_arg);
9483         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9484         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9485         LDKPublicKey their_node_id_ref;
9486         CHECK(their_node_id->arr_len == 33);
9487         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9488         LDKUpdateAddHTLC msg_conv;
9489         msg_conv.inner = untag_ptr(msg);
9490         msg_conv.is_owned = ptr_is_owned(msg);
9491         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9492         msg_conv.is_owned = false;
9493         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9494 }
9495
9496 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) {
9497         void* this_arg_ptr = untag_ptr(this_arg);
9498         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9499         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9500         LDKPublicKey their_node_id_ref;
9501         CHECK(their_node_id->arr_len == 33);
9502         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9503         LDKUpdateFulfillHTLC msg_conv;
9504         msg_conv.inner = untag_ptr(msg);
9505         msg_conv.is_owned = ptr_is_owned(msg);
9506         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9507         msg_conv.is_owned = false;
9508         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9509 }
9510
9511 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) {
9512         void* this_arg_ptr = untag_ptr(this_arg);
9513         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9514         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9515         LDKPublicKey their_node_id_ref;
9516         CHECK(their_node_id->arr_len == 33);
9517         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9518         LDKUpdateFailHTLC msg_conv;
9519         msg_conv.inner = untag_ptr(msg);
9520         msg_conv.is_owned = ptr_is_owned(msg);
9521         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9522         msg_conv.is_owned = false;
9523         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9524 }
9525
9526 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) {
9527         void* this_arg_ptr = untag_ptr(this_arg);
9528         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9529         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9530         LDKPublicKey their_node_id_ref;
9531         CHECK(their_node_id->arr_len == 33);
9532         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9533         LDKUpdateFailMalformedHTLC msg_conv;
9534         msg_conv.inner = untag_ptr(msg);
9535         msg_conv.is_owned = ptr_is_owned(msg);
9536         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9537         msg_conv.is_owned = false;
9538         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9539 }
9540
9541 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) {
9542         void* this_arg_ptr = untag_ptr(this_arg);
9543         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9544         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9545         LDKPublicKey their_node_id_ref;
9546         CHECK(their_node_id->arr_len == 33);
9547         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9548         LDKCommitmentSigned msg_conv;
9549         msg_conv.inner = untag_ptr(msg);
9550         msg_conv.is_owned = ptr_is_owned(msg);
9551         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9552         msg_conv.is_owned = false;
9553         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9554 }
9555
9556 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) {
9557         void* this_arg_ptr = untag_ptr(this_arg);
9558         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9559         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9560         LDKPublicKey their_node_id_ref;
9561         CHECK(their_node_id->arr_len == 33);
9562         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9563         LDKRevokeAndACK msg_conv;
9564         msg_conv.inner = untag_ptr(msg);
9565         msg_conv.is_owned = ptr_is_owned(msg);
9566         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9567         msg_conv.is_owned = false;
9568         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9569 }
9570
9571 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) {
9572         void* this_arg_ptr = untag_ptr(this_arg);
9573         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9574         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9575         LDKPublicKey their_node_id_ref;
9576         CHECK(their_node_id->arr_len == 33);
9577         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9578         LDKUpdateFee msg_conv;
9579         msg_conv.inner = untag_ptr(msg);
9580         msg_conv.is_owned = ptr_is_owned(msg);
9581         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9582         msg_conv.is_owned = false;
9583         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9584 }
9585
9586 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) {
9587         void* this_arg_ptr = untag_ptr(this_arg);
9588         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9589         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9590         LDKPublicKey their_node_id_ref;
9591         CHECK(their_node_id->arr_len == 33);
9592         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9593         LDKAnnouncementSignatures msg_conv;
9594         msg_conv.inner = untag_ptr(msg);
9595         msg_conv.is_owned = ptr_is_owned(msg);
9596         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9597         msg_conv.is_owned = false;
9598         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9599 }
9600
9601 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) {
9602         void* this_arg_ptr = untag_ptr(this_arg);
9603         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9604         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9605         LDKPublicKey their_node_id_ref;
9606         CHECK(their_node_id->arr_len == 33);
9607         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9608         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
9609 }
9610
9611 void  __attribute__((export_name("TS_ChannelMessageHandler_peer_connected"))) TS_ChannelMessageHandler_peer_connected(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
9612         void* this_arg_ptr = untag_ptr(this_arg);
9613         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9614         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9615         LDKPublicKey their_node_id_ref;
9616         CHECK(their_node_id->arr_len == 33);
9617         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9618         LDKInit msg_conv;
9619         msg_conv.inner = untag_ptr(msg);
9620         msg_conv.is_owned = ptr_is_owned(msg);
9621         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9622         msg_conv.is_owned = false;
9623         (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9624 }
9625
9626 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) {
9627         void* this_arg_ptr = untag_ptr(this_arg);
9628         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9629         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9630         LDKPublicKey their_node_id_ref;
9631         CHECK(their_node_id->arr_len == 33);
9632         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9633         LDKChannelReestablish msg_conv;
9634         msg_conv.inner = untag_ptr(msg);
9635         msg_conv.is_owned = ptr_is_owned(msg);
9636         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9637         msg_conv.is_owned = false;
9638         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9639 }
9640
9641 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) {
9642         void* this_arg_ptr = untag_ptr(this_arg);
9643         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9644         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9645         LDKPublicKey their_node_id_ref;
9646         CHECK(their_node_id->arr_len == 33);
9647         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9648         LDKChannelUpdate msg_conv;
9649         msg_conv.inner = untag_ptr(msg);
9650         msg_conv.is_owned = ptr_is_owned(msg);
9651         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9652         msg_conv.is_owned = false;
9653         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9654 }
9655
9656 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_error"))) TS_ChannelMessageHandler_handle_error(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
9657         void* this_arg_ptr = untag_ptr(this_arg);
9658         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9659         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9660         LDKPublicKey their_node_id_ref;
9661         CHECK(their_node_id->arr_len == 33);
9662         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9663         LDKErrorMessage msg_conv;
9664         msg_conv.inner = untag_ptr(msg);
9665         msg_conv.is_owned = ptr_is_owned(msg);
9666         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9667         msg_conv.is_owned = false;
9668         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
9669 }
9670
9671 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_node_features"))) TS_ChannelMessageHandler_provided_node_features(uint64_t this_arg) {
9672         void* this_arg_ptr = untag_ptr(this_arg);
9673         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9674         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9675         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
9676         uint64_t ret_ref = 0;
9677         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9678         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9679         return ret_ref;
9680 }
9681
9682 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_init_features"))) TS_ChannelMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
9683         void* this_arg_ptr = untag_ptr(this_arg);
9684         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9685         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
9686         LDKPublicKey their_node_id_ref;
9687         CHECK(their_node_id->arr_len == 33);
9688         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9689         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
9690         uint64_t ret_ref = 0;
9691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9693         return ret_ref;
9694 }
9695
9696 typedef struct LDKRoutingMessageHandler_JCalls {
9697         atomic_size_t refcnt;
9698         uint32_t instance_ptr;
9699         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
9700 } LDKRoutingMessageHandler_JCalls;
9701 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
9702         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9703         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9704                 FREE(j_calls);
9705         }
9706 }
9707 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
9708         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9709         LDKNodeAnnouncement msg_var = *msg;
9710         uint64_t msg_ref = 0;
9711         msg_var = NodeAnnouncement_clone(&msg_var);
9712         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9713         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9714         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 82, msg_ref, 0, 0, 0, 0, 0);
9715         void* ret_ptr = untag_ptr(ret);
9716         CHECK_ACCESS(ret_ptr);
9717         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9718         FREE(untag_ptr(ret));
9719         return ret_conv;
9720 }
9721 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
9722         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9723         LDKChannelAnnouncement msg_var = *msg;
9724         uint64_t msg_ref = 0;
9725         msg_var = ChannelAnnouncement_clone(&msg_var);
9726         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9727         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9728         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 83, msg_ref, 0, 0, 0, 0, 0);
9729         void* ret_ptr = untag_ptr(ret);
9730         CHECK_ACCESS(ret_ptr);
9731         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9732         FREE(untag_ptr(ret));
9733         return ret_conv;
9734 }
9735 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
9736         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9737         LDKChannelUpdate msg_var = *msg;
9738         uint64_t msg_ref = 0;
9739         msg_var = ChannelUpdate_clone(&msg_var);
9740         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9741         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9742         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 84, msg_ref, 0, 0, 0, 0, 0);
9743         void* ret_ptr = untag_ptr(ret);
9744         CHECK_ACCESS(ret_ptr);
9745         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
9746         FREE(untag_ptr(ret));
9747         return ret_conv;
9748 }
9749 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
9750         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9751         int64_t starting_point_conv = starting_point;
9752         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 85, starting_point_conv, 0, 0, 0, 0, 0);
9753         void* ret_ptr = untag_ptr(ret);
9754         CHECK_ACCESS(ret_ptr);
9755         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
9756         FREE(untag_ptr(ret));
9757         return ret_conv;
9758 }
9759 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point) {
9760         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9761         int8_tArray starting_point_arr = init_int8_tArray(33, __LINE__);
9762         memcpy(starting_point_arr->elems, starting_point.compressed_form, 33);
9763         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 86, (uint32_t)starting_point_arr, 0, 0, 0, 0, 0);
9764         LDKNodeAnnouncement ret_conv;
9765         ret_conv.inner = untag_ptr(ret);
9766         ret_conv.is_owned = ptr_is_owned(ret);
9767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
9768         return ret_conv;
9769 }
9770 void peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
9771         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9772         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9773         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9774         LDKInit init_var = *init;
9775         uint64_t init_ref = 0;
9776         init_var = Init_clone(&init_var);
9777         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
9778         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
9779         js_invoke_function_ubuuuu(j_calls->instance_ptr, 87, (uint32_t)their_node_id_arr, init_ref, 0, 0, 0, 0);
9780 }
9781 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
9782         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9783         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9784         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9785         LDKReplyChannelRange msg_var = msg;
9786         uint64_t msg_ref = 0;
9787         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9788         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9789         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 88, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9790         void* ret_ptr = untag_ptr(ret);
9791         CHECK_ACCESS(ret_ptr);
9792         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9793         FREE(untag_ptr(ret));
9794         return ret_conv;
9795 }
9796 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
9797         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9798         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9799         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9800         LDKReplyShortChannelIdsEnd msg_var = msg;
9801         uint64_t msg_ref = 0;
9802         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9803         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9804         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 89, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9805         void* ret_ptr = untag_ptr(ret);
9806         CHECK_ACCESS(ret_ptr);
9807         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9808         FREE(untag_ptr(ret));
9809         return ret_conv;
9810 }
9811 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
9812         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9813         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9814         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9815         LDKQueryChannelRange msg_var = msg;
9816         uint64_t msg_ref = 0;
9817         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9818         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9819         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 90, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9820         void* ret_ptr = untag_ptr(ret);
9821         CHECK_ACCESS(ret_ptr);
9822         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9823         FREE(untag_ptr(ret));
9824         return ret_conv;
9825 }
9826 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
9827         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9828         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9829         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9830         LDKQueryShortChannelIds msg_var = msg;
9831         uint64_t msg_ref = 0;
9832         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
9833         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
9834         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 91, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
9835         void* ret_ptr = untag_ptr(ret);
9836         CHECK_ACCESS(ret_ptr);
9837         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
9838         FREE(untag_ptr(ret));
9839         return ret_conv;
9840 }
9841 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
9842         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9843         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 92, 0, 0, 0, 0, 0, 0);
9844         LDKNodeFeatures ret_conv;
9845         ret_conv.inner = untag_ptr(ret);
9846         ret_conv.is_owned = ptr_is_owned(ret);
9847         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
9848         return ret_conv;
9849 }
9850 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
9851         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
9852         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
9853         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
9854         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 93, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
9855         LDKInitFeatures ret_conv;
9856         ret_conv.inner = untag_ptr(ret);
9857         ret_conv.is_owned = ptr_is_owned(ret);
9858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
9859         return ret_conv;
9860 }
9861 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
9862         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
9863         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9864         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
9865 }
9866 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
9867         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
9868         atomic_init(&calls->refcnt, 1);
9869         calls->instance_ptr = o;
9870
9871         LDKRoutingMessageHandler ret = {
9872                 .this_arg = (void*) calls,
9873                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
9874                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
9875                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
9876                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
9877                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
9878                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
9879                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
9880                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
9881                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
9882                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
9883                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
9884                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
9885                 .free = LDKRoutingMessageHandler_JCalls_free,
9886                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
9887         };
9888         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
9889         return ret;
9890 }
9891 uint64_t  __attribute__((export_name("TS_LDKRoutingMessageHandler_new"))) TS_LDKRoutingMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
9892         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
9893         *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
9894         return tag_ptr(res_ptr, true);
9895 }
9896 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_node_announcement"))) TS_RoutingMessageHandler_handle_node_announcement(uint64_t this_arg, uint64_t msg) {
9897         void* this_arg_ptr = untag_ptr(this_arg);
9898         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9899         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9900         LDKNodeAnnouncement msg_conv;
9901         msg_conv.inner = untag_ptr(msg);
9902         msg_conv.is_owned = ptr_is_owned(msg);
9903         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9904         msg_conv.is_owned = false;
9905         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9906         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
9907         return tag_ptr(ret_conv, true);
9908 }
9909
9910 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_announcement"))) TS_RoutingMessageHandler_handle_channel_announcement(uint64_t this_arg, uint64_t msg) {
9911         void* this_arg_ptr = untag_ptr(this_arg);
9912         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9913         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9914         LDKChannelAnnouncement msg_conv;
9915         msg_conv.inner = untag_ptr(msg);
9916         msg_conv.is_owned = ptr_is_owned(msg);
9917         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9918         msg_conv.is_owned = false;
9919         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9920         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
9921         return tag_ptr(ret_conv, true);
9922 }
9923
9924 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_update"))) TS_RoutingMessageHandler_handle_channel_update(uint64_t this_arg, uint64_t msg) {
9925         void* this_arg_ptr = untag_ptr(this_arg);
9926         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9927         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9928         LDKChannelUpdate 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         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
9934         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
9935         return tag_ptr(ret_conv, true);
9936 }
9937
9938 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) {
9939         void* this_arg_ptr = untag_ptr(this_arg);
9940         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9941         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9942         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
9943         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
9944         uint64_t ret_ref = tag_ptr(ret_copy, true);
9945         return ret_ref;
9946 }
9947
9948 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) {
9949         void* this_arg_ptr = untag_ptr(this_arg);
9950         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9951         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9952         LDKPublicKey starting_point_ref;
9953         CHECK(starting_point->arr_len == 33);
9954         memcpy(starting_point_ref.compressed_form, starting_point->elems, 33); FREE(starting_point);
9955         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_ref);
9956         uint64_t ret_ref = 0;
9957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9959         return ret_ref;
9960 }
9961
9962 void  __attribute__((export_name("TS_RoutingMessageHandler_peer_connected"))) TS_RoutingMessageHandler_peer_connected(uint64_t this_arg, int8_tArray their_node_id, uint64_t init) {
9963         void* this_arg_ptr = untag_ptr(this_arg);
9964         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9965         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9966         LDKPublicKey their_node_id_ref;
9967         CHECK(their_node_id->arr_len == 33);
9968         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9969         LDKInit init_conv;
9970         init_conv.inner = untag_ptr(init);
9971         init_conv.is_owned = ptr_is_owned(init);
9972         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
9973         init_conv.is_owned = false;
9974         (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
9975 }
9976
9977 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) {
9978         void* this_arg_ptr = untag_ptr(this_arg);
9979         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9980         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9981         LDKPublicKey their_node_id_ref;
9982         CHECK(their_node_id->arr_len == 33);
9983         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
9984         LDKReplyChannelRange msg_conv;
9985         msg_conv.inner = untag_ptr(msg);
9986         msg_conv.is_owned = ptr_is_owned(msg);
9987         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
9988         msg_conv = ReplyChannelRange_clone(&msg_conv);
9989         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
9990         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
9991         return tag_ptr(ret_conv, true);
9992 }
9993
9994 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) {
9995         void* this_arg_ptr = untag_ptr(this_arg);
9996         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9997         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
9998         LDKPublicKey their_node_id_ref;
9999         CHECK(their_node_id->arr_len == 33);
10000         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10001         LDKReplyShortChannelIdsEnd msg_conv;
10002         msg_conv.inner = untag_ptr(msg);
10003         msg_conv.is_owned = ptr_is_owned(msg);
10004         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10005         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
10006         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10007         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10008         return tag_ptr(ret_conv, true);
10009 }
10010
10011 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) {
10012         void* this_arg_ptr = untag_ptr(this_arg);
10013         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10014         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10015         LDKPublicKey their_node_id_ref;
10016         CHECK(their_node_id->arr_len == 33);
10017         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10018         LDKQueryChannelRange msg_conv;
10019         msg_conv.inner = untag_ptr(msg);
10020         msg_conv.is_owned = ptr_is_owned(msg);
10021         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10022         msg_conv = QueryChannelRange_clone(&msg_conv);
10023         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10024         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10025         return tag_ptr(ret_conv, true);
10026 }
10027
10028 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) {
10029         void* this_arg_ptr = untag_ptr(this_arg);
10030         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10031         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10032         LDKPublicKey their_node_id_ref;
10033         CHECK(their_node_id->arr_len == 33);
10034         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10035         LDKQueryShortChannelIds msg_conv;
10036         msg_conv.inner = untag_ptr(msg);
10037         msg_conv.is_owned = ptr_is_owned(msg);
10038         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10039         msg_conv = QueryShortChannelIds_clone(&msg_conv);
10040         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10041         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
10042         return tag_ptr(ret_conv, true);
10043 }
10044
10045 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_node_features"))) TS_RoutingMessageHandler_provided_node_features(uint64_t this_arg) {
10046         void* this_arg_ptr = untag_ptr(this_arg);
10047         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10048         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10049         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
10050         uint64_t ret_ref = 0;
10051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10053         return ret_ref;
10054 }
10055
10056 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_init_features"))) TS_RoutingMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
10057         void* this_arg_ptr = untag_ptr(this_arg);
10058         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10059         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
10060         LDKPublicKey their_node_id_ref;
10061         CHECK(their_node_id->arr_len == 33);
10062         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10063         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
10064         uint64_t ret_ref = 0;
10065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10067         return ret_ref;
10068 }
10069
10070 typedef struct LDKOnionMessageHandler_JCalls {
10071         atomic_size_t refcnt;
10072         uint32_t instance_ptr;
10073         LDKOnionMessageProvider_JCalls* OnionMessageProvider;
10074 } LDKOnionMessageHandler_JCalls;
10075 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
10076         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10077         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10078                 FREE(j_calls);
10079         }
10080 }
10081 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
10082         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10083         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
10084         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
10085         LDKOnionMessage msg_var = *msg;
10086         uint64_t msg_ref = 0;
10087         msg_var = OnionMessage_clone(&msg_var);
10088         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
10089         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
10090         js_invoke_function_ubuuuu(j_calls->instance_ptr, 94, (uint32_t)peer_node_id_arr, msg_ref, 0, 0, 0, 0);
10091 }
10092 void peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
10093         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10094         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10095         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10096         LDKInit init_var = *init;
10097         uint64_t init_ref = 0;
10098         init_var = Init_clone(&init_var);
10099         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
10100         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
10101         js_invoke_function_ubuuuu(j_calls->instance_ptr, 95, (uint32_t)their_node_id_arr, init_ref, 0, 0, 0, 0);
10102 }
10103 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
10104         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10105         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10106         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10107         jboolean no_connection_possible_conv = no_connection_possible;
10108         js_invoke_function_uuuuuu(j_calls->instance_ptr, 96, (uint32_t)their_node_id_arr, no_connection_possible_conv, 0, 0, 0, 0);
10109 }
10110 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
10111         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10112         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 97, 0, 0, 0, 0, 0, 0);
10113         LDKNodeFeatures ret_conv;
10114         ret_conv.inner = untag_ptr(ret);
10115         ret_conv.is_owned = ptr_is_owned(ret);
10116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10117         return ret_conv;
10118 }
10119 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
10120         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
10121         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
10122         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
10123         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 98, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
10124         LDKInitFeatures ret_conv;
10125         ret_conv.inner = untag_ptr(ret);
10126         ret_conv.is_owned = ptr_is_owned(ret);
10127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
10128         return ret_conv;
10129 }
10130 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
10131         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
10132         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10133         atomic_fetch_add_explicit(&j_calls->OnionMessageProvider->refcnt, 1, memory_order_release);
10134 }
10135 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JSValue o, JSValue OnionMessageProvider) {
10136         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
10137         atomic_init(&calls->refcnt, 1);
10138         calls->instance_ptr = o;
10139
10140         LDKOnionMessageHandler ret = {
10141                 .this_arg = (void*) calls,
10142                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
10143                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
10144                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
10145                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
10146                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
10147                 .free = LDKOnionMessageHandler_JCalls_free,
10148                 .OnionMessageProvider = LDKOnionMessageProvider_init(OnionMessageProvider),
10149         };
10150         calls->OnionMessageProvider = ret.OnionMessageProvider.this_arg;
10151         return ret;
10152 }
10153 uint64_t  __attribute__((export_name("TS_LDKOnionMessageHandler_new"))) TS_LDKOnionMessageHandler_new(JSValue o, JSValue OnionMessageProvider) {
10154         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
10155         *res_ptr = LDKOnionMessageHandler_init(o, OnionMessageProvider);
10156         return tag_ptr(res_ptr, true);
10157 }
10158 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) {
10159         void* this_arg_ptr = untag_ptr(this_arg);
10160         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10161         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
10162         LDKPublicKey peer_node_id_ref;
10163         CHECK(peer_node_id->arr_len == 33);
10164         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
10165         LDKOnionMessage msg_conv;
10166         msg_conv.inner = untag_ptr(msg);
10167         msg_conv.is_owned = ptr_is_owned(msg);
10168         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
10169         msg_conv.is_owned = false;
10170         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
10171 }
10172
10173 void  __attribute__((export_name("TS_OnionMessageHandler_peer_connected"))) TS_OnionMessageHandler_peer_connected(uint64_t this_arg, int8_tArray their_node_id, uint64_t init) {
10174         void* this_arg_ptr = untag_ptr(this_arg);
10175         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10176         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
10177         LDKPublicKey their_node_id_ref;
10178         CHECK(their_node_id->arr_len == 33);
10179         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10180         LDKInit init_conv;
10181         init_conv.inner = untag_ptr(init);
10182         init_conv.is_owned = ptr_is_owned(init);
10183         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
10184         init_conv.is_owned = false;
10185         (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
10186 }
10187
10188 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) {
10189         void* this_arg_ptr = untag_ptr(this_arg);
10190         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10191         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
10192         LDKPublicKey their_node_id_ref;
10193         CHECK(their_node_id->arr_len == 33);
10194         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10195         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
10196 }
10197
10198 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_node_features"))) TS_OnionMessageHandler_provided_node_features(uint64_t this_arg) {
10199         void* this_arg_ptr = untag_ptr(this_arg);
10200         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10201         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
10202         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
10203         uint64_t ret_ref = 0;
10204         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10205         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10206         return ret_ref;
10207 }
10208
10209 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_init_features"))) TS_OnionMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
10210         void* this_arg_ptr = untag_ptr(this_arg);
10211         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10212         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
10213         LDKPublicKey their_node_id_ref;
10214         CHECK(their_node_id->arr_len == 33);
10215         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
10216         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
10217         uint64_t ret_ref = 0;
10218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10220         return ret_ref;
10221 }
10222
10223 typedef struct LDKCustomMessageReader_JCalls {
10224         atomic_size_t refcnt;
10225         uint32_t instance_ptr;
10226 } LDKCustomMessageReader_JCalls;
10227 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
10228         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
10229         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10230                 FREE(j_calls);
10231         }
10232 }
10233 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
10234         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
10235         int16_t message_type_conv = message_type;
10236         LDKu8slice buffer_var = buffer;
10237         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
10238         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
10239         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 99, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
10240         void* ret_ptr = untag_ptr(ret);
10241         CHECK_ACCESS(ret_ptr);
10242         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
10243         FREE(untag_ptr(ret));
10244         return ret_conv;
10245 }
10246 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
10247         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
10248         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10249 }
10250 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JSValue o) {
10251         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
10252         atomic_init(&calls->refcnt, 1);
10253         calls->instance_ptr = o;
10254
10255         LDKCustomMessageReader ret = {
10256                 .this_arg = (void*) calls,
10257                 .read = read_LDKCustomMessageReader_jcall,
10258                 .free = LDKCustomMessageReader_JCalls_free,
10259         };
10260         return ret;
10261 }
10262 uint64_t  __attribute__((export_name("TS_LDKCustomMessageReader_new"))) TS_LDKCustomMessageReader_new(JSValue o) {
10263         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
10264         *res_ptr = LDKCustomMessageReader_init(o);
10265         return tag_ptr(res_ptr, true);
10266 }
10267 uint64_t  __attribute__((export_name("TS_CustomMessageReader_read"))) TS_CustomMessageReader_read(uint64_t this_arg, int16_t message_type, int8_tArray buffer) {
10268         void* this_arg_ptr = untag_ptr(this_arg);
10269         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10270         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
10271         LDKu8slice buffer_ref;
10272         buffer_ref.datalen = buffer->arr_len;
10273         buffer_ref.data = buffer->elems;
10274         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
10275         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
10276         FREE(buffer);
10277         return tag_ptr(ret_conv, true);
10278 }
10279
10280 typedef struct LDKCustomMessageHandler_JCalls {
10281         atomic_size_t refcnt;
10282         uint32_t instance_ptr;
10283         LDKCustomMessageReader_JCalls* CustomMessageReader;
10284 } LDKCustomMessageHandler_JCalls;
10285 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
10286         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10287         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10288                 FREE(j_calls);
10289         }
10290 }
10291 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
10292         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10293         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
10294         *msg_ret = msg;
10295         int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__);
10296         memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
10297         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 100, tag_ptr(msg_ret, true), (uint32_t)sender_node_id_arr, 0, 0, 0, 0);
10298         void* ret_ptr = untag_ptr(ret);
10299         CHECK_ACCESS(ret_ptr);
10300         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
10301         FREE(untag_ptr(ret));
10302         return ret_conv;
10303 }
10304 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
10305         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
10306         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 101, 0, 0, 0, 0, 0, 0);
10307         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
10308         ret_constr.datalen = ret->arr_len;
10309         if (ret_constr.datalen > 0)
10310                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
10311         else
10312                 ret_constr.data = NULL;
10313         uint64_t* ret_vals = ret->elems;
10314         for (size_t z = 0; z < ret_constr.datalen; z++) {
10315                 uint64_t ret_conv_25 = ret_vals[z];
10316                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
10317                 CHECK_ACCESS(ret_conv_25_ptr);
10318                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
10319                 FREE(untag_ptr(ret_conv_25));
10320                 ret_constr.data[z] = ret_conv_25_conv;
10321         }
10322         FREE(ret);
10323         return ret_constr;
10324 }
10325 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
10326         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
10327         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10328         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
10329 }
10330 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JSValue o, JSValue CustomMessageReader) {
10331         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
10332         atomic_init(&calls->refcnt, 1);
10333         calls->instance_ptr = o;
10334
10335         LDKCustomMessageHandler ret = {
10336                 .this_arg = (void*) calls,
10337                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
10338                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
10339                 .free = LDKCustomMessageHandler_JCalls_free,
10340                 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
10341         };
10342         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
10343         return ret;
10344 }
10345 uint64_t  __attribute__((export_name("TS_LDKCustomMessageHandler_new"))) TS_LDKCustomMessageHandler_new(JSValue o, JSValue CustomMessageReader) {
10346         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
10347         *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
10348         return tag_ptr(res_ptr, true);
10349 }
10350 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) {
10351         void* this_arg_ptr = untag_ptr(this_arg);
10352         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10353         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
10354         void* msg_ptr = untag_ptr(msg);
10355         CHECK_ACCESS(msg_ptr);
10356         LDKType msg_conv = *(LDKType*)(msg_ptr);
10357         if (msg_conv.free == LDKType_JCalls_free) {
10358                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10359                 LDKType_JCalls_cloned(&msg_conv);
10360         }
10361         LDKPublicKey sender_node_id_ref;
10362         CHECK(sender_node_id->arr_len == 33);
10363         memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33); FREE(sender_node_id);
10364         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
10365         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
10366         return tag_ptr(ret_conv, true);
10367 }
10368
10369 uint64_tArray  __attribute__((export_name("TS_CustomMessageHandler_get_and_clear_pending_msg"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint64_t this_arg) {
10370         void* this_arg_ptr = untag_ptr(this_arg);
10371         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10372         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
10373         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
10374         uint64_tArray ret_arr = NULL;
10375         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
10376         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
10377         for (size_t z = 0; z < ret_var.datalen; z++) {
10378                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
10379                 *ret_conv_25_conv = ret_var.data[z];
10380                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
10381         }
10382         
10383         FREE(ret_var.data);
10384         return ret_arr;
10385 }
10386
10387 typedef struct LDKSocketDescriptor_JCalls {
10388         atomic_size_t refcnt;
10389         uint32_t instance_ptr;
10390 } LDKSocketDescriptor_JCalls;
10391 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
10392         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10393         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10394                 FREE(j_calls);
10395         }
10396 }
10397 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
10398         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10399         LDKu8slice data_var = data;
10400         int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__);
10401         memcpy(data_arr->elems, data_var.data, data_var.datalen);
10402         jboolean resume_read_conv = resume_read;
10403         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 102, (uint32_t)data_arr, resume_read_conv, 0, 0, 0, 0);
10404 }
10405 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
10406         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10407         js_invoke_function_uuuuuu(j_calls->instance_ptr, 103, 0, 0, 0, 0, 0, 0);
10408 }
10409 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
10410         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10411         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
10412         *other_arg_clone = SocketDescriptor_clone(other_arg);
10413         return js_invoke_function_buuuuu(j_calls->instance_ptr, 104, tag_ptr(other_arg_clone, true), 0, 0, 0, 0, 0);
10414 }
10415 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
10416         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
10417         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 105, 0, 0, 0, 0, 0, 0);
10418 }
10419 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
10420         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
10421         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10422 }
10423 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JSValue o) {
10424         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
10425         atomic_init(&calls->refcnt, 1);
10426         calls->instance_ptr = o;
10427
10428         LDKSocketDescriptor ret = {
10429                 .this_arg = (void*) calls,
10430                 .send_data = send_data_LDKSocketDescriptor_jcall,
10431                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
10432                 .eq = eq_LDKSocketDescriptor_jcall,
10433                 .hash = hash_LDKSocketDescriptor_jcall,
10434                 .cloned = LDKSocketDescriptor_JCalls_cloned,
10435                 .free = LDKSocketDescriptor_JCalls_free,
10436         };
10437         return ret;
10438 }
10439 uint64_t  __attribute__((export_name("TS_LDKSocketDescriptor_new"))) TS_LDKSocketDescriptor_new(JSValue o) {
10440         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
10441         *res_ptr = LDKSocketDescriptor_init(o);
10442         return tag_ptr(res_ptr, true);
10443 }
10444 uint32_t  __attribute__((export_name("TS_SocketDescriptor_send_data"))) TS_SocketDescriptor_send_data(uint64_t this_arg, int8_tArray data, jboolean resume_read) {
10445         void* this_arg_ptr = untag_ptr(this_arg);
10446         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10447         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10448         LDKu8slice data_ref;
10449         data_ref.datalen = data->arr_len;
10450         data_ref.data = data->elems;
10451         uint32_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
10452         FREE(data);
10453         return ret_conv;
10454 }
10455
10456 void  __attribute__((export_name("TS_SocketDescriptor_disconnect_socket"))) TS_SocketDescriptor_disconnect_socket(uint64_t this_arg) {
10457         void* this_arg_ptr = untag_ptr(this_arg);
10458         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10459         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10460         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
10461 }
10462
10463 int64_t  __attribute__((export_name("TS_SocketDescriptor_hash"))) TS_SocketDescriptor_hash(uint64_t this_arg) {
10464         void* this_arg_ptr = untag_ptr(this_arg);
10465         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10466         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
10467         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
10468         return ret_conv;
10469 }
10470
10471 uint32_t __attribute__((export_name("TS_LDKEffectiveCapacity_ty_from_ptr"))) TS_LDKEffectiveCapacity_ty_from_ptr(uint64_t ptr) {
10472         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
10473         switch(obj->tag) {
10474                 case LDKEffectiveCapacity_ExactLiquidity: return 0;
10475                 case LDKEffectiveCapacity_MaximumHTLC: return 1;
10476                 case LDKEffectiveCapacity_Total: return 2;
10477                 case LDKEffectiveCapacity_Infinite: return 3;
10478                 case LDKEffectiveCapacity_Unknown: return 4;
10479                 default: abort();
10480         }
10481 }
10482 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat"))) TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(uint64_t ptr) {
10483         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
10484         assert(obj->tag == LDKEffectiveCapacity_ExactLiquidity);
10485                         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
10486         return liquidity_msat_conv;
10487 }
10488 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_MaximumHTLC_get_amount_msat(uint64_t ptr) {
10489         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
10490         assert(obj->tag == LDKEffectiveCapacity_MaximumHTLC);
10491                         int64_t amount_msat_conv = obj->maximum_htlc.amount_msat;
10492         return amount_msat_conv;
10493 }
10494 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_capacity_msat"))) TS_LDKEffectiveCapacity_Total_get_capacity_msat(uint64_t ptr) {
10495         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
10496         assert(obj->tag == LDKEffectiveCapacity_Total);
10497                         int64_t capacity_msat_conv = obj->total.capacity_msat;
10498         return capacity_msat_conv;
10499 }
10500 uint64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat"))) TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat(uint64_t ptr) {
10501         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
10502         assert(obj->tag == LDKEffectiveCapacity_Total);
10503                         uint64_t htlc_maximum_msat_ref = tag_ptr(&obj->total.htlc_maximum_msat, false);
10504         return htlc_maximum_msat_ref;
10505 }
10506 uint32_t __attribute__((export_name("TS_LDKDestination_ty_from_ptr"))) TS_LDKDestination_ty_from_ptr(uint64_t ptr) {
10507         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
10508         switch(obj->tag) {
10509                 case LDKDestination_Node: return 0;
10510                 case LDKDestination_BlindedRoute: return 1;
10511                 default: abort();
10512         }
10513 }
10514 int8_tArray __attribute__((export_name("TS_LDKDestination_Node_get_node"))) TS_LDKDestination_Node_get_node(uint64_t ptr) {
10515         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
10516         assert(obj->tag == LDKDestination_Node);
10517                         int8_tArray node_arr = init_int8_tArray(33, __LINE__);
10518                         memcpy(node_arr->elems, obj->node.compressed_form, 33);
10519         return node_arr;
10520 }
10521 uint64_t __attribute__((export_name("TS_LDKDestination_BlindedRoute_get_blinded_route"))) TS_LDKDestination_BlindedRoute_get_blinded_route(uint64_t ptr) {
10522         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
10523         assert(obj->tag == LDKDestination_BlindedRoute);
10524                         LDKBlindedRoute blinded_route_var = obj->blinded_route;
10525                         uint64_t blinded_route_ref = 0;
10526                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_route_var);
10527                         blinded_route_ref = tag_ptr(blinded_route_var.inner, false);
10528         return blinded_route_ref;
10529 }
10530 uint32_t __attribute__((export_name("TS_LDKFallback_ty_from_ptr"))) TS_LDKFallback_ty_from_ptr(uint64_t ptr) {
10531         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
10532         switch(obj->tag) {
10533                 case LDKFallback_SegWitProgram: return 0;
10534                 case LDKFallback_PubKeyHash: return 1;
10535                 case LDKFallback_ScriptHash: return 2;
10536                 default: abort();
10537         }
10538 }
10539 int8_t __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_version"))) TS_LDKFallback_SegWitProgram_get_version(uint64_t ptr) {
10540         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
10541         assert(obj->tag == LDKFallback_SegWitProgram);
10542                         uint8_t version_val = obj->seg_wit_program.version._0;
10543         return version_val;
10544 }
10545 int8_tArray __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_program"))) TS_LDKFallback_SegWitProgram_get_program(uint64_t ptr) {
10546         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
10547         assert(obj->tag == LDKFallback_SegWitProgram);
10548                         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
10549                         int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__);
10550                         memcpy(program_arr->elems, program_var.data, program_var.datalen);
10551         return program_arr;
10552 }
10553 int8_tArray __attribute__((export_name("TS_LDKFallback_PubKeyHash_get_pub_key_hash"))) TS_LDKFallback_PubKeyHash_get_pub_key_hash(uint64_t ptr) {
10554         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
10555         assert(obj->tag == LDKFallback_PubKeyHash);
10556                         int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__);
10557                         memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20);
10558         return pub_key_hash_arr;
10559 }
10560 int8_tArray __attribute__((export_name("TS_LDKFallback_ScriptHash_get_script_hash"))) TS_LDKFallback_ScriptHash_get_script_hash(uint64_t ptr) {
10561         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
10562         assert(obj->tag == LDKFallback_ScriptHash);
10563                         int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__);
10564                         memcpy(script_hash_arr->elems, obj->script_hash.data, 20);
10565         return script_hash_arr;
10566 }
10567 typedef struct LDKPayer_JCalls {
10568         atomic_size_t refcnt;
10569         uint32_t instance_ptr;
10570 } LDKPayer_JCalls;
10571 static void LDKPayer_JCalls_free(void* this_arg) {
10572         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10573         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10574                 FREE(j_calls);
10575         }
10576 }
10577 LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) {
10578         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10579         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 106, 0, 0, 0, 0, 0, 0);
10580         LDKPublicKey ret_ref;
10581         CHECK(ret->arr_len == 33);
10582         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
10583         return ret_ref;
10584 }
10585 LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) {
10586         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10587         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 107, 0, 0, 0, 0, 0, 0);
10588         LDKCVec_ChannelDetailsZ ret_constr;
10589         ret_constr.datalen = ret->arr_len;
10590         if (ret_constr.datalen > 0)
10591                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
10592         else
10593                 ret_constr.data = NULL;
10594         uint64_t* ret_vals = ret->elems;
10595         for (size_t q = 0; q < ret_constr.datalen; q++) {
10596                 uint64_t ret_conv_16 = ret_vals[q];
10597                 LDKChannelDetails ret_conv_16_conv;
10598                 ret_conv_16_conv.inner = untag_ptr(ret_conv_16);
10599                 ret_conv_16_conv.is_owned = ptr_is_owned(ret_conv_16);
10600                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv);
10601                 ret_constr.data[q] = ret_conv_16_conv;
10602         }
10603         FREE(ret);
10604         return ret_constr;
10605 }
10606 LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret) {
10607         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10608         LDKRoute route_var = *route;
10609         uint64_t route_ref = 0;
10610         route_var = Route_clone(&route_var);
10611         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
10612         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
10613         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10614         memcpy(payment_hash_arr->elems, payment_hash.data, 32);
10615         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
10616         memcpy(payment_secret_arr->elems, payment_secret.data, 32);
10617         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 108, route_ref, (uint32_t)payment_hash_arr, (uint32_t)payment_secret_arr, 0, 0, 0);
10618         void* ret_ptr = untag_ptr(ret);
10619         CHECK_ACCESS(ret_ptr);
10620         LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
10621         FREE(untag_ptr(ret));
10622         return ret_conv;
10623 }
10624 LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage) {
10625         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10626         LDKRoute route_var = *route;
10627         uint64_t route_ref = 0;
10628         route_var = Route_clone(&route_var);
10629         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
10630         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
10631         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
10632         memcpy(payment_preimage_arr->elems, payment_preimage.data, 32);
10633         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 109, route_ref, (uint32_t)payment_preimage_arr, 0, 0, 0, 0);
10634         void* ret_ptr = untag_ptr(ret);
10635         CHECK_ACCESS(ret_ptr);
10636         LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr);
10637         FREE(untag_ptr(ret));
10638         return ret_conv;
10639 }
10640 LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) {
10641         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10642         LDKRoute route_var = *route;
10643         uint64_t route_ref = 0;
10644         route_var = Route_clone(&route_var);
10645         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var);
10646         route_ref = tag_ptr(route_var.inner, route_var.is_owned);
10647         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
10648         memcpy(payment_id_arr->elems, payment_id.data, 32);
10649         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 110, route_ref, (uint32_t)payment_id_arr, 0, 0, 0, 0);
10650         void* ret_ptr = untag_ptr(ret);
10651         CHECK_ACCESS(ret_ptr);
10652         LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr);
10653         FREE(untag_ptr(ret));
10654         return ret_conv;
10655 }
10656 void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) {
10657         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg;
10658         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
10659         memcpy(payment_id_arr->elems, payment_id.data, 32);
10660         js_invoke_function_uuuuuu(j_calls->instance_ptr, 111, (uint32_t)payment_id_arr, 0, 0, 0, 0, 0);
10661 }
10662 static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) {
10663         LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg;
10664         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10665 }
10666 static inline LDKPayer LDKPayer_init (JSValue o) {
10667         LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls");
10668         atomic_init(&calls->refcnt, 1);
10669         calls->instance_ptr = o;
10670
10671         LDKPayer ret = {
10672                 .this_arg = (void*) calls,
10673                 .node_id = node_id_LDKPayer_jcall,
10674                 .first_hops = first_hops_LDKPayer_jcall,
10675                 .send_payment = send_payment_LDKPayer_jcall,
10676                 .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall,
10677                 .retry_payment = retry_payment_LDKPayer_jcall,
10678                 .abandon_payment = abandon_payment_LDKPayer_jcall,
10679                 .free = LDKPayer_JCalls_free,
10680         };
10681         return ret;
10682 }
10683 uint64_t  __attribute__((export_name("TS_LDKPayer_new"))) TS_LDKPayer_new(JSValue o) {
10684         LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer");
10685         *res_ptr = LDKPayer_init(o);
10686         return tag_ptr(res_ptr, true);
10687 }
10688 int8_tArray  __attribute__((export_name("TS_Payer_node_id"))) TS_Payer_node_id(uint64_t this_arg) {
10689         void* this_arg_ptr = untag_ptr(this_arg);
10690         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10691         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10692         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
10693         memcpy(ret_arr->elems, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form, 33);
10694         return ret_arr;
10695 }
10696
10697 uint64_tArray  __attribute__((export_name("TS_Payer_first_hops"))) TS_Payer_first_hops(uint64_t this_arg) {
10698         void* this_arg_ptr = untag_ptr(this_arg);
10699         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10700         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10701         LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg);
10702         uint64_tArray ret_arr = NULL;
10703         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
10704         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
10705         for (size_t q = 0; q < ret_var.datalen; q++) {
10706                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
10707                 uint64_t ret_conv_16_ref = 0;
10708                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
10709                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
10710                 ret_arr_ptr[q] = ret_conv_16_ref;
10711         }
10712         
10713         FREE(ret_var.data);
10714         return ret_arr;
10715 }
10716
10717 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) {
10718         void* this_arg_ptr = untag_ptr(this_arg);
10719         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10720         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10721         LDKRoute route_conv;
10722         route_conv.inner = untag_ptr(route);
10723         route_conv.is_owned = ptr_is_owned(route);
10724         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
10725         route_conv.is_owned = false;
10726         LDKThirtyTwoBytes payment_hash_ref;
10727         CHECK(payment_hash->arr_len == 32);
10728         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
10729         LDKThirtyTwoBytes payment_secret_ref;
10730         CHECK(payment_secret->arr_len == 32);
10731         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
10732         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
10733         *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref);
10734         return tag_ptr(ret_conv, true);
10735 }
10736
10737 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) {
10738         void* this_arg_ptr = untag_ptr(this_arg);
10739         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10740         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10741         LDKRoute route_conv;
10742         route_conv.inner = untag_ptr(route);
10743         route_conv.is_owned = ptr_is_owned(route);
10744         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
10745         route_conv.is_owned = false;
10746         LDKThirtyTwoBytes payment_preimage_ref;
10747         CHECK(payment_preimage->arr_len == 32);
10748         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
10749         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
10750         *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref);
10751         return tag_ptr(ret_conv, true);
10752 }
10753
10754 uint64_t  __attribute__((export_name("TS_Payer_retry_payment"))) TS_Payer_retry_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_id) {
10755         void* this_arg_ptr = untag_ptr(this_arg);
10756         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10757         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10758         LDKRoute route_conv;
10759         route_conv.inner = untag_ptr(route);
10760         route_conv.is_owned = ptr_is_owned(route);
10761         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
10762         route_conv.is_owned = false;
10763         LDKThirtyTwoBytes payment_id_ref;
10764         CHECK(payment_id->arr_len == 32);
10765         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
10766         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10767         *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref);
10768         return tag_ptr(ret_conv, true);
10769 }
10770
10771 void  __attribute__((export_name("TS_Payer_abandon_payment"))) TS_Payer_abandon_payment(uint64_t this_arg, int8_tArray payment_id) {
10772         void* this_arg_ptr = untag_ptr(this_arg);
10773         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10774         LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr;
10775         LDKThirtyTwoBytes payment_id_ref;
10776         CHECK(payment_id->arr_len == 32);
10777         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
10778         (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref);
10779 }
10780
10781 typedef struct LDKRouter_JCalls {
10782         atomic_size_t refcnt;
10783         uint32_t instance_ptr;
10784 } LDKRouter_JCalls;
10785 static void LDKRouter_JCalls_free(void* this_arg) {
10786         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10787         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10788                 FREE(j_calls);
10789         }
10790 }
10791 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, const uint8_t (* payment_hash)[32], LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) {
10792         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10793         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
10794         memcpy(payer_arr->elems, payer.compressed_form, 33);
10795         LDKRouteParameters route_params_var = *route_params;
10796         uint64_t route_params_ref = 0;
10797         route_params_var = RouteParameters_clone(&route_params_var);
10798         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
10799         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
10800         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
10801         memcpy(payment_hash_arr->elems, *payment_hash, 32);
10802         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
10803         uint64_tArray first_hops_arr = NULL;
10804         if (first_hops != NULL) {
10805                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
10806                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
10807                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
10808                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
10809                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
10810                         uint64_t first_hops_conv_16_ref = 0;
10811                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
10812                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
10813                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
10814                 }
10815         
10816         }
10817         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
10818         uint64_t inflight_htlcs_ref = 0;
10819         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
10820         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
10821         uint64_t ret = js_invoke_function_ubuubu(j_calls->instance_ptr, 112, (uint32_t)payer_arr, route_params_ref, (uint32_t)payment_hash_arr, (uint32_t)first_hops_arr, inflight_htlcs_ref, 0);
10822         void* ret_ptr = untag_ptr(ret);
10823         CHECK_ACCESS(ret_ptr);
10824         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
10825         FREE(untag_ptr(ret));
10826         return ret_conv;
10827 }
10828 void notify_payment_path_failed_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
10829         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10830         LDKCVec_RouteHopZ path_var = path;
10831         uint64_tArray path_arr = NULL;
10832         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
10833         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
10834         for (size_t k = 0; k < path_var.datalen; k++) {
10835                 LDKRouteHop path_conv_10_var = path_var.data[k];
10836                 uint64_t path_conv_10_ref = 0;
10837                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10838                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
10839                 path_arr_ptr[k] = path_conv_10_ref;
10840         }
10841         
10842         FREE(path_var.data);
10843         int64_t short_channel_id_conv = short_channel_id;
10844         js_invoke_function_ubuuuu(j_calls->instance_ptr, 113, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0);
10845 }
10846 void notify_payment_path_successful_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path) {
10847         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10848         LDKCVec_RouteHopZ path_var = path;
10849         uint64_tArray path_arr = NULL;
10850         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
10851         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
10852         for (size_t k = 0; k < path_var.datalen; k++) {
10853                 LDKRouteHop path_conv_10_var = path_var.data[k];
10854                 uint64_t path_conv_10_ref = 0;
10855                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10856                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
10857                 path_arr_ptr[k] = path_conv_10_ref;
10858         }
10859         
10860         FREE(path_var.data);
10861         js_invoke_function_uuuuuu(j_calls->instance_ptr, 114, (uint32_t)path_arr, 0, 0, 0, 0, 0);
10862 }
10863 void notify_payment_probe_successful_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path) {
10864         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10865         LDKCVec_RouteHopZ path_var = path;
10866         uint64_tArray path_arr = NULL;
10867         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
10868         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
10869         for (size_t k = 0; k < path_var.datalen; k++) {
10870                 LDKRouteHop path_conv_10_var = path_var.data[k];
10871                 uint64_t path_conv_10_ref = 0;
10872                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10873                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
10874                 path_arr_ptr[k] = path_conv_10_ref;
10875         }
10876         
10877         FREE(path_var.data);
10878         js_invoke_function_uuuuuu(j_calls->instance_ptr, 115, (uint32_t)path_arr, 0, 0, 0, 0, 0);
10879 }
10880 void notify_payment_probe_failed_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) {
10881         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10882         LDKCVec_RouteHopZ path_var = path;
10883         uint64_tArray path_arr = NULL;
10884         path_arr = init_uint64_tArray(path_var.datalen, __LINE__);
10885         uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8);
10886         for (size_t k = 0; k < path_var.datalen; k++) {
10887                 LDKRouteHop path_conv_10_var = path_var.data[k];
10888                 uint64_t path_conv_10_ref = 0;
10889                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var);
10890                 path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned);
10891                 path_arr_ptr[k] = path_conv_10_ref;
10892         }
10893         
10894         FREE(path_var.data);
10895         int64_t short_channel_id_conv = short_channel_id;
10896         js_invoke_function_ubuuuu(j_calls->instance_ptr, 116, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0);
10897 }
10898 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
10899         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
10900         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10901 }
10902 static inline LDKRouter LDKRouter_init (JSValue o) {
10903         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
10904         atomic_init(&calls->refcnt, 1);
10905         calls->instance_ptr = o;
10906
10907         LDKRouter ret = {
10908                 .this_arg = (void*) calls,
10909                 .find_route = find_route_LDKRouter_jcall,
10910                 .notify_payment_path_failed = notify_payment_path_failed_LDKRouter_jcall,
10911                 .notify_payment_path_successful = notify_payment_path_successful_LDKRouter_jcall,
10912                 .notify_payment_probe_successful = notify_payment_probe_successful_LDKRouter_jcall,
10913                 .notify_payment_probe_failed = notify_payment_probe_failed_LDKRouter_jcall,
10914                 .free = LDKRouter_JCalls_free,
10915         };
10916         return ret;
10917 }
10918 uint64_t  __attribute__((export_name("TS_LDKRouter_new"))) TS_LDKRouter_new(JSValue o) {
10919         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
10920         *res_ptr = LDKRouter_init(o);
10921         return tag_ptr(res_ptr, true);
10922 }
10923 uint64_t  __attribute__((export_name("TS_Router_find_route"))) TS_Router_find_route(uint64_t this_arg, int8_tArray payer, uint64_t route_params, int8_tArray payment_hash, uint64_tArray first_hops, uint64_t inflight_htlcs) {
10924         void* this_arg_ptr = untag_ptr(this_arg);
10925         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10926         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
10927         LDKPublicKey payer_ref;
10928         CHECK(payer->arr_len == 33);
10929         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
10930         LDKRouteParameters route_params_conv;
10931         route_params_conv.inner = untag_ptr(route_params);
10932         route_params_conv.is_owned = ptr_is_owned(route_params);
10933         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
10934         route_params_conv.is_owned = false;
10935         unsigned char payment_hash_arr[32];
10936         CHECK(payment_hash->arr_len == 32);
10937         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
10938         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
10939         LDKCVec_ChannelDetailsZ first_hops_constr;
10940         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
10941         if (first_hops != 0) {
10942                 first_hops_constr.datalen = first_hops->arr_len;
10943                 if (first_hops_constr.datalen > 0)
10944                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
10945                 else
10946                         first_hops_constr.data = NULL;
10947                 uint64_t* first_hops_vals = first_hops->elems;
10948                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
10949                         uint64_t first_hops_conv_16 = first_hops_vals[q];
10950                         LDKChannelDetails first_hops_conv_16_conv;
10951                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
10952                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
10953                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
10954                         first_hops_conv_16_conv.is_owned = false;
10955                         first_hops_constr.data[q] = first_hops_conv_16_conv;
10956                 }
10957                 FREE(first_hops);
10958                 first_hops_ptr = &first_hops_constr;
10959         }
10960         LDKInFlightHtlcs inflight_htlcs_conv;
10961         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
10962         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
10963         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
10964         // WARNING: we need a move here but no clone is available for LDKInFlightHtlcs
10965         
10966         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
10967         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, payment_hash_ref, first_hops_ptr, inflight_htlcs_conv);
10968         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
10969         return tag_ptr(ret_conv, true);
10970 }
10971
10972 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) {
10973         void* this_arg_ptr = untag_ptr(this_arg);
10974         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10975         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
10976         LDKCVec_RouteHopZ path_constr;
10977         path_constr.datalen = path->arr_len;
10978         if (path_constr.datalen > 0)
10979                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
10980         else
10981                 path_constr.data = NULL;
10982         uint64_t* path_vals = path->elems;
10983         for (size_t k = 0; k < path_constr.datalen; k++) {
10984                 uint64_t path_conv_10 = path_vals[k];
10985                 LDKRouteHop path_conv_10_conv;
10986                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
10987                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
10988                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
10989                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
10990                 path_constr.data[k] = path_conv_10_conv;
10991         }
10992         FREE(path);
10993         (this_arg_conv->notify_payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
10994 }
10995
10996 void  __attribute__((export_name("TS_Router_notify_payment_path_successful"))) TS_Router_notify_payment_path_successful(uint64_t this_arg, uint64_tArray path) {
10997         void* this_arg_ptr = untag_ptr(this_arg);
10998         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10999         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
11000         LDKCVec_RouteHopZ path_constr;
11001         path_constr.datalen = path->arr_len;
11002         if (path_constr.datalen > 0)
11003                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11004         else
11005                 path_constr.data = NULL;
11006         uint64_t* path_vals = path->elems;
11007         for (size_t k = 0; k < path_constr.datalen; k++) {
11008                 uint64_t path_conv_10 = path_vals[k];
11009                 LDKRouteHop path_conv_10_conv;
11010                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
11011                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
11012                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
11013                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
11014                 path_constr.data[k] = path_conv_10_conv;
11015         }
11016         FREE(path);
11017         (this_arg_conv->notify_payment_path_successful)(this_arg_conv->this_arg, path_constr);
11018 }
11019
11020 void  __attribute__((export_name("TS_Router_notify_payment_probe_successful"))) TS_Router_notify_payment_probe_successful(uint64_t this_arg, uint64_tArray path) {
11021         void* this_arg_ptr = untag_ptr(this_arg);
11022         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11023         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
11024         LDKCVec_RouteHopZ path_constr;
11025         path_constr.datalen = path->arr_len;
11026         if (path_constr.datalen > 0)
11027                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11028         else
11029                 path_constr.data = NULL;
11030         uint64_t* path_vals = path->elems;
11031         for (size_t k = 0; k < path_constr.datalen; k++) {
11032                 uint64_t path_conv_10 = path_vals[k];
11033                 LDKRouteHop path_conv_10_conv;
11034                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
11035                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
11036                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
11037                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
11038                 path_constr.data[k] = path_conv_10_conv;
11039         }
11040         FREE(path);
11041         (this_arg_conv->notify_payment_probe_successful)(this_arg_conv->this_arg, path_constr);
11042 }
11043
11044 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) {
11045         void* this_arg_ptr = untag_ptr(this_arg);
11046         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11047         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
11048         LDKCVec_RouteHopZ path_constr;
11049         path_constr.datalen = path->arr_len;
11050         if (path_constr.datalen > 0)
11051                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
11052         else
11053                 path_constr.data = NULL;
11054         uint64_t* path_vals = path->elems;
11055         for (size_t k = 0; k < path_constr.datalen; k++) {
11056                 uint64_t path_conv_10 = path_vals[k];
11057                 LDKRouteHop path_conv_10_conv;
11058                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
11059                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
11060                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
11061                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
11062                 path_constr.data[k] = path_conv_10_conv;
11063         }
11064         FREE(path);
11065         (this_arg_conv->notify_payment_probe_failed)(this_arg_conv->this_arg, path_constr, short_channel_id);
11066 }
11067
11068 uint32_t __attribute__((export_name("TS_LDKRetry_ty_from_ptr"))) TS_LDKRetry_ty_from_ptr(uint64_t ptr) {
11069         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
11070         switch(obj->tag) {
11071                 case LDKRetry_Attempts: return 0;
11072                 default: abort();
11073         }
11074 }
11075 uint32_t __attribute__((export_name("TS_LDKRetry_Attempts_get_attempts"))) TS_LDKRetry_Attempts_get_attempts(uint64_t ptr) {
11076         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
11077         assert(obj->tag == LDKRetry_Attempts);
11078                         uint32_t attempts_conv = obj->attempts;
11079         return attempts_conv;
11080 }
11081 jstring  __attribute__((export_name("TS__ldk_get_compiled_version"))) TS__ldk_get_compiled_version() {
11082         LDKStr ret_str = _ldk_get_compiled_version();
11083         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
11084         Str_free(ret_str);
11085         return ret_conv;
11086 }
11087
11088 jstring  __attribute__((export_name("TS__ldk_c_bindings_get_compiled_version"))) TS__ldk_c_bindings_get_compiled_version() {
11089         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
11090         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
11091         Str_free(ret_str);
11092         return ret_conv;
11093 }
11094
11095 uint64_t  __attribute__((export_name("TS_BigEndianScalar_new"))) TS_BigEndianScalar_new(int8_tArray big_endian_bytes) {
11096         LDKThirtyTwoBytes big_endian_bytes_ref;
11097         CHECK(big_endian_bytes->arr_len == 32);
11098         memcpy(big_endian_bytes_ref.data, big_endian_bytes->elems, 32); FREE(big_endian_bytes);
11099         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
11100         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
11101         return tag_ptr(ret_ref, true);
11102 }
11103
11104 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
11105         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
11106         *ret_copy = Bech32Error_clone(arg);
11107         uint64_t ret_ref = tag_ptr(ret_copy, true);
11108         return ret_ref;
11109 }
11110 int64_t  __attribute__((export_name("TS_Bech32Error_clone_ptr"))) TS_Bech32Error_clone_ptr(uint64_t arg) {
11111         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
11112         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
11113         return ret_conv;
11114 }
11115
11116 uint64_t  __attribute__((export_name("TS_Bech32Error_clone"))) TS_Bech32Error_clone(uint64_t orig) {
11117         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
11118         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
11119         *ret_copy = Bech32Error_clone(orig_conv);
11120         uint64_t ret_ref = tag_ptr(ret_copy, true);
11121         return ret_ref;
11122 }
11123
11124 void  __attribute__((export_name("TS_Bech32Error_free"))) TS_Bech32Error_free(uint64_t o) {
11125         if (!ptr_is_owned(o)) return;
11126         void* o_ptr = untag_ptr(o);
11127         CHECK_ACCESS(o_ptr);
11128         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
11129         FREE(untag_ptr(o));
11130         Bech32Error_free(o_conv);
11131 }
11132
11133 void  __attribute__((export_name("TS_Transaction_free"))) TS_Transaction_free(int8_tArray _res) {
11134         LDKTransaction _res_ref;
11135         _res_ref.datalen = _res->arr_len;
11136         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
11137         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
11138         _res_ref.data_is_owned = true;
11139         Transaction_free(_res_ref);
11140 }
11141
11142 uint64_t  __attribute__((export_name("TS_TxOut_new"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
11143         LDKCVec_u8Z script_pubkey_ref;
11144         script_pubkey_ref.datalen = script_pubkey->arr_len;
11145         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
11146         memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen); FREE(script_pubkey);
11147         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11148         *ret_ref = TxOut_new(script_pubkey_ref, value);
11149         return tag_ptr(ret_ref, true);
11150 }
11151
11152 void  __attribute__((export_name("TS_TxOut_free"))) TS_TxOut_free(uint64_t _res) {
11153         if (!ptr_is_owned(_res)) return;
11154         void* _res_ptr = untag_ptr(_res);
11155         CHECK_ACCESS(_res_ptr);
11156         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
11157         FREE(untag_ptr(_res));
11158         TxOut_free(_res_conv);
11159 }
11160
11161 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
11162         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11163         *ret_ref = TxOut_clone(arg);
11164         return tag_ptr(ret_ref, true);
11165 }
11166 int64_t  __attribute__((export_name("TS_TxOut_clone_ptr"))) TS_TxOut_clone_ptr(uint64_t arg) {
11167         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
11168         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
11169         return ret_conv;
11170 }
11171
11172 uint64_t  __attribute__((export_name("TS_TxOut_clone"))) TS_TxOut_clone(uint64_t orig) {
11173         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
11174         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11175         *ret_ref = TxOut_clone(orig_conv);
11176         return tag_ptr(ret_ref, true);
11177 }
11178
11179 void  __attribute__((export_name("TS_Str_free"))) TS_Str_free(jstring _res) {
11180         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
11181         Str_free(dummy);
11182 }
11183
11184 void  __attribute__((export_name("TS_CVec_PublicKeyZ_free"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
11185         LDKCVec_PublicKeyZ _res_constr;
11186         _res_constr.datalen = _res->arr_len;
11187         if (_res_constr.datalen > 0)
11188                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
11189         else
11190                 _res_constr.data = NULL;
11191         int8_tArray* _res_vals = (void*) _res->elems;
11192         for (size_t m = 0; m < _res_constr.datalen; m++) {
11193                 int8_tArray _res_conv_12 = _res_vals[m];
11194                 LDKPublicKey _res_conv_12_ref;
11195                 CHECK(_res_conv_12->arr_len == 33);
11196                 memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33); FREE(_res_conv_12);
11197                 _res_constr.data[m] = _res_conv_12_ref;
11198         }
11199         FREE(_res);
11200         CVec_PublicKeyZ_free(_res_constr);
11201 }
11202
11203 uint64_t  __attribute__((export_name("TS_CResult_BlindedRouteNoneZ_ok"))) TS_CResult_BlindedRouteNoneZ_ok(uint64_t o) {
11204         LDKBlindedRoute o_conv;
11205         o_conv.inner = untag_ptr(o);
11206         o_conv.is_owned = ptr_is_owned(o);
11207         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11208         // WARNING: we need a move here but no clone is available for LDKBlindedRoute
11209         
11210         LDKCResult_BlindedRouteNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteNoneZ), "LDKCResult_BlindedRouteNoneZ");
11211         *ret_conv = CResult_BlindedRouteNoneZ_ok(o_conv);
11212         return tag_ptr(ret_conv, true);
11213 }
11214
11215 uint64_t  __attribute__((export_name("TS_CResult_BlindedRouteNoneZ_err"))) TS_CResult_BlindedRouteNoneZ_err() {
11216         LDKCResult_BlindedRouteNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteNoneZ), "LDKCResult_BlindedRouteNoneZ");
11217         *ret_conv = CResult_BlindedRouteNoneZ_err();
11218         return tag_ptr(ret_conv, true);
11219 }
11220
11221 jboolean  __attribute__((export_name("TS_CResult_BlindedRouteNoneZ_is_ok"))) TS_CResult_BlindedRouteNoneZ_is_ok(uint64_t o) {
11222         LDKCResult_BlindedRouteNoneZ* o_conv = (LDKCResult_BlindedRouteNoneZ*)untag_ptr(o);
11223         jboolean ret_conv = CResult_BlindedRouteNoneZ_is_ok(o_conv);
11224         return ret_conv;
11225 }
11226
11227 void  __attribute__((export_name("TS_CResult_BlindedRouteNoneZ_free"))) TS_CResult_BlindedRouteNoneZ_free(uint64_t _res) {
11228         if (!ptr_is_owned(_res)) return;
11229         void* _res_ptr = untag_ptr(_res);
11230         CHECK_ACCESS(_res_ptr);
11231         LDKCResult_BlindedRouteNoneZ _res_conv = *(LDKCResult_BlindedRouteNoneZ*)(_res_ptr);
11232         FREE(untag_ptr(_res));
11233         CResult_BlindedRouteNoneZ_free(_res_conv);
11234 }
11235
11236 uint64_t  __attribute__((export_name("TS_CResult_BlindedRouteDecodeErrorZ_ok"))) TS_CResult_BlindedRouteDecodeErrorZ_ok(uint64_t o) {
11237         LDKBlindedRoute o_conv;
11238         o_conv.inner = untag_ptr(o);
11239         o_conv.is_owned = ptr_is_owned(o);
11240         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11241         // WARNING: we need a move here but no clone is available for LDKBlindedRoute
11242         
11243         LDKCResult_BlindedRouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteDecodeErrorZ), "LDKCResult_BlindedRouteDecodeErrorZ");
11244         *ret_conv = CResult_BlindedRouteDecodeErrorZ_ok(o_conv);
11245         return tag_ptr(ret_conv, true);
11246 }
11247
11248 uint64_t  __attribute__((export_name("TS_CResult_BlindedRouteDecodeErrorZ_err"))) TS_CResult_BlindedRouteDecodeErrorZ_err(uint64_t e) {
11249         LDKDecodeError e_conv;
11250         e_conv.inner = untag_ptr(e);
11251         e_conv.is_owned = ptr_is_owned(e);
11252         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11253         e_conv = DecodeError_clone(&e_conv);
11254         LDKCResult_BlindedRouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteDecodeErrorZ), "LDKCResult_BlindedRouteDecodeErrorZ");
11255         *ret_conv = CResult_BlindedRouteDecodeErrorZ_err(e_conv);
11256         return tag_ptr(ret_conv, true);
11257 }
11258
11259 jboolean  __attribute__((export_name("TS_CResult_BlindedRouteDecodeErrorZ_is_ok"))) TS_CResult_BlindedRouteDecodeErrorZ_is_ok(uint64_t o) {
11260         LDKCResult_BlindedRouteDecodeErrorZ* o_conv = (LDKCResult_BlindedRouteDecodeErrorZ*)untag_ptr(o);
11261         jboolean ret_conv = CResult_BlindedRouteDecodeErrorZ_is_ok(o_conv);
11262         return ret_conv;
11263 }
11264
11265 void  __attribute__((export_name("TS_CResult_BlindedRouteDecodeErrorZ_free"))) TS_CResult_BlindedRouteDecodeErrorZ_free(uint64_t _res) {
11266         if (!ptr_is_owned(_res)) return;
11267         void* _res_ptr = untag_ptr(_res);
11268         CHECK_ACCESS(_res_ptr);
11269         LDKCResult_BlindedRouteDecodeErrorZ _res_conv = *(LDKCResult_BlindedRouteDecodeErrorZ*)(_res_ptr);
11270         FREE(untag_ptr(_res));
11271         CResult_BlindedRouteDecodeErrorZ_free(_res_conv);
11272 }
11273
11274 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_ok"))) TS_CResult_BlindedHopDecodeErrorZ_ok(uint64_t o) {
11275         LDKBlindedHop o_conv;
11276         o_conv.inner = untag_ptr(o);
11277         o_conv.is_owned = ptr_is_owned(o);
11278         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11279         // WARNING: we need a move here but no clone is available for LDKBlindedHop
11280         
11281         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
11282         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
11283         return tag_ptr(ret_conv, true);
11284 }
11285
11286 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_err"))) TS_CResult_BlindedHopDecodeErrorZ_err(uint64_t e) {
11287         LDKDecodeError e_conv;
11288         e_conv.inner = untag_ptr(e);
11289         e_conv.is_owned = ptr_is_owned(e);
11290         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11291         e_conv = DecodeError_clone(&e_conv);
11292         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
11293         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
11294         return tag_ptr(ret_conv, true);
11295 }
11296
11297 jboolean  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopDecodeErrorZ_is_ok(uint64_t o) {
11298         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
11299         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
11300         return ret_conv;
11301 }
11302
11303 void  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_free"))) TS_CResult_BlindedHopDecodeErrorZ_free(uint64_t _res) {
11304         if (!ptr_is_owned(_res)) return;
11305         void* _res_ptr = untag_ptr(_res);
11306         CHECK_ACCESS(_res_ptr);
11307         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
11308         FREE(untag_ptr(_res));
11309         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
11310 }
11311
11312 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_ok"))) TS_CResult_NoneNoneZ_ok() {
11313         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11314         *ret_conv = CResult_NoneNoneZ_ok();
11315         return tag_ptr(ret_conv, true);
11316 }
11317
11318 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_err"))) TS_CResult_NoneNoneZ_err() {
11319         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11320         *ret_conv = CResult_NoneNoneZ_err();
11321         return tag_ptr(ret_conv, true);
11322 }
11323
11324 jboolean  __attribute__((export_name("TS_CResult_NoneNoneZ_is_ok"))) TS_CResult_NoneNoneZ_is_ok(uint64_t o) {
11325         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
11326         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
11327         return ret_conv;
11328 }
11329
11330 void  __attribute__((export_name("TS_CResult_NoneNoneZ_free"))) TS_CResult_NoneNoneZ_free(uint64_t _res) {
11331         if (!ptr_is_owned(_res)) return;
11332         void* _res_ptr = untag_ptr(_res);
11333         CHECK_ACCESS(_res_ptr);
11334         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
11335         FREE(untag_ptr(_res));
11336         CResult_NoneNoneZ_free(_res_conv);
11337 }
11338
11339 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
11340         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11341         *ret_conv = CResult_NoneNoneZ_clone(arg);
11342         return tag_ptr(ret_conv, true);
11343 }
11344 int64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone_ptr"))) TS_CResult_NoneNoneZ_clone_ptr(uint64_t arg) {
11345         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
11346         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
11347         return ret_conv;
11348 }
11349
11350 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone"))) TS_CResult_NoneNoneZ_clone(uint64_t orig) {
11351         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
11352         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
11353         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
11354         return tag_ptr(ret_conv, true);
11355 }
11356
11357 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(uint64_t o) {
11358         LDKCounterpartyCommitmentSecrets o_conv;
11359         o_conv.inner = untag_ptr(o);
11360         o_conv.is_owned = ptr_is_owned(o);
11361         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11362         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
11363         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11364         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
11365         return tag_ptr(ret_conv, true);
11366 }
11367
11368 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(uint64_t e) {
11369         LDKDecodeError e_conv;
11370         e_conv.inner = untag_ptr(e);
11371         e_conv.is_owned = ptr_is_owned(e);
11372         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11373         e_conv = DecodeError_clone(&e_conv);
11374         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11375         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
11376         return tag_ptr(ret_conv, true);
11377 }
11378
11379 jboolean  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(uint64_t o) {
11380         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
11381         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
11382         return ret_conv;
11383 }
11384
11385 void  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(uint64_t _res) {
11386         if (!ptr_is_owned(_res)) return;
11387         void* _res_ptr = untag_ptr(_res);
11388         CHECK_ACCESS(_res_ptr);
11389         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
11390         FREE(untag_ptr(_res));
11391         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
11392 }
11393
11394 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
11395         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11396         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
11397         return tag_ptr(ret_conv, true);
11398 }
11399 int64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(uint64_t arg) {
11400         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
11401         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
11402         return ret_conv;
11403 }
11404
11405 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(uint64_t orig) {
11406         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
11407         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
11408         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
11409         return tag_ptr(ret_conv, true);
11410 }
11411
11412 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_ok"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) {
11413         LDKSecretKey o_ref;
11414         CHECK(o->arr_len == 32);
11415         memcpy(o_ref.bytes, o->elems, 32); FREE(o);
11416         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11417         *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
11418         return tag_ptr(ret_conv, true);
11419 }
11420
11421 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_err"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) {
11422         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
11423         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11424         *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
11425         return tag_ptr(ret_conv, true);
11426 }
11427
11428 jboolean  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_is_ok"))) TS_CResult_SecretKeyErrorZ_is_ok(uint64_t o) {
11429         LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(o);
11430         jboolean ret_conv = CResult_SecretKeyErrorZ_is_ok(o_conv);
11431         return ret_conv;
11432 }
11433
11434 void  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_free"))) TS_CResult_SecretKeyErrorZ_free(uint64_t _res) {
11435         if (!ptr_is_owned(_res)) return;
11436         void* _res_ptr = untag_ptr(_res);
11437         CHECK_ACCESS(_res_ptr);
11438         LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr);
11439         FREE(untag_ptr(_res));
11440         CResult_SecretKeyErrorZ_free(_res_conv);
11441 }
11442
11443 static inline uint64_t CResult_SecretKeyErrorZ_clone_ptr(LDKCResult_SecretKeyErrorZ *NONNULL_PTR arg) {
11444         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11445         *ret_conv = CResult_SecretKeyErrorZ_clone(arg);
11446         return tag_ptr(ret_conv, true);
11447 }
11448 int64_t  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_clone_ptr"))) TS_CResult_SecretKeyErrorZ_clone_ptr(uint64_t arg) {
11449         LDKCResult_SecretKeyErrorZ* arg_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(arg);
11450         int64_t ret_conv = CResult_SecretKeyErrorZ_clone_ptr(arg_conv);
11451         return ret_conv;
11452 }
11453
11454 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyErrorZ_clone"))) TS_CResult_SecretKeyErrorZ_clone(uint64_t orig) {
11455         LDKCResult_SecretKeyErrorZ* orig_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(orig);
11456         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
11457         *ret_conv = CResult_SecretKeyErrorZ_clone(orig_conv);
11458         return tag_ptr(ret_conv, true);
11459 }
11460
11461 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_ok"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
11462         LDKPublicKey o_ref;
11463         CHECK(o->arr_len == 33);
11464         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
11465         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11466         *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
11467         return tag_ptr(ret_conv, true);
11468 }
11469
11470 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_err"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
11471         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
11472         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11473         *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
11474         return tag_ptr(ret_conv, true);
11475 }
11476
11477 jboolean  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_is_ok"))) TS_CResult_PublicKeyErrorZ_is_ok(uint64_t o) {
11478         LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(o);
11479         jboolean ret_conv = CResult_PublicKeyErrorZ_is_ok(o_conv);
11480         return ret_conv;
11481 }
11482
11483 void  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_free"))) TS_CResult_PublicKeyErrorZ_free(uint64_t _res) {
11484         if (!ptr_is_owned(_res)) return;
11485         void* _res_ptr = untag_ptr(_res);
11486         CHECK_ACCESS(_res_ptr);
11487         LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
11488         FREE(untag_ptr(_res));
11489         CResult_PublicKeyErrorZ_free(_res_conv);
11490 }
11491
11492 static inline uint64_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
11493         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11494         *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
11495         return tag_ptr(ret_conv, true);
11496 }
11497 int64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone_ptr"))) TS_CResult_PublicKeyErrorZ_clone_ptr(uint64_t arg) {
11498         LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(arg);
11499         int64_t ret_conv = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
11500         return ret_conv;
11501 }
11502
11503 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone"))) TS_CResult_PublicKeyErrorZ_clone(uint64_t orig) {
11504         LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(orig);
11505         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
11506         *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
11507         return tag_ptr(ret_conv, true);
11508 }
11509
11510 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint64_t o) {
11511         LDKTxCreationKeys o_conv;
11512         o_conv.inner = untag_ptr(o);
11513         o_conv.is_owned = ptr_is_owned(o);
11514         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11515         o_conv = TxCreationKeys_clone(&o_conv);
11516         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11517         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
11518         return tag_ptr(ret_conv, true);
11519 }
11520
11521 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint64_t e) {
11522         LDKDecodeError e_conv;
11523         e_conv.inner = untag_ptr(e);
11524         e_conv.is_owned = ptr_is_owned(e);
11525         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11526         e_conv = DecodeError_clone(&e_conv);
11527         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11528         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
11529         return tag_ptr(ret_conv, true);
11530 }
11531
11532 jboolean  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_is_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint64_t o) {
11533         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
11534         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
11535         return ret_conv;
11536 }
11537
11538 void  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_free"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint64_t _res) {
11539         if (!ptr_is_owned(_res)) return;
11540         void* _res_ptr = untag_ptr(_res);
11541         CHECK_ACCESS(_res_ptr);
11542         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
11543         FREE(untag_ptr(_res));
11544         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
11545 }
11546
11547 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
11548         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11549         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
11550         return tag_ptr(ret_conv, true);
11551 }
11552 int64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
11553         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
11554         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
11555         return ret_conv;
11556 }
11557
11558 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint64_t orig) {
11559         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
11560         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
11561         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
11562         return tag_ptr(ret_conv, true);
11563 }
11564
11565 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint64_t o) {
11566         LDKChannelPublicKeys o_conv;
11567         o_conv.inner = untag_ptr(o);
11568         o_conv.is_owned = ptr_is_owned(o);
11569         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11570         o_conv = ChannelPublicKeys_clone(&o_conv);
11571         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11572         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
11573         return tag_ptr(ret_conv, true);
11574 }
11575
11576 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint64_t e) {
11577         LDKDecodeError e_conv;
11578         e_conv.inner = untag_ptr(e);
11579         e_conv.is_owned = ptr_is_owned(e);
11580         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11581         e_conv = DecodeError_clone(&e_conv);
11582         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11583         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
11584         return tag_ptr(ret_conv, true);
11585 }
11586
11587 jboolean  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint64_t o) {
11588         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
11589         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
11590         return ret_conv;
11591 }
11592
11593 void  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_free"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint64_t _res) {
11594         if (!ptr_is_owned(_res)) return;
11595         void* _res_ptr = untag_ptr(_res);
11596         CHECK_ACCESS(_res_ptr);
11597         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
11598         FREE(untag_ptr(_res));
11599         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
11600 }
11601
11602 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
11603         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11604         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
11605         return tag_ptr(ret_conv, true);
11606 }
11607 int64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
11608         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
11609         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
11610         return ret_conv;
11611 }
11612
11613 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint64_t orig) {
11614         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
11615         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
11616         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
11617         return tag_ptr(ret_conv, true);
11618 }
11619
11620 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_ok"))) TS_CResult_TxCreationKeysErrorZ_ok(uint64_t o) {
11621         LDKTxCreationKeys o_conv;
11622         o_conv.inner = untag_ptr(o);
11623         o_conv.is_owned = ptr_is_owned(o);
11624         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11625         o_conv = TxCreationKeys_clone(&o_conv);
11626         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11627         *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
11628         return tag_ptr(ret_conv, true);
11629 }
11630
11631 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_err"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) {
11632         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
11633         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11634         *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
11635         return tag_ptr(ret_conv, true);
11636 }
11637
11638 jboolean  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_is_ok"))) TS_CResult_TxCreationKeysErrorZ_is_ok(uint64_t o) {
11639         LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(o);
11640         jboolean ret_conv = CResult_TxCreationKeysErrorZ_is_ok(o_conv);
11641         return ret_conv;
11642 }
11643
11644 void  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_free"))) TS_CResult_TxCreationKeysErrorZ_free(uint64_t _res) {
11645         if (!ptr_is_owned(_res)) return;
11646         void* _res_ptr = untag_ptr(_res);
11647         CHECK_ACCESS(_res_ptr);
11648         LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr);
11649         FREE(untag_ptr(_res));
11650         CResult_TxCreationKeysErrorZ_free(_res_conv);
11651 }
11652
11653 static inline uint64_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) {
11654         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11655         *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg);
11656         return tag_ptr(ret_conv, true);
11657 }
11658 int64_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysErrorZ_clone_ptr(uint64_t arg) {
11659         LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(arg);
11660         int64_t ret_conv = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv);
11661         return ret_conv;
11662 }
11663
11664 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_clone"))) TS_CResult_TxCreationKeysErrorZ_clone(uint64_t orig) {
11665         LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(orig);
11666         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
11667         *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
11668         return tag_ptr(ret_conv, true);
11669 }
11670
11671 uint64_t  __attribute__((export_name("TS_COption_u32Z_some"))) TS_COption_u32Z_some(int32_t o) {
11672         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11673         *ret_copy = COption_u32Z_some(o);
11674         uint64_t ret_ref = tag_ptr(ret_copy, true);
11675         return ret_ref;
11676 }
11677
11678 uint64_t  __attribute__((export_name("TS_COption_u32Z_none"))) TS_COption_u32Z_none() {
11679         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11680         *ret_copy = COption_u32Z_none();
11681         uint64_t ret_ref = tag_ptr(ret_copy, true);
11682         return ret_ref;
11683 }
11684
11685 void  __attribute__((export_name("TS_COption_u32Z_free"))) TS_COption_u32Z_free(uint64_t _res) {
11686         if (!ptr_is_owned(_res)) return;
11687         void* _res_ptr = untag_ptr(_res);
11688         CHECK_ACCESS(_res_ptr);
11689         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
11690         FREE(untag_ptr(_res));
11691         COption_u32Z_free(_res_conv);
11692 }
11693
11694 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
11695         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11696         *ret_copy = COption_u32Z_clone(arg);
11697         uint64_t ret_ref = tag_ptr(ret_copy, true);
11698         return ret_ref;
11699 }
11700 int64_t  __attribute__((export_name("TS_COption_u32Z_clone_ptr"))) TS_COption_u32Z_clone_ptr(uint64_t arg) {
11701         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
11702         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
11703         return ret_conv;
11704 }
11705
11706 uint64_t  __attribute__((export_name("TS_COption_u32Z_clone"))) TS_COption_u32Z_clone(uint64_t orig) {
11707         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
11708         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
11709         *ret_copy = COption_u32Z_clone(orig_conv);
11710         uint64_t ret_ref = tag_ptr(ret_copy, true);
11711         return ret_ref;
11712 }
11713
11714 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint64_t o) {
11715         LDKHTLCOutputInCommitment o_conv;
11716         o_conv.inner = untag_ptr(o);
11717         o_conv.is_owned = ptr_is_owned(o);
11718         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11719         o_conv = HTLCOutputInCommitment_clone(&o_conv);
11720         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11721         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
11722         return tag_ptr(ret_conv, true);
11723 }
11724
11725 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint64_t e) {
11726         LDKDecodeError e_conv;
11727         e_conv.inner = untag_ptr(e);
11728         e_conv.is_owned = ptr_is_owned(e);
11729         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11730         e_conv = DecodeError_clone(&e_conv);
11731         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11732         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
11733         return tag_ptr(ret_conv, true);
11734 }
11735
11736 jboolean  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint64_t o) {
11737         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
11738         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
11739         return ret_conv;
11740 }
11741
11742 void  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint64_t _res) {
11743         if (!ptr_is_owned(_res)) return;
11744         void* _res_ptr = untag_ptr(_res);
11745         CHECK_ACCESS(_res_ptr);
11746         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
11747         FREE(untag_ptr(_res));
11748         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
11749 }
11750
11751 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
11752         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11753         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
11754         return tag_ptr(ret_conv, true);
11755 }
11756 int64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint64_t arg) {
11757         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
11758         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
11759         return ret_conv;
11760 }
11761
11762 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint64_t orig) {
11763         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
11764         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
11765         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
11766         return tag_ptr(ret_conv, true);
11767 }
11768
11769 uint32_t  __attribute__((export_name("TS_COption_NoneZ_some"))) TS_COption_NoneZ_some() {
11770         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
11771         return ret_conv;
11772 }
11773
11774 uint32_t  __attribute__((export_name("TS_COption_NoneZ_none"))) TS_COption_NoneZ_none() {
11775         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
11776         return ret_conv;
11777 }
11778
11779 void  __attribute__((export_name("TS_COption_NoneZ_free"))) TS_COption_NoneZ_free(uint32_t _res) {
11780         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
11781         COption_NoneZ_free(_res_conv);
11782 }
11783
11784 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
11785         LDKCounterpartyChannelTransactionParameters o_conv;
11786         o_conv.inner = untag_ptr(o);
11787         o_conv.is_owned = ptr_is_owned(o);
11788         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11789         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
11790         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11791         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
11792         return tag_ptr(ret_conv, true);
11793 }
11794
11795 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
11796         LDKDecodeError e_conv;
11797         e_conv.inner = untag_ptr(e);
11798         e_conv.is_owned = ptr_is_owned(e);
11799         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11800         e_conv = DecodeError_clone(&e_conv);
11801         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11802         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
11803         return tag_ptr(ret_conv, true);
11804 }
11805
11806 jboolean  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
11807         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
11808         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
11809         return ret_conv;
11810 }
11811
11812 void  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
11813         if (!ptr_is_owned(_res)) return;
11814         void* _res_ptr = untag_ptr(_res);
11815         CHECK_ACCESS(_res_ptr);
11816         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
11817         FREE(untag_ptr(_res));
11818         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
11819 }
11820
11821 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
11822         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11823         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
11824         return tag_ptr(ret_conv, true);
11825 }
11826 int64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
11827         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
11828         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
11829         return ret_conv;
11830 }
11831
11832 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
11833         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
11834         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
11835         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
11836         return tag_ptr(ret_conv, true);
11837 }
11838
11839 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
11840         LDKChannelTransactionParameters o_conv;
11841         o_conv.inner = untag_ptr(o);
11842         o_conv.is_owned = ptr_is_owned(o);
11843         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11844         o_conv = ChannelTransactionParameters_clone(&o_conv);
11845         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11846         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
11847         return tag_ptr(ret_conv, true);
11848 }
11849
11850 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
11851         LDKDecodeError e_conv;
11852         e_conv.inner = untag_ptr(e);
11853         e_conv.is_owned = ptr_is_owned(e);
11854         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11855         e_conv = DecodeError_clone(&e_conv);
11856         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11857         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
11858         return tag_ptr(ret_conv, true);
11859 }
11860
11861 jboolean  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
11862         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
11863         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
11864         return ret_conv;
11865 }
11866
11867 void  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
11868         if (!ptr_is_owned(_res)) return;
11869         void* _res_ptr = untag_ptr(_res);
11870         CHECK_ACCESS(_res_ptr);
11871         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
11872         FREE(untag_ptr(_res));
11873         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
11874 }
11875
11876 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
11877         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11878         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
11879         return tag_ptr(ret_conv, true);
11880 }
11881 int64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
11882         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
11883         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
11884         return ret_conv;
11885 }
11886
11887 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
11888         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
11889         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
11890         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
11891         return tag_ptr(ret_conv, true);
11892 }
11893
11894 void  __attribute__((export_name("TS_CVec_SignatureZ_free"))) TS_CVec_SignatureZ_free(ptrArray _res) {
11895         LDKCVec_SignatureZ _res_constr;
11896         _res_constr.datalen = _res->arr_len;
11897         if (_res_constr.datalen > 0)
11898                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
11899         else
11900                 _res_constr.data = NULL;
11901         int8_tArray* _res_vals = (void*) _res->elems;
11902         for (size_t m = 0; m < _res_constr.datalen; m++) {
11903                 int8_tArray _res_conv_12 = _res_vals[m];
11904                 LDKSignature _res_conv_12_ref;
11905                 CHECK(_res_conv_12->arr_len == 64);
11906                 memcpy(_res_conv_12_ref.compact_form, _res_conv_12->elems, 64); FREE(_res_conv_12);
11907                 _res_constr.data[m] = _res_conv_12_ref;
11908         }
11909         FREE(_res);
11910         CVec_SignatureZ_free(_res_constr);
11911 }
11912
11913 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
11914         LDKHolderCommitmentTransaction o_conv;
11915         o_conv.inner = untag_ptr(o);
11916         o_conv.is_owned = ptr_is_owned(o);
11917         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11918         o_conv = HolderCommitmentTransaction_clone(&o_conv);
11919         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11920         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
11921         return tag_ptr(ret_conv, true);
11922 }
11923
11924 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
11925         LDKDecodeError e_conv;
11926         e_conv.inner = untag_ptr(e);
11927         e_conv.is_owned = ptr_is_owned(e);
11928         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11929         e_conv = DecodeError_clone(&e_conv);
11930         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11931         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
11932         return tag_ptr(ret_conv, true);
11933 }
11934
11935 jboolean  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
11936         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
11937         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
11938         return ret_conv;
11939 }
11940
11941 void  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
11942         if (!ptr_is_owned(_res)) return;
11943         void* _res_ptr = untag_ptr(_res);
11944         CHECK_ACCESS(_res_ptr);
11945         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
11946         FREE(untag_ptr(_res));
11947         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
11948 }
11949
11950 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
11951         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11952         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
11953         return tag_ptr(ret_conv, true);
11954 }
11955 int64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
11956         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
11957         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
11958         return ret_conv;
11959 }
11960
11961 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
11962         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
11963         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
11964         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
11965         return tag_ptr(ret_conv, true);
11966 }
11967
11968 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
11969         LDKBuiltCommitmentTransaction o_conv;
11970         o_conv.inner = untag_ptr(o);
11971         o_conv.is_owned = ptr_is_owned(o);
11972         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
11973         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
11974         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
11975         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
11976         return tag_ptr(ret_conv, true);
11977 }
11978
11979 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
11980         LDKDecodeError e_conv;
11981         e_conv.inner = untag_ptr(e);
11982         e_conv.is_owned = ptr_is_owned(e);
11983         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
11984         e_conv = DecodeError_clone(&e_conv);
11985         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
11986         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
11987         return tag_ptr(ret_conv, true);
11988 }
11989
11990 jboolean  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
11991         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
11992         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
11993         return ret_conv;
11994 }
11995
11996 void  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
11997         if (!ptr_is_owned(_res)) return;
11998         void* _res_ptr = untag_ptr(_res);
11999         CHECK_ACCESS(_res_ptr);
12000         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
12001         FREE(untag_ptr(_res));
12002         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
12003 }
12004
12005 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12006         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12007         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
12008         return tag_ptr(ret_conv, true);
12009 }
12010 int64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
12011         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
12012         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12013         return ret_conv;
12014 }
12015
12016 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
12017         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
12018         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
12019         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
12020         return tag_ptr(ret_conv, true);
12021 }
12022
12023 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint64_t o) {
12024         LDKTrustedClosingTransaction o_conv;
12025         o_conv.inner = untag_ptr(o);
12026         o_conv.is_owned = ptr_is_owned(o);
12027         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12028         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
12029         
12030         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
12031         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
12032         return tag_ptr(ret_conv, true);
12033 }
12034
12035 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_err"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
12036         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
12037         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
12038         return tag_ptr(ret_conv, true);
12039 }
12040
12041 jboolean  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_is_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint64_t o) {
12042         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
12043         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
12044         return ret_conv;
12045 }
12046
12047 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_free"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint64_t _res) {
12048         if (!ptr_is_owned(_res)) return;
12049         void* _res_ptr = untag_ptr(_res);
12050         CHECK_ACCESS(_res_ptr);
12051         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
12052         FREE(untag_ptr(_res));
12053         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
12054 }
12055
12056 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
12057         LDKCommitmentTransaction o_conv;
12058         o_conv.inner = untag_ptr(o);
12059         o_conv.is_owned = ptr_is_owned(o);
12060         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12061         o_conv = CommitmentTransaction_clone(&o_conv);
12062         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12063         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
12064         return tag_ptr(ret_conv, true);
12065 }
12066
12067 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint64_t e) {
12068         LDKDecodeError e_conv;
12069         e_conv.inner = untag_ptr(e);
12070         e_conv.is_owned = ptr_is_owned(e);
12071         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12072         e_conv = DecodeError_clone(&e_conv);
12073         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12074         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
12075         return tag_ptr(ret_conv, true);
12076 }
12077
12078 jboolean  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
12079         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
12080         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
12081         return ret_conv;
12082 }
12083
12084 void  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_free"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
12085         if (!ptr_is_owned(_res)) return;
12086         void* _res_ptr = untag_ptr(_res);
12087         CHECK_ACCESS(_res_ptr);
12088         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
12089         FREE(untag_ptr(_res));
12090         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
12091 }
12092
12093 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
12094         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12095         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
12096         return tag_ptr(ret_conv, true);
12097 }
12098 int64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
12099         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
12100         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
12101         return ret_conv;
12102 }
12103
12104 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
12105         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
12106         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
12107         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
12108         return tag_ptr(ret_conv, true);
12109 }
12110
12111 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint64_t o) {
12112         LDKTrustedCommitmentTransaction o_conv;
12113         o_conv.inner = untag_ptr(o);
12114         o_conv.is_owned = ptr_is_owned(o);
12115         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12116         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
12117         
12118         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
12119         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
12120         return tag_ptr(ret_conv, true);
12121 }
12122
12123 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
12124         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
12125         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
12126         return tag_ptr(ret_conv, true);
12127 }
12128
12129 jboolean  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint64_t o) {
12130         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
12131         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
12132         return ret_conv;
12133 }
12134
12135 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_free"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint64_t _res) {
12136         if (!ptr_is_owned(_res)) return;
12137         void* _res_ptr = untag_ptr(_res);
12138         CHECK_ACCESS(_res_ptr);
12139         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
12140         FREE(untag_ptr(_res));
12141         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
12142 }
12143
12144 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_ok"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
12145         LDKCVec_SignatureZ o_constr;
12146         o_constr.datalen = o->arr_len;
12147         if (o_constr.datalen > 0)
12148                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
12149         else
12150                 o_constr.data = NULL;
12151         int8_tArray* o_vals = (void*) o->elems;
12152         for (size_t m = 0; m < o_constr.datalen; m++) {
12153                 int8_tArray o_conv_12 = o_vals[m];
12154                 LDKSignature o_conv_12_ref;
12155                 CHECK(o_conv_12->arr_len == 64);
12156                 memcpy(o_conv_12_ref.compact_form, o_conv_12->elems, 64); FREE(o_conv_12);
12157                 o_constr.data[m] = o_conv_12_ref;
12158         }
12159         FREE(o);
12160         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12161         *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
12162         return tag_ptr(ret_conv, true);
12163 }
12164
12165 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_err"))) TS_CResult_CVec_SignatureZNoneZ_err() {
12166         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12167         *ret_conv = CResult_CVec_SignatureZNoneZ_err();
12168         return tag_ptr(ret_conv, true);
12169 }
12170
12171 jboolean  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_is_ok"))) TS_CResult_CVec_SignatureZNoneZ_is_ok(uint64_t o) {
12172         LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(o);
12173         jboolean ret_conv = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
12174         return ret_conv;
12175 }
12176
12177 void  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_free"))) TS_CResult_CVec_SignatureZNoneZ_free(uint64_t _res) {
12178         if (!ptr_is_owned(_res)) return;
12179         void* _res_ptr = untag_ptr(_res);
12180         CHECK_ACCESS(_res_ptr);
12181         LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
12182         FREE(untag_ptr(_res));
12183         CResult_CVec_SignatureZNoneZ_free(_res_conv);
12184 }
12185
12186 static inline uint64_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
12187         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12188         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
12189         return tag_ptr(ret_conv, true);
12190 }
12191 int64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone_ptr"))) TS_CResult_CVec_SignatureZNoneZ_clone_ptr(uint64_t arg) {
12192         LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(arg);
12193         int64_t ret_conv = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
12194         return ret_conv;
12195 }
12196
12197 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint64_t orig) {
12198         LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(orig);
12199         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12200         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
12201         return tag_ptr(ret_conv, true);
12202 }
12203
12204 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint64_t o) {
12205         LDKShutdownScript o_conv;
12206         o_conv.inner = untag_ptr(o);
12207         o_conv.is_owned = ptr_is_owned(o);
12208         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12209         o_conv = ShutdownScript_clone(&o_conv);
12210         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12211         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
12212         return tag_ptr(ret_conv, true);
12213 }
12214
12215 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint64_t e) {
12216         LDKDecodeError e_conv;
12217         e_conv.inner = untag_ptr(e);
12218         e_conv.is_owned = ptr_is_owned(e);
12219         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12220         e_conv = DecodeError_clone(&e_conv);
12221         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12222         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
12223         return tag_ptr(ret_conv, true);
12224 }
12225
12226 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_is_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint64_t o) {
12227         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
12228         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
12229         return ret_conv;
12230 }
12231
12232 void  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_free"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint64_t _res) {
12233         if (!ptr_is_owned(_res)) return;
12234         void* _res_ptr = untag_ptr(_res);
12235         CHECK_ACCESS(_res_ptr);
12236         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
12237         FREE(untag_ptr(_res));
12238         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
12239 }
12240
12241 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
12242         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12243         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
12244         return tag_ptr(ret_conv, true);
12245 }
12246 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint64_t arg) {
12247         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
12248         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
12249         return ret_conv;
12250 }
12251
12252 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint64_t orig) {
12253         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
12254         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
12255         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
12256         return tag_ptr(ret_conv, true);
12257 }
12258
12259 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint64_t o) {
12260         LDKShutdownScript o_conv;
12261         o_conv.inner = untag_ptr(o);
12262         o_conv.is_owned = ptr_is_owned(o);
12263         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12264         o_conv = ShutdownScript_clone(&o_conv);
12265         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12266         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
12267         return tag_ptr(ret_conv, true);
12268 }
12269
12270 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint64_t e) {
12271         LDKInvalidShutdownScript e_conv;
12272         e_conv.inner = untag_ptr(e);
12273         e_conv.is_owned = ptr_is_owned(e);
12274         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12275         e_conv = InvalidShutdownScript_clone(&e_conv);
12276         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12277         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
12278         return tag_ptr(ret_conv, true);
12279 }
12280
12281 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint64_t o) {
12282         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
12283         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
12284         return ret_conv;
12285 }
12286
12287 void  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint64_t _res) {
12288         if (!ptr_is_owned(_res)) return;
12289         void* _res_ptr = untag_ptr(_res);
12290         CHECK_ACCESS(_res_ptr);
12291         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
12292         FREE(untag_ptr(_res));
12293         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
12294 }
12295
12296 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
12297         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12298         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
12299         return tag_ptr(ret_conv, true);
12300 }
12301 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint64_t arg) {
12302         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
12303         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
12304         return ret_conv;
12305 }
12306
12307 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint64_t orig) {
12308         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
12309         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
12310         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
12311         return tag_ptr(ret_conv, true);
12312 }
12313
12314 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_ok"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint64_t o) {
12315         LDKRouteHop o_conv;
12316         o_conv.inner = untag_ptr(o);
12317         o_conv.is_owned = ptr_is_owned(o);
12318         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12319         o_conv = RouteHop_clone(&o_conv);
12320         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12321         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
12322         return tag_ptr(ret_conv, true);
12323 }
12324
12325 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_err"))) TS_CResult_RouteHopDecodeErrorZ_err(uint64_t e) {
12326         LDKDecodeError e_conv;
12327         e_conv.inner = untag_ptr(e);
12328         e_conv.is_owned = ptr_is_owned(e);
12329         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12330         e_conv = DecodeError_clone(&e_conv);
12331         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12332         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
12333         return tag_ptr(ret_conv, true);
12334 }
12335
12336 jboolean  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint64_t o) {
12337         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
12338         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
12339         return ret_conv;
12340 }
12341
12342 void  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_free"))) TS_CResult_RouteHopDecodeErrorZ_free(uint64_t _res) {
12343         if (!ptr_is_owned(_res)) return;
12344         void* _res_ptr = untag_ptr(_res);
12345         CHECK_ACCESS(_res_ptr);
12346         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
12347         FREE(untag_ptr(_res));
12348         CResult_RouteHopDecodeErrorZ_free(_res_conv);
12349 }
12350
12351 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
12352         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12353         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
12354         return tag_ptr(ret_conv, true);
12355 }
12356 int64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint64_t arg) {
12357         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
12358         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
12359         return ret_conv;
12360 }
12361
12362 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint64_t orig) {
12363         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
12364         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
12365         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
12366         return tag_ptr(ret_conv, true);
12367 }
12368
12369 void  __attribute__((export_name("TS_CVec_RouteHopZ_free"))) TS_CVec_RouteHopZ_free(uint64_tArray _res) {
12370         LDKCVec_RouteHopZ _res_constr;
12371         _res_constr.datalen = _res->arr_len;
12372         if (_res_constr.datalen > 0)
12373                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12374         else
12375                 _res_constr.data = NULL;
12376         uint64_t* _res_vals = _res->elems;
12377         for (size_t k = 0; k < _res_constr.datalen; k++) {
12378                 uint64_t _res_conv_10 = _res_vals[k];
12379                 LDKRouteHop _res_conv_10_conv;
12380                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
12381                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
12382                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
12383                 _res_constr.data[k] = _res_conv_10_conv;
12384         }
12385         FREE(_res);
12386         CVec_RouteHopZ_free(_res_constr);
12387 }
12388
12389 void  __attribute__((export_name("TS_CVec_CVec_RouteHopZZ_free"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) {
12390         LDKCVec_CVec_RouteHopZZ _res_constr;
12391         _res_constr.datalen = _res->arr_len;
12392         if (_res_constr.datalen > 0)
12393                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
12394         else
12395                 _res_constr.data = NULL;
12396         uint64_tArray* _res_vals = (void*) _res->elems;
12397         for (size_t m = 0; m < _res_constr.datalen; m++) {
12398                 uint64_tArray _res_conv_12 = _res_vals[m];
12399                 LDKCVec_RouteHopZ _res_conv_12_constr;
12400                 _res_conv_12_constr.datalen = _res_conv_12->arr_len;
12401                 if (_res_conv_12_constr.datalen > 0)
12402                         _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12403                 else
12404                         _res_conv_12_constr.data = NULL;
12405                 uint64_t* _res_conv_12_vals = _res_conv_12->elems;
12406                 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
12407                         uint64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
12408                         LDKRouteHop _res_conv_12_conv_10_conv;
12409                         _res_conv_12_conv_10_conv.inner = untag_ptr(_res_conv_12_conv_10);
12410                         _res_conv_12_conv_10_conv.is_owned = ptr_is_owned(_res_conv_12_conv_10);
12411                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv);
12412                         _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
12413                 }
12414                 FREE(_res_conv_12);
12415                 _res_constr.data[m] = _res_conv_12_constr;
12416         }
12417         FREE(_res);
12418         CVec_CVec_RouteHopZZ_free(_res_constr);
12419 }
12420
12421 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_ok"))) TS_CResult_RouteDecodeErrorZ_ok(uint64_t o) {
12422         LDKRoute o_conv;
12423         o_conv.inner = untag_ptr(o);
12424         o_conv.is_owned = ptr_is_owned(o);
12425         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12426         o_conv = Route_clone(&o_conv);
12427         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12428         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
12429         return tag_ptr(ret_conv, true);
12430 }
12431
12432 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_err"))) TS_CResult_RouteDecodeErrorZ_err(uint64_t e) {
12433         LDKDecodeError e_conv;
12434         e_conv.inner = untag_ptr(e);
12435         e_conv.is_owned = ptr_is_owned(e);
12436         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12437         e_conv = DecodeError_clone(&e_conv);
12438         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12439         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
12440         return tag_ptr(ret_conv, true);
12441 }
12442
12443 jboolean  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_is_ok"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint64_t o) {
12444         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
12445         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
12446         return ret_conv;
12447 }
12448
12449 void  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_free"))) TS_CResult_RouteDecodeErrorZ_free(uint64_t _res) {
12450         if (!ptr_is_owned(_res)) return;
12451         void* _res_ptr = untag_ptr(_res);
12452         CHECK_ACCESS(_res_ptr);
12453         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
12454         FREE(untag_ptr(_res));
12455         CResult_RouteDecodeErrorZ_free(_res_conv);
12456 }
12457
12458 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
12459         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12460         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
12461         return tag_ptr(ret_conv, true);
12462 }
12463 int64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone_ptr"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint64_t arg) {
12464         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
12465         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
12466         return ret_conv;
12467 }
12468
12469 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone"))) TS_CResult_RouteDecodeErrorZ_clone(uint64_t orig) {
12470         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
12471         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
12472         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
12473         return tag_ptr(ret_conv, true);
12474 }
12475
12476 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_ok"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint64_t o) {
12477         LDKRouteParameters o_conv;
12478         o_conv.inner = untag_ptr(o);
12479         o_conv.is_owned = ptr_is_owned(o);
12480         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12481         o_conv = RouteParameters_clone(&o_conv);
12482         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12483         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
12484         return tag_ptr(ret_conv, true);
12485 }
12486
12487 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_err"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint64_t e) {
12488         LDKDecodeError e_conv;
12489         e_conv.inner = untag_ptr(e);
12490         e_conv.is_owned = ptr_is_owned(e);
12491         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12492         e_conv = DecodeError_clone(&e_conv);
12493         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12494         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
12495         return tag_ptr(ret_conv, true);
12496 }
12497
12498 jboolean  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_is_ok"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint64_t o) {
12499         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
12500         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
12501         return ret_conv;
12502 }
12503
12504 void  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_free"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint64_t _res) {
12505         if (!ptr_is_owned(_res)) return;
12506         void* _res_ptr = untag_ptr(_res);
12507         CHECK_ACCESS(_res_ptr);
12508         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
12509         FREE(untag_ptr(_res));
12510         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
12511 }
12512
12513 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
12514         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12515         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
12516         return tag_ptr(ret_conv, true);
12517 }
12518 int64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone_ptr"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
12519         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
12520         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
12521         return ret_conv;
12522 }
12523
12524 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint64_t orig) {
12525         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
12526         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
12527         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
12528         return tag_ptr(ret_conv, true);
12529 }
12530
12531 void  __attribute__((export_name("TS_CVec_RouteHintZ_free"))) TS_CVec_RouteHintZ_free(uint64_tArray _res) {
12532         LDKCVec_RouteHintZ _res_constr;
12533         _res_constr.datalen = _res->arr_len;
12534         if (_res_constr.datalen > 0)
12535                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
12536         else
12537                 _res_constr.data = NULL;
12538         uint64_t* _res_vals = _res->elems;
12539         for (size_t l = 0; l < _res_constr.datalen; l++) {
12540                 uint64_t _res_conv_11 = _res_vals[l];
12541                 LDKRouteHint _res_conv_11_conv;
12542                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
12543                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
12544                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
12545                 _res_constr.data[l] = _res_conv_11_conv;
12546         }
12547         FREE(_res);
12548         CVec_RouteHintZ_free(_res_constr);
12549 }
12550
12551 uint64_t  __attribute__((export_name("TS_COption_u64Z_some"))) TS_COption_u64Z_some(int64_t o) {
12552         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12553         *ret_copy = COption_u64Z_some(o);
12554         uint64_t ret_ref = tag_ptr(ret_copy, true);
12555         return ret_ref;
12556 }
12557
12558 uint64_t  __attribute__((export_name("TS_COption_u64Z_none"))) TS_COption_u64Z_none() {
12559         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12560         *ret_copy = COption_u64Z_none();
12561         uint64_t ret_ref = tag_ptr(ret_copy, true);
12562         return ret_ref;
12563 }
12564
12565 void  __attribute__((export_name("TS_COption_u64Z_free"))) TS_COption_u64Z_free(uint64_t _res) {
12566         if (!ptr_is_owned(_res)) return;
12567         void* _res_ptr = untag_ptr(_res);
12568         CHECK_ACCESS(_res_ptr);
12569         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
12570         FREE(untag_ptr(_res));
12571         COption_u64Z_free(_res_conv);
12572 }
12573
12574 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
12575         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12576         *ret_copy = COption_u64Z_clone(arg);
12577         uint64_t ret_ref = tag_ptr(ret_copy, true);
12578         return ret_ref;
12579 }
12580 int64_t  __attribute__((export_name("TS_COption_u64Z_clone_ptr"))) TS_COption_u64Z_clone_ptr(uint64_t arg) {
12581         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
12582         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
12583         return ret_conv;
12584 }
12585
12586 uint64_t  __attribute__((export_name("TS_COption_u64Z_clone"))) TS_COption_u64Z_clone(uint64_t orig) {
12587         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
12588         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
12589         *ret_copy = COption_u64Z_clone(orig_conv);
12590         uint64_t ret_ref = tag_ptr(ret_copy, true);
12591         return ret_ref;
12592 }
12593
12594 void  __attribute__((export_name("TS_CVec_u64Z_free"))) TS_CVec_u64Z_free(int64_tArray _res) {
12595         LDKCVec_u64Z _res_constr;
12596         _res_constr.datalen = _res->arr_len;
12597         if (_res_constr.datalen > 0)
12598                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
12599         else
12600                 _res_constr.data = NULL;
12601         int64_t* _res_vals = _res->elems;
12602         for (size_t i = 0; i < _res_constr.datalen; i++) {
12603                 int64_t _res_conv_8 = _res_vals[i];
12604                 _res_constr.data[i] = _res_conv_8;
12605         }
12606         FREE(_res);
12607         CVec_u64Z_free(_res_constr);
12608 }
12609
12610 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_ok(uint64_t o) {
12611         LDKPaymentParameters o_conv;
12612         o_conv.inner = untag_ptr(o);
12613         o_conv.is_owned = ptr_is_owned(o);
12614         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12615         o_conv = PaymentParameters_clone(&o_conv);
12616         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
12617         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
12618         return tag_ptr(ret_conv, true);
12619 }
12620
12621 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_err"))) TS_CResult_PaymentParametersDecodeErrorZ_err(uint64_t e) {
12622         LDKDecodeError e_conv;
12623         e_conv.inner = untag_ptr(e);
12624         e_conv.is_owned = ptr_is_owned(e);
12625         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12626         e_conv = DecodeError_clone(&e_conv);
12627         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
12628         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
12629         return tag_ptr(ret_conv, true);
12630 }
12631
12632 jboolean  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_is_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_is_ok(uint64_t o) {
12633         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
12634         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
12635         return ret_conv;
12636 }
12637
12638 void  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_free"))) TS_CResult_PaymentParametersDecodeErrorZ_free(uint64_t _res) {
12639         if (!ptr_is_owned(_res)) return;
12640         void* _res_ptr = untag_ptr(_res);
12641         CHECK_ACCESS(_res_ptr);
12642         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
12643         FREE(untag_ptr(_res));
12644         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
12645 }
12646
12647 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
12648         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
12649         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
12650         return tag_ptr(ret_conv, true);
12651 }
12652 int64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
12653         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
12654         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
12655         return ret_conv;
12656 }
12657
12658 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone"))) TS_CResult_PaymentParametersDecodeErrorZ_clone(uint64_t orig) {
12659         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
12660         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
12661         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
12662         return tag_ptr(ret_conv, true);
12663 }
12664
12665 void  __attribute__((export_name("TS_CVec_RouteHintHopZ_free"))) TS_CVec_RouteHintHopZ_free(uint64_tArray _res) {
12666         LDKCVec_RouteHintHopZ _res_constr;
12667         _res_constr.datalen = _res->arr_len;
12668         if (_res_constr.datalen > 0)
12669                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
12670         else
12671                 _res_constr.data = NULL;
12672         uint64_t* _res_vals = _res->elems;
12673         for (size_t o = 0; o < _res_constr.datalen; o++) {
12674                 uint64_t _res_conv_14 = _res_vals[o];
12675                 LDKRouteHintHop _res_conv_14_conv;
12676                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
12677                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
12678                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
12679                 _res_constr.data[o] = _res_conv_14_conv;
12680         }
12681         FREE(_res);
12682         CVec_RouteHintHopZ_free(_res_constr);
12683 }
12684
12685 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_ok"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint64_t o) {
12686         LDKRouteHint o_conv;
12687         o_conv.inner = untag_ptr(o);
12688         o_conv.is_owned = ptr_is_owned(o);
12689         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12690         o_conv = RouteHint_clone(&o_conv);
12691         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12692         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
12693         return tag_ptr(ret_conv, true);
12694 }
12695
12696 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_err"))) TS_CResult_RouteHintDecodeErrorZ_err(uint64_t e) {
12697         LDKDecodeError e_conv;
12698         e_conv.inner = untag_ptr(e);
12699         e_conv.is_owned = ptr_is_owned(e);
12700         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12701         e_conv = DecodeError_clone(&e_conv);
12702         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12703         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
12704         return tag_ptr(ret_conv, true);
12705 }
12706
12707 jboolean  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_is_ok"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint64_t o) {
12708         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
12709         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
12710         return ret_conv;
12711 }
12712
12713 void  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_free"))) TS_CResult_RouteHintDecodeErrorZ_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_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
12718         FREE(untag_ptr(_res));
12719         CResult_RouteHintDecodeErrorZ_free(_res_conv);
12720 }
12721
12722 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
12723         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12724         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
12725         return tag_ptr(ret_conv, true);
12726 }
12727 int64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint64_t arg) {
12728         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
12729         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
12730         return ret_conv;
12731 }
12732
12733 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint64_t orig) {
12734         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
12735         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
12736         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
12737         return tag_ptr(ret_conv, true);
12738 }
12739
12740 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint64_t o) {
12741         LDKRouteHintHop o_conv;
12742         o_conv.inner = untag_ptr(o);
12743         o_conv.is_owned = ptr_is_owned(o);
12744         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12745         o_conv = RouteHintHop_clone(&o_conv);
12746         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12747         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
12748         return tag_ptr(ret_conv, true);
12749 }
12750
12751 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_err"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint64_t e) {
12752         LDKDecodeError e_conv;
12753         e_conv.inner = untag_ptr(e);
12754         e_conv.is_owned = ptr_is_owned(e);
12755         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12756         e_conv = DecodeError_clone(&e_conv);
12757         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12758         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
12759         return tag_ptr(ret_conv, true);
12760 }
12761
12762 jboolean  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint64_t o) {
12763         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
12764         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
12765         return ret_conv;
12766 }
12767
12768 void  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_free"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint64_t _res) {
12769         if (!ptr_is_owned(_res)) return;
12770         void* _res_ptr = untag_ptr(_res);
12771         CHECK_ACCESS(_res_ptr);
12772         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
12773         FREE(untag_ptr(_res));
12774         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
12775 }
12776
12777 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
12778         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12779         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
12780         return tag_ptr(ret_conv, true);
12781 }
12782 int64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint64_t arg) {
12783         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
12784         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
12785         return ret_conv;
12786 }
12787
12788 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint64_t orig) {
12789         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
12790         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
12791         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
12792         return tag_ptr(ret_conv, true);
12793 }
12794
12795 void  __attribute__((export_name("TS_CVec_ChannelDetailsZ_free"))) TS_CVec_ChannelDetailsZ_free(uint64_tArray _res) {
12796         LDKCVec_ChannelDetailsZ _res_constr;
12797         _res_constr.datalen = _res->arr_len;
12798         if (_res_constr.datalen > 0)
12799                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
12800         else
12801                 _res_constr.data = NULL;
12802         uint64_t* _res_vals = _res->elems;
12803         for (size_t q = 0; q < _res_constr.datalen; q++) {
12804                 uint64_t _res_conv_16 = _res_vals[q];
12805                 LDKChannelDetails _res_conv_16_conv;
12806                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
12807                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
12808                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
12809                 _res_constr.data[q] = _res_conv_16_conv;
12810         }
12811         FREE(_res);
12812         CVec_ChannelDetailsZ_free(_res_constr);
12813 }
12814
12815 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_ok"))) TS_CResult_RouteLightningErrorZ_ok(uint64_t o) {
12816         LDKRoute o_conv;
12817         o_conv.inner = untag_ptr(o);
12818         o_conv.is_owned = ptr_is_owned(o);
12819         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
12820         o_conv = Route_clone(&o_conv);
12821         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12822         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
12823         return tag_ptr(ret_conv, true);
12824 }
12825
12826 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_err"))) TS_CResult_RouteLightningErrorZ_err(uint64_t e) {
12827         LDKLightningError e_conv;
12828         e_conv.inner = untag_ptr(e);
12829         e_conv.is_owned = ptr_is_owned(e);
12830         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12831         e_conv = LightningError_clone(&e_conv);
12832         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12833         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
12834         return tag_ptr(ret_conv, true);
12835 }
12836
12837 jboolean  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_is_ok"))) TS_CResult_RouteLightningErrorZ_is_ok(uint64_t o) {
12838         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
12839         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
12840         return ret_conv;
12841 }
12842
12843 void  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_free"))) TS_CResult_RouteLightningErrorZ_free(uint64_t _res) {
12844         if (!ptr_is_owned(_res)) return;
12845         void* _res_ptr = untag_ptr(_res);
12846         CHECK_ACCESS(_res_ptr);
12847         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
12848         FREE(untag_ptr(_res));
12849         CResult_RouteLightningErrorZ_free(_res_conv);
12850 }
12851
12852 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
12853         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12854         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
12855         return tag_ptr(ret_conv, true);
12856 }
12857 int64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone_ptr"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint64_t arg) {
12858         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
12859         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
12860         return ret_conv;
12861 }
12862
12863 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone"))) TS_CResult_RouteLightningErrorZ_clone(uint64_t orig) {
12864         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
12865         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12866         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
12867         return tag_ptr(ret_conv, true);
12868 }
12869
12870 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_ok(uint64_t o) {
12871         void* o_ptr = untag_ptr(o);
12872         CHECK_ACCESS(o_ptr);
12873         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
12874         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
12875         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
12876         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
12877         return tag_ptr(ret_conv, true);
12878 }
12879
12880 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_err(uint64_t e) {
12881         LDKDecodeError e_conv;
12882         e_conv.inner = untag_ptr(e);
12883         e_conv.is_owned = ptr_is_owned(e);
12884         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12885         e_conv = DecodeError_clone(&e_conv);
12886         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
12887         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
12888         return tag_ptr(ret_conv, true);
12889 }
12890
12891 jboolean  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_is_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_is_ok(uint64_t o) {
12892         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
12893         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
12894         return ret_conv;
12895 }
12896
12897 void  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_free"))) TS_CResult_PaymentPurposeDecodeErrorZ_free(uint64_t _res) {
12898         if (!ptr_is_owned(_res)) return;
12899         void* _res_ptr = untag_ptr(_res);
12900         CHECK_ACCESS(_res_ptr);
12901         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
12902         FREE(untag_ptr(_res));
12903         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
12904 }
12905
12906 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
12907         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
12908         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
12909         return tag_ptr(ret_conv, true);
12910 }
12911 int64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr(uint64_t arg) {
12912         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
12913         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
12914         return ret_conv;
12915 }
12916
12917 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone(uint64_t orig) {
12918         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
12919         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
12920         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
12921         return tag_ptr(ret_conv, true);
12922 }
12923
12924 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_some"))) TS_COption_ClosureReasonZ_some(uint64_t o) {
12925         void* o_ptr = untag_ptr(o);
12926         CHECK_ACCESS(o_ptr);
12927         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
12928         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
12929         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12930         *ret_copy = COption_ClosureReasonZ_some(o_conv);
12931         uint64_t ret_ref = tag_ptr(ret_copy, true);
12932         return ret_ref;
12933 }
12934
12935 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_none"))) TS_COption_ClosureReasonZ_none() {
12936         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12937         *ret_copy = COption_ClosureReasonZ_none();
12938         uint64_t ret_ref = tag_ptr(ret_copy, true);
12939         return ret_ref;
12940 }
12941
12942 void  __attribute__((export_name("TS_COption_ClosureReasonZ_free"))) TS_COption_ClosureReasonZ_free(uint64_t _res) {
12943         if (!ptr_is_owned(_res)) return;
12944         void* _res_ptr = untag_ptr(_res);
12945         CHECK_ACCESS(_res_ptr);
12946         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
12947         FREE(untag_ptr(_res));
12948         COption_ClosureReasonZ_free(_res_conv);
12949 }
12950
12951 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
12952         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12953         *ret_copy = COption_ClosureReasonZ_clone(arg);
12954         uint64_t ret_ref = tag_ptr(ret_copy, true);
12955         return ret_ref;
12956 }
12957 int64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone_ptr"))) TS_COption_ClosureReasonZ_clone_ptr(uint64_t arg) {
12958         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
12959         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
12960         return ret_conv;
12961 }
12962
12963 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone"))) TS_COption_ClosureReasonZ_clone(uint64_t orig) {
12964         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
12965         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
12966         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
12967         uint64_t ret_ref = tag_ptr(ret_copy, true);
12968         return ret_ref;
12969 }
12970
12971 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint64_t o) {
12972         void* o_ptr = untag_ptr(o);
12973         CHECK_ACCESS(o_ptr);
12974         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
12975         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
12976         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12977         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
12978         return tag_ptr(ret_conv, true);
12979 }
12980
12981 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint64_t e) {
12982         LDKDecodeError e_conv;
12983         e_conv.inner = untag_ptr(e);
12984         e_conv.is_owned = ptr_is_owned(e);
12985         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
12986         e_conv = DecodeError_clone(&e_conv);
12987         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
12988         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
12989         return tag_ptr(ret_conv, true);
12990 }
12991
12992 jboolean  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint64_t o) {
12993         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
12994         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
12995         return ret_conv;
12996 }
12997
12998 void  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_free"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint64_t _res) {
12999         if (!ptr_is_owned(_res)) return;
13000         void* _res_ptr = untag_ptr(_res);
13001         CHECK_ACCESS(_res_ptr);
13002         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
13003         FREE(untag_ptr(_res));
13004         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
13005 }
13006
13007 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
13008         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13009         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
13010         return tag_ptr(ret_conv, true);
13011 }
13012 int64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint64_t arg) {
13013         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
13014         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
13015         return ret_conv;
13016 }
13017
13018 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint64_t orig) {
13019         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
13020         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
13021         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
13022         return tag_ptr(ret_conv, true);
13023 }
13024
13025 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_some"))) TS_COption_HTLCDestinationZ_some(uint64_t o) {
13026         void* o_ptr = untag_ptr(o);
13027         CHECK_ACCESS(o_ptr);
13028         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
13029         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
13030         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13031         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
13032         uint64_t ret_ref = tag_ptr(ret_copy, true);
13033         return ret_ref;
13034 }
13035
13036 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_none"))) TS_COption_HTLCDestinationZ_none() {
13037         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13038         *ret_copy = COption_HTLCDestinationZ_none();
13039         uint64_t ret_ref = tag_ptr(ret_copy, true);
13040         return ret_ref;
13041 }
13042
13043 void  __attribute__((export_name("TS_COption_HTLCDestinationZ_free"))) TS_COption_HTLCDestinationZ_free(uint64_t _res) {
13044         if (!ptr_is_owned(_res)) return;
13045         void* _res_ptr = untag_ptr(_res);
13046         CHECK_ACCESS(_res_ptr);
13047         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
13048         FREE(untag_ptr(_res));
13049         COption_HTLCDestinationZ_free(_res_conv);
13050 }
13051
13052 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
13053         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13054         *ret_copy = COption_HTLCDestinationZ_clone(arg);
13055         uint64_t ret_ref = tag_ptr(ret_copy, true);
13056         return ret_ref;
13057 }
13058 int64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone_ptr"))) TS_COption_HTLCDestinationZ_clone_ptr(uint64_t arg) {
13059         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
13060         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
13061         return ret_conv;
13062 }
13063
13064 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone"))) TS_COption_HTLCDestinationZ_clone(uint64_t orig) {
13065         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
13066         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
13067         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
13068         uint64_t ret_ref = tag_ptr(ret_copy, true);
13069         return ret_ref;
13070 }
13071
13072 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok(uint64_t o) {
13073         void* o_ptr = untag_ptr(o);
13074         CHECK_ACCESS(o_ptr);
13075         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
13076         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
13077         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13078         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
13079         return tag_ptr(ret_conv, true);
13080 }
13081
13082 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err(uint64_t e) {
13083         LDKDecodeError e_conv;
13084         e_conv.inner = untag_ptr(e);
13085         e_conv.is_owned = ptr_is_owned(e);
13086         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13087         e_conv = DecodeError_clone(&e_conv);
13088         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13089         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
13090         return tag_ptr(ret_conv, true);
13091 }
13092
13093 jboolean  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(uint64_t o) {
13094         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
13095         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
13096         return ret_conv;
13097 }
13098
13099 void  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_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_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
13104         FREE(untag_ptr(_res));
13105         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
13106 }
13107
13108 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
13109         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13110         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
13111         return tag_ptr(ret_conv, true);
13112 }
13113 int64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(uint64_t arg) {
13114         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
13115         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
13116         return ret_conv;
13117 }
13118
13119 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone(uint64_t orig) {
13120         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
13121         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
13122         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
13123         return tag_ptr(ret_conv, true);
13124 }
13125
13126 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_some"))) TS_COption_NetworkUpdateZ_some(uint64_t o) {
13127         void* o_ptr = untag_ptr(o);
13128         CHECK_ACCESS(o_ptr);
13129         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
13130         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
13131         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13132         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
13133         uint64_t ret_ref = tag_ptr(ret_copy, true);
13134         return ret_ref;
13135 }
13136
13137 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_none"))) TS_COption_NetworkUpdateZ_none() {
13138         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13139         *ret_copy = COption_NetworkUpdateZ_none();
13140         uint64_t ret_ref = tag_ptr(ret_copy, true);
13141         return ret_ref;
13142 }
13143
13144 void  __attribute__((export_name("TS_COption_NetworkUpdateZ_free"))) TS_COption_NetworkUpdateZ_free(uint64_t _res) {
13145         if (!ptr_is_owned(_res)) return;
13146         void* _res_ptr = untag_ptr(_res);
13147         CHECK_ACCESS(_res_ptr);
13148         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
13149         FREE(untag_ptr(_res));
13150         COption_NetworkUpdateZ_free(_res_conv);
13151 }
13152
13153 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
13154         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13155         *ret_copy = COption_NetworkUpdateZ_clone(arg);
13156         uint64_t ret_ref = tag_ptr(ret_copy, true);
13157         return ret_ref;
13158 }
13159 int64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone_ptr"))) TS_COption_NetworkUpdateZ_clone_ptr(uint64_t arg) {
13160         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
13161         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
13162         return ret_conv;
13163 }
13164
13165 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone"))) TS_COption_NetworkUpdateZ_clone(uint64_t orig) {
13166         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
13167         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
13168         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
13169         uint64_t ret_ref = tag_ptr(ret_copy, true);
13170         return ret_ref;
13171 }
13172
13173 void  __attribute__((export_name("TS_CVec_SpendableOutputDescriptorZ_free"))) TS_CVec_SpendableOutputDescriptorZ_free(uint64_tArray _res) {
13174         LDKCVec_SpendableOutputDescriptorZ _res_constr;
13175         _res_constr.datalen = _res->arr_len;
13176         if (_res_constr.datalen > 0)
13177                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
13178         else
13179                 _res_constr.data = NULL;
13180         uint64_t* _res_vals = _res->elems;
13181         for (size_t b = 0; b < _res_constr.datalen; b++) {
13182                 uint64_t _res_conv_27 = _res_vals[b];
13183                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
13184                 CHECK_ACCESS(_res_conv_27_ptr);
13185                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
13186                 FREE(untag_ptr(_res_conv_27));
13187                 _res_constr.data[b] = _res_conv_27_conv;
13188         }
13189         FREE(_res);
13190         CVec_SpendableOutputDescriptorZ_free(_res_constr);
13191 }
13192
13193 uint64_t  __attribute__((export_name("TS_COption_EventZ_some"))) TS_COption_EventZ_some(uint64_t o) {
13194         void* o_ptr = untag_ptr(o);
13195         CHECK_ACCESS(o_ptr);
13196         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
13197         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
13198         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13199         *ret_copy = COption_EventZ_some(o_conv);
13200         uint64_t ret_ref = tag_ptr(ret_copy, true);
13201         return ret_ref;
13202 }
13203
13204 uint64_t  __attribute__((export_name("TS_COption_EventZ_none"))) TS_COption_EventZ_none() {
13205         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13206         *ret_copy = COption_EventZ_none();
13207         uint64_t ret_ref = tag_ptr(ret_copy, true);
13208         return ret_ref;
13209 }
13210
13211 void  __attribute__((export_name("TS_COption_EventZ_free"))) TS_COption_EventZ_free(uint64_t _res) {
13212         if (!ptr_is_owned(_res)) return;
13213         void* _res_ptr = untag_ptr(_res);
13214         CHECK_ACCESS(_res_ptr);
13215         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
13216         FREE(untag_ptr(_res));
13217         COption_EventZ_free(_res_conv);
13218 }
13219
13220 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
13221         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13222         *ret_copy = COption_EventZ_clone(arg);
13223         uint64_t ret_ref = tag_ptr(ret_copy, true);
13224         return ret_ref;
13225 }
13226 int64_t  __attribute__((export_name("TS_COption_EventZ_clone_ptr"))) TS_COption_EventZ_clone_ptr(uint64_t arg) {
13227         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
13228         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
13229         return ret_conv;
13230 }
13231
13232 uint64_t  __attribute__((export_name("TS_COption_EventZ_clone"))) TS_COption_EventZ_clone(uint64_t orig) {
13233         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
13234         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
13235         *ret_copy = COption_EventZ_clone(orig_conv);
13236         uint64_t ret_ref = tag_ptr(ret_copy, true);
13237         return ret_ref;
13238 }
13239
13240 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_ok"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint64_t o) {
13241         void* o_ptr = untag_ptr(o);
13242         CHECK_ACCESS(o_ptr);
13243         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
13244         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
13245         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13246         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
13247         return tag_ptr(ret_conv, true);
13248 }
13249
13250 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_err"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint64_t e) {
13251         LDKDecodeError e_conv;
13252         e_conv.inner = untag_ptr(e);
13253         e_conv.is_owned = ptr_is_owned(e);
13254         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13255         e_conv = DecodeError_clone(&e_conv);
13256         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13257         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
13258         return tag_ptr(ret_conv, true);
13259 }
13260
13261 jboolean  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_is_ok"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint64_t o) {
13262         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
13263         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
13264         return ret_conv;
13265 }
13266
13267 void  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_free"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint64_t _res) {
13268         if (!ptr_is_owned(_res)) return;
13269         void* _res_ptr = untag_ptr(_res);
13270         CHECK_ACCESS(_res_ptr);
13271         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
13272         FREE(untag_ptr(_res));
13273         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
13274 }
13275
13276 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
13277         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13278         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
13279         return tag_ptr(ret_conv, true);
13280 }
13281 int64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint64_t arg) {
13282         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
13283         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
13284         return ret_conv;
13285 }
13286
13287 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint64_t orig) {
13288         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
13289         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
13290         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
13291         return tag_ptr(ret_conv, true);
13292 }
13293
13294 void  __attribute__((export_name("TS_CVec_MessageSendEventZ_free"))) TS_CVec_MessageSendEventZ_free(uint64_tArray _res) {
13295         LDKCVec_MessageSendEventZ _res_constr;
13296         _res_constr.datalen = _res->arr_len;
13297         if (_res_constr.datalen > 0)
13298                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
13299         else
13300                 _res_constr.data = NULL;
13301         uint64_t* _res_vals = _res->elems;
13302         for (size_t s = 0; s < _res_constr.datalen; s++) {
13303                 uint64_t _res_conv_18 = _res_vals[s];
13304                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
13305                 CHECK_ACCESS(_res_conv_18_ptr);
13306                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
13307                 FREE(untag_ptr(_res_conv_18));
13308                 _res_constr.data[s] = _res_conv_18_conv;
13309         }
13310         FREE(_res);
13311         CVec_MessageSendEventZ_free(_res_constr);
13312 }
13313
13314 uint64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_ok"))) TS_CResult_TxOutAccessErrorZ_ok(uint64_t o) {
13315         void* o_ptr = untag_ptr(o);
13316         CHECK_ACCESS(o_ptr);
13317         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
13318         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
13319         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
13320         *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
13321         return tag_ptr(ret_conv, true);
13322 }
13323
13324 uint64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_err"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) {
13325         LDKAccessError e_conv = LDKAccessError_from_js(e);
13326         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
13327         *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
13328         return tag_ptr(ret_conv, true);
13329 }
13330
13331 jboolean  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_is_ok"))) TS_CResult_TxOutAccessErrorZ_is_ok(uint64_t o) {
13332         LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(o);
13333         jboolean ret_conv = CResult_TxOutAccessErrorZ_is_ok(o_conv);
13334         return ret_conv;
13335 }
13336
13337 void  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_free"))) TS_CResult_TxOutAccessErrorZ_free(uint64_t _res) {
13338         if (!ptr_is_owned(_res)) return;
13339         void* _res_ptr = untag_ptr(_res);
13340         CHECK_ACCESS(_res_ptr);
13341         LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr);
13342         FREE(untag_ptr(_res));
13343         CResult_TxOutAccessErrorZ_free(_res_conv);
13344 }
13345
13346 static inline uint64_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) {
13347         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
13348         *ret_conv = CResult_TxOutAccessErrorZ_clone(arg);
13349         return tag_ptr(ret_conv, true);
13350 }
13351 int64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone_ptr"))) TS_CResult_TxOutAccessErrorZ_clone_ptr(uint64_t arg) {
13352         LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(arg);
13353         int64_t ret_conv = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv);
13354         return ret_conv;
13355 }
13356
13357 uint64_t  __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone"))) TS_CResult_TxOutAccessErrorZ_clone(uint64_t orig) {
13358         LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(orig);
13359         LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
13360         *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
13361         return tag_ptr(ret_conv, true);
13362 }
13363
13364 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
13365         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13366         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
13367         return tag_ptr(ret_conv, true);
13368 }
13369 int64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone_ptr"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint64_t arg) {
13370         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
13371         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
13372         return ret_conv;
13373 }
13374
13375 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone"))) TS_C2Tuple_usizeTransactionZ_clone(uint64_t orig) {
13376         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
13377         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13378         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
13379         return tag_ptr(ret_conv, true);
13380 }
13381
13382 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_new"))) TS_C2Tuple_usizeTransactionZ_new(uint32_t a, int8_tArray b) {
13383         LDKTransaction b_ref;
13384         b_ref.datalen = b->arr_len;
13385         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
13386         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
13387         b_ref.data_is_owned = true;
13388         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
13389         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
13390         return tag_ptr(ret_conv, true);
13391 }
13392
13393 void  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_free"))) TS_C2Tuple_usizeTransactionZ_free(uint64_t _res) {
13394         if (!ptr_is_owned(_res)) return;
13395         void* _res_ptr = untag_ptr(_res);
13396         CHECK_ACCESS(_res_ptr);
13397         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
13398         FREE(untag_ptr(_res));
13399         C2Tuple_usizeTransactionZ_free(_res_conv);
13400 }
13401
13402 void  __attribute__((export_name("TS_CVec_C2Tuple_usizeTransactionZZ_free"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint64_tArray _res) {
13403         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
13404         _res_constr.datalen = _res->arr_len;
13405         if (_res_constr.datalen > 0)
13406                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
13407         else
13408                 _res_constr.data = NULL;
13409         uint64_t* _res_vals = _res->elems;
13410         for (size_t c = 0; c < _res_constr.datalen; c++) {
13411                 uint64_t _res_conv_28 = _res_vals[c];
13412                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
13413                 CHECK_ACCESS(_res_conv_28_ptr);
13414                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
13415                 FREE(untag_ptr(_res_conv_28));
13416                 _res_constr.data[c] = _res_conv_28_conv;
13417         }
13418         FREE(_res);
13419         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
13420 }
13421
13422 void  __attribute__((export_name("TS_CVec_TxidZ_free"))) TS_CVec_TxidZ_free(ptrArray _res) {
13423         LDKCVec_TxidZ _res_constr;
13424         _res_constr.datalen = _res->arr_len;
13425         if (_res_constr.datalen > 0)
13426                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
13427         else
13428                 _res_constr.data = NULL;
13429         int8_tArray* _res_vals = (void*) _res->elems;
13430         for (size_t m = 0; m < _res_constr.datalen; m++) {
13431                 int8_tArray _res_conv_12 = _res_vals[m];
13432                 LDKThirtyTwoBytes _res_conv_12_ref;
13433                 CHECK(_res_conv_12->arr_len == 32);
13434                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
13435                 _res_constr.data[m] = _res_conv_12_ref;
13436         }
13437         FREE(_res);
13438         CVec_TxidZ_free(_res_constr);
13439 }
13440
13441 uint64_t  __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_ok() {
13442         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
13443         *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
13444         return tag_ptr(ret_conv, true);
13445 }
13446
13447 uint64_t  __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_err"))) TS_CResult_NoneChannelMonitorUpdateErrZ_err(uint32_t e) {
13448         LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_js(e);
13449         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
13450         *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
13451         return tag_ptr(ret_conv, true);
13452 }
13453
13454 jboolean  __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_is_ok"))) TS_CResult_NoneChannelMonitorUpdateErrZ_is_ok(uint64_t o) {
13455         LDKCResult_NoneChannelMonitorUpdateErrZ* o_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(o);
13456         jboolean ret_conv = CResult_NoneChannelMonitorUpdateErrZ_is_ok(o_conv);
13457         return ret_conv;
13458 }
13459
13460 void  __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_free"))) TS_CResult_NoneChannelMonitorUpdateErrZ_free(uint64_t _res) {
13461         if (!ptr_is_owned(_res)) return;
13462         void* _res_ptr = untag_ptr(_res);
13463         CHECK_ACCESS(_res_ptr);
13464         LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(_res_ptr);
13465         FREE(untag_ptr(_res));
13466         CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
13467 }
13468
13469 static inline uint64_t CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR arg) {
13470         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
13471         *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(arg);
13472         return tag_ptr(ret_conv, true);
13473 }
13474 int64_t  __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_clone_ptr"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(uint64_t arg) {
13475         LDKCResult_NoneChannelMonitorUpdateErrZ* arg_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(arg);
13476         int64_t ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(arg_conv);
13477         return ret_conv;
13478 }
13479
13480 uint64_t  __attribute__((export_name("TS_CResult_NoneChannelMonitorUpdateErrZ_clone"))) TS_CResult_NoneChannelMonitorUpdateErrZ_clone(uint64_t orig) {
13481         LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)untag_ptr(orig);
13482         LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
13483         *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
13484         return tag_ptr(ret_conv, true);
13485 }
13486
13487 void  __attribute__((export_name("TS_CVec_MonitorEventZ_free"))) TS_CVec_MonitorEventZ_free(uint64_tArray _res) {
13488         LDKCVec_MonitorEventZ _res_constr;
13489         _res_constr.datalen = _res->arr_len;
13490         if (_res_constr.datalen > 0)
13491                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
13492         else
13493                 _res_constr.data = NULL;
13494         uint64_t* _res_vals = _res->elems;
13495         for (size_t o = 0; o < _res_constr.datalen; o++) {
13496                 uint64_t _res_conv_14 = _res_vals[o];
13497                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
13498                 CHECK_ACCESS(_res_conv_14_ptr);
13499                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
13500                 FREE(untag_ptr(_res_conv_14));
13501                 _res_constr.data[o] = _res_conv_14_conv;
13502         }
13503         FREE(_res);
13504         CVec_MonitorEventZ_free(_res_constr);
13505 }
13506
13507 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
13508         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
13509         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
13510         return tag_ptr(ret_conv, true);
13511 }
13512 int64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(uint64_t arg) {
13513         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
13514         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
13515         return ret_conv;
13516 }
13517
13518 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(uint64_t orig) {
13519         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
13520         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
13521         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
13522         return tag_ptr(ret_conv, true);
13523 }
13524
13525 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(uint64_t a, uint64_tArray b, int8_tArray c) {
13526         LDKOutPoint a_conv;
13527         a_conv.inner = untag_ptr(a);
13528         a_conv.is_owned = ptr_is_owned(a);
13529         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
13530         a_conv = OutPoint_clone(&a_conv);
13531         LDKCVec_MonitorEventZ b_constr;
13532         b_constr.datalen = b->arr_len;
13533         if (b_constr.datalen > 0)
13534                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
13535         else
13536                 b_constr.data = NULL;
13537         uint64_t* b_vals = b->elems;
13538         for (size_t o = 0; o < b_constr.datalen; o++) {
13539                 uint64_t b_conv_14 = b_vals[o];
13540                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
13541                 CHECK_ACCESS(b_conv_14_ptr);
13542                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
13543                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
13544                 b_constr.data[o] = b_conv_14_conv;
13545         }
13546         FREE(b);
13547         LDKPublicKey c_ref;
13548         CHECK(c->arr_len == 33);
13549         memcpy(c_ref.compressed_form, c->elems, 33); FREE(c);
13550         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
13551         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
13552         return tag_ptr(ret_conv, true);
13553 }
13554
13555 void  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(uint64_t _res) {
13556         if (!ptr_is_owned(_res)) return;
13557         void* _res_ptr = untag_ptr(_res);
13558         CHECK_ACCESS(_res_ptr);
13559         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
13560         FREE(untag_ptr(_res));
13561         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
13562 }
13563
13564 void  __attribute__((export_name("TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free"))) TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(uint64_tArray _res) {
13565         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
13566         _res_constr.datalen = _res->arr_len;
13567         if (_res_constr.datalen > 0)
13568                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
13569         else
13570                 _res_constr.data = NULL;
13571         uint64_t* _res_vals = _res->elems;
13572         for (size_t x = 0; x < _res_constr.datalen; x++) {
13573                 uint64_t _res_conv_49 = _res_vals[x];
13574                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
13575                 CHECK_ACCESS(_res_conv_49_ptr);
13576                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
13577                 FREE(untag_ptr(_res_conv_49));
13578                 _res_constr.data[x] = _res_conv_49_conv;
13579         }
13580         FREE(_res);
13581         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
13582 }
13583
13584 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok(uint64_t o) {
13585         LDKFixedPenaltyScorer o_conv;
13586         o_conv.inner = untag_ptr(o);
13587         o_conv.is_owned = ptr_is_owned(o);
13588         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13589         o_conv = FixedPenaltyScorer_clone(&o_conv);
13590         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
13591         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
13592         return tag_ptr(ret_conv, true);
13593 }
13594
13595 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_err(uint64_t e) {
13596         LDKDecodeError e_conv;
13597         e_conv.inner = untag_ptr(e);
13598         e_conv.is_owned = ptr_is_owned(e);
13599         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13600         e_conv = DecodeError_clone(&e_conv);
13601         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
13602         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
13603         return tag_ptr(ret_conv, true);
13604 }
13605
13606 jboolean  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(uint64_t o) {
13607         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
13608         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
13609         return ret_conv;
13610 }
13611
13612 void  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_free"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_free(uint64_t _res) {
13613         if (!ptr_is_owned(_res)) return;
13614         void* _res_ptr = untag_ptr(_res);
13615         CHECK_ACCESS(_res_ptr);
13616         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
13617         FREE(untag_ptr(_res));
13618         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
13619 }
13620
13621 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
13622         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
13623         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
13624         return tag_ptr(ret_conv, true);
13625 }
13626 int64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(uint64_t arg) {
13627         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
13628         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
13629         return ret_conv;
13630 }
13631
13632 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone(uint64_t orig) {
13633         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
13634         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
13635         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
13636         return tag_ptr(ret_conv, true);
13637 }
13638
13639 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
13640         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
13641         *ret_conv = C2Tuple_u64u64Z_clone(arg);
13642         return tag_ptr(ret_conv, true);
13643 }
13644 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone_ptr"))) TS_C2Tuple_u64u64Z_clone_ptr(uint64_t arg) {
13645         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
13646         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
13647         return ret_conv;
13648 }
13649
13650 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone"))) TS_C2Tuple_u64u64Z_clone(uint64_t orig) {
13651         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
13652         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
13653         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
13654         return tag_ptr(ret_conv, true);
13655 }
13656
13657 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_new"))) TS_C2Tuple_u64u64Z_new(int64_t a, int64_t b) {
13658         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
13659         *ret_conv = C2Tuple_u64u64Z_new(a, b);
13660         return tag_ptr(ret_conv, true);
13661 }
13662
13663 void  __attribute__((export_name("TS_C2Tuple_u64u64Z_free"))) TS_C2Tuple_u64u64Z_free(uint64_t _res) {
13664         if (!ptr_is_owned(_res)) return;
13665         void* _res_ptr = untag_ptr(_res);
13666         CHECK_ACCESS(_res_ptr);
13667         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
13668         FREE(untag_ptr(_res));
13669         C2Tuple_u64u64Z_free(_res_conv);
13670 }
13671
13672 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_some"))) TS_COption_C2Tuple_u64u64ZZ_some(uint64_t o) {
13673         void* o_ptr = untag_ptr(o);
13674         CHECK_ACCESS(o_ptr);
13675         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
13676         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
13677         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
13678         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
13679         uint64_t ret_ref = tag_ptr(ret_copy, true);
13680         return ret_ref;
13681 }
13682
13683 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_none"))) TS_COption_C2Tuple_u64u64ZZ_none() {
13684         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
13685         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
13686         uint64_t ret_ref = tag_ptr(ret_copy, true);
13687         return ret_ref;
13688 }
13689
13690 void  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_free"))) TS_COption_C2Tuple_u64u64ZZ_free(uint64_t _res) {
13691         if (!ptr_is_owned(_res)) return;
13692         void* _res_ptr = untag_ptr(_res);
13693         CHECK_ACCESS(_res_ptr);
13694         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
13695         FREE(untag_ptr(_res));
13696         COption_C2Tuple_u64u64ZZ_free(_res_conv);
13697 }
13698
13699 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
13700         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
13701         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
13702         uint64_t ret_ref = tag_ptr(ret_copy, true);
13703         return ret_ref;
13704 }
13705 int64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone_ptr"))) TS_COption_C2Tuple_u64u64ZZ_clone_ptr(uint64_t arg) {
13706         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
13707         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
13708         return ret_conv;
13709 }
13710
13711 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone"))) TS_COption_C2Tuple_u64u64ZZ_clone(uint64_t orig) {
13712         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
13713         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
13714         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
13715         uint64_t ret_ref = tag_ptr(ret_copy, true);
13716         return ret_ref;
13717 }
13718
13719 void  __attribute__((export_name("TS_CVec_NodeIdZ_free"))) TS_CVec_NodeIdZ_free(uint64_tArray _res) {
13720         LDKCVec_NodeIdZ _res_constr;
13721         _res_constr.datalen = _res->arr_len;
13722         if (_res_constr.datalen > 0)
13723                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
13724         else
13725                 _res_constr.data = NULL;
13726         uint64_t* _res_vals = _res->elems;
13727         for (size_t i = 0; i < _res_constr.datalen; i++) {
13728                 uint64_t _res_conv_8 = _res_vals[i];
13729                 LDKNodeId _res_conv_8_conv;
13730                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
13731                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
13732                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
13733                 _res_constr.data[i] = _res_conv_8_conv;
13734         }
13735         FREE(_res);
13736         CVec_NodeIdZ_free(_res_constr);
13737 }
13738
13739 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_ok(uint64_t o) {
13740         LDKProbabilisticScorer o_conv;
13741         o_conv.inner = untag_ptr(o);
13742         o_conv.is_owned = ptr_is_owned(o);
13743         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13744         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
13745         
13746         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
13747         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
13748         return tag_ptr(ret_conv, true);
13749 }
13750
13751 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_err(uint64_t e) {
13752         LDKDecodeError e_conv;
13753         e_conv.inner = untag_ptr(e);
13754         e_conv.is_owned = ptr_is_owned(e);
13755         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13756         e_conv = DecodeError_clone(&e_conv);
13757         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
13758         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
13759         return tag_ptr(ret_conv, true);
13760 }
13761
13762 jboolean  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok(uint64_t o) {
13763         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
13764         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
13765         return ret_conv;
13766 }
13767
13768 void  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_free"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_free(uint64_t _res) {
13769         if (!ptr_is_owned(_res)) return;
13770         void* _res_ptr = untag_ptr(_res);
13771         CHECK_ACCESS(_res_ptr);
13772         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
13773         FREE(untag_ptr(_res));
13774         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
13775 }
13776
13777 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint64_t o) {
13778         LDKInitFeatures o_conv;
13779         o_conv.inner = untag_ptr(o);
13780         o_conv.is_owned = ptr_is_owned(o);
13781         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13782         o_conv = InitFeatures_clone(&o_conv);
13783         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13784         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
13785         return tag_ptr(ret_conv, true);
13786 }
13787
13788 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_err"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint64_t e) {
13789         LDKDecodeError e_conv;
13790         e_conv.inner = untag_ptr(e);
13791         e_conv.is_owned = ptr_is_owned(e);
13792         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13793         e_conv = DecodeError_clone(&e_conv);
13794         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13795         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
13796         return tag_ptr(ret_conv, true);
13797 }
13798
13799 jboolean  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint64_t o) {
13800         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
13801         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
13802         return ret_conv;
13803 }
13804
13805 void  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_free"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint64_t _res) {
13806         if (!ptr_is_owned(_res)) return;
13807         void* _res_ptr = untag_ptr(_res);
13808         CHECK_ACCESS(_res_ptr);
13809         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
13810         FREE(untag_ptr(_res));
13811         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
13812 }
13813
13814 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13815         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13816         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
13817         return tag_ptr(ret_conv, true);
13818 }
13819 int64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
13820         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
13821         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13822         return ret_conv;
13823 }
13824
13825 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone"))) TS_CResult_InitFeaturesDecodeErrorZ_clone(uint64_t orig) {
13826         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
13827         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
13828         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
13829         return tag_ptr(ret_conv, true);
13830 }
13831
13832 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint64_t o) {
13833         LDKChannelFeatures o_conv;
13834         o_conv.inner = untag_ptr(o);
13835         o_conv.is_owned = ptr_is_owned(o);
13836         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13837         o_conv = ChannelFeatures_clone(&o_conv);
13838         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
13839         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
13840         return tag_ptr(ret_conv, true);
13841 }
13842
13843 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint64_t e) {
13844         LDKDecodeError e_conv;
13845         e_conv.inner = untag_ptr(e);
13846         e_conv.is_owned = ptr_is_owned(e);
13847         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13848         e_conv = DecodeError_clone(&e_conv);
13849         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
13850         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
13851         return tag_ptr(ret_conv, true);
13852 }
13853
13854 jboolean  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint64_t o) {
13855         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
13856         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
13857         return ret_conv;
13858 }
13859
13860 void  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint64_t _res) {
13861         if (!ptr_is_owned(_res)) return;
13862         void* _res_ptr = untag_ptr(_res);
13863         CHECK_ACCESS(_res_ptr);
13864         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
13865         FREE(untag_ptr(_res));
13866         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
13867 }
13868
13869 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13870         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
13871         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
13872         return tag_ptr(ret_conv, true);
13873 }
13874 int64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
13875         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
13876         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13877         return ret_conv;
13878 }
13879
13880 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone(uint64_t orig) {
13881         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
13882         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
13883         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
13884         return tag_ptr(ret_conv, true);
13885 }
13886
13887 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint64_t o) {
13888         LDKNodeFeatures o_conv;
13889         o_conv.inner = untag_ptr(o);
13890         o_conv.is_owned = ptr_is_owned(o);
13891         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13892         o_conv = NodeFeatures_clone(&o_conv);
13893         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
13894         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
13895         return tag_ptr(ret_conv, true);
13896 }
13897
13898 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint64_t e) {
13899         LDKDecodeError e_conv;
13900         e_conv.inner = untag_ptr(e);
13901         e_conv.is_owned = ptr_is_owned(e);
13902         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13903         e_conv = DecodeError_clone(&e_conv);
13904         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
13905         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
13906         return tag_ptr(ret_conv, true);
13907 }
13908
13909 jboolean  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
13910         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
13911         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
13912         return ret_conv;
13913 }
13914
13915 void  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_free"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint64_t _res) {
13916         if (!ptr_is_owned(_res)) return;
13917         void* _res_ptr = untag_ptr(_res);
13918         CHECK_ACCESS(_res_ptr);
13919         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
13920         FREE(untag_ptr(_res));
13921         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
13922 }
13923
13924 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13925         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
13926         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
13927         return tag_ptr(ret_conv, true);
13928 }
13929 int64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
13930         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
13931         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13932         return ret_conv;
13933 }
13934
13935 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone(uint64_t orig) {
13936         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
13937         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
13938         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
13939         return tag_ptr(ret_conv, true);
13940 }
13941
13942 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
13943         LDKInvoiceFeatures o_conv;
13944         o_conv.inner = untag_ptr(o);
13945         o_conv.is_owned = ptr_is_owned(o);
13946         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
13947         o_conv = InvoiceFeatures_clone(&o_conv);
13948         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13949         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
13950         return tag_ptr(ret_conv, true);
13951 }
13952
13953 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
13954         LDKDecodeError e_conv;
13955         e_conv.inner = untag_ptr(e);
13956         e_conv.is_owned = ptr_is_owned(e);
13957         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
13958         e_conv = DecodeError_clone(&e_conv);
13959         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13960         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
13961         return tag_ptr(ret_conv, true);
13962 }
13963
13964 jboolean  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
13965         LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
13966         jboolean ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
13967         return ret_conv;
13968 }
13969
13970 void  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
13971         if (!ptr_is_owned(_res)) return;
13972         void* _res_ptr = untag_ptr(_res);
13973         CHECK_ACCESS(_res_ptr);
13974         LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
13975         FREE(untag_ptr(_res));
13976         CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
13977 }
13978
13979 static inline uint64_t CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
13980         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13981         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(arg);
13982         return tag_ptr(ret_conv, true);
13983 }
13984 int64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
13985         LDKCResult_InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
13986         int64_t ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
13987         return ret_conv;
13988 }
13989
13990 uint64_t  __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
13991         LDKCResult_InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
13992         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
13993         *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
13994         return tag_ptr(ret_conv, true);
13995 }
13996
13997 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint64_t o) {
13998         LDKChannelTypeFeatures o_conv;
13999         o_conv.inner = untag_ptr(o);
14000         o_conv.is_owned = ptr_is_owned(o);
14001         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14002         o_conv = ChannelTypeFeatures_clone(&o_conv);
14003         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14004         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
14005         return tag_ptr(ret_conv, true);
14006 }
14007
14008 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint64_t e) {
14009         LDKDecodeError e_conv;
14010         e_conv.inner = untag_ptr(e);
14011         e_conv.is_owned = ptr_is_owned(e);
14012         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14013         e_conv = DecodeError_clone(&e_conv);
14014         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14015         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
14016         return tag_ptr(ret_conv, true);
14017 }
14018
14019 jboolean  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
14020         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
14021         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
14022         return ret_conv;
14023 }
14024
14025 void  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint64_t _res) {
14026         if (!ptr_is_owned(_res)) return;
14027         void* _res_ptr = untag_ptr(_res);
14028         CHECK_ACCESS(_res_ptr);
14029         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
14030         FREE(untag_ptr(_res));
14031         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
14032 }
14033
14034 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
14035         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14036         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
14037         return tag_ptr(ret_conv, true);
14038 }
14039 int64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
14040         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
14041         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
14042         return ret_conv;
14043 }
14044
14045 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone(uint64_t orig) {
14046         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
14047         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
14048         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
14049         return tag_ptr(ret_conv, true);
14050 }
14051
14052 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_ok"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint64_t o) {
14053         LDKNodeId o_conv;
14054         o_conv.inner = untag_ptr(o);
14055         o_conv.is_owned = ptr_is_owned(o);
14056         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14057         o_conv = NodeId_clone(&o_conv);
14058         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14059         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
14060         return tag_ptr(ret_conv, true);
14061 }
14062
14063 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_err"))) TS_CResult_NodeIdDecodeErrorZ_err(uint64_t e) {
14064         LDKDecodeError e_conv;
14065         e_conv.inner = untag_ptr(e);
14066         e_conv.is_owned = ptr_is_owned(e);
14067         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14068         e_conv = DecodeError_clone(&e_conv);
14069         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14070         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
14071         return tag_ptr(ret_conv, true);
14072 }
14073
14074 jboolean  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_is_ok"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint64_t o) {
14075         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
14076         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
14077         return ret_conv;
14078 }
14079
14080 void  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_free"))) TS_CResult_NodeIdDecodeErrorZ_free(uint64_t _res) {
14081         if (!ptr_is_owned(_res)) return;
14082         void* _res_ptr = untag_ptr(_res);
14083         CHECK_ACCESS(_res_ptr);
14084         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
14085         FREE(untag_ptr(_res));
14086         CResult_NodeIdDecodeErrorZ_free(_res_conv);
14087 }
14088
14089 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
14090         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14091         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
14092         return tag_ptr(ret_conv, true);
14093 }
14094 int64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone_ptr"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint64_t arg) {
14095         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
14096         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
14097         return ret_conv;
14098 }
14099
14100 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint64_t orig) {
14101         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
14102         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
14103         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
14104         return tag_ptr(ret_conv, true);
14105 }
14106
14107 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint64_t o) {
14108         void* o_ptr = untag_ptr(o);
14109         CHECK_ACCESS(o_ptr);
14110         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
14111         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
14112         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14113         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
14114         return tag_ptr(ret_conv, true);
14115 }
14116
14117 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint64_t e) {
14118         LDKDecodeError e_conv;
14119         e_conv.inner = untag_ptr(e);
14120         e_conv.is_owned = ptr_is_owned(e);
14121         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14122         e_conv = DecodeError_clone(&e_conv);
14123         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14124         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
14125         return tag_ptr(ret_conv, true);
14126 }
14127
14128 jboolean  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint64_t o) {
14129         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
14130         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
14131         return ret_conv;
14132 }
14133
14134 void  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint64_t _res) {
14135         if (!ptr_is_owned(_res)) return;
14136         void* _res_ptr = untag_ptr(_res);
14137         CHECK_ACCESS(_res_ptr);
14138         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
14139         FREE(untag_ptr(_res));
14140         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
14141 }
14142
14143 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
14144         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14145         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
14146         return tag_ptr(ret_conv, true);
14147 }
14148 int64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint64_t arg) {
14149         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
14150         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
14151         return ret_conv;
14152 }
14153
14154 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint64_t orig) {
14155         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
14156         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
14157         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
14158         return tag_ptr(ret_conv, true);
14159 }
14160
14161 uint64_t  __attribute__((export_name("TS_COption_AccessZ_some"))) TS_COption_AccessZ_some(uint64_t o) {
14162         void* o_ptr = untag_ptr(o);
14163         CHECK_ACCESS(o_ptr);
14164         LDKAccess o_conv = *(LDKAccess*)(o_ptr);
14165         if (o_conv.free == LDKAccess_JCalls_free) {
14166                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14167                 LDKAccess_JCalls_cloned(&o_conv);
14168         }
14169         LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
14170         *ret_copy = COption_AccessZ_some(o_conv);
14171         uint64_t ret_ref = tag_ptr(ret_copy, true);
14172         return ret_ref;
14173 }
14174
14175 uint64_t  __attribute__((export_name("TS_COption_AccessZ_none"))) TS_COption_AccessZ_none() {
14176         LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
14177         *ret_copy = COption_AccessZ_none();
14178         uint64_t ret_ref = tag_ptr(ret_copy, true);
14179         return ret_ref;
14180 }
14181
14182 void  __attribute__((export_name("TS_COption_AccessZ_free"))) TS_COption_AccessZ_free(uint64_t _res) {
14183         if (!ptr_is_owned(_res)) return;
14184         void* _res_ptr = untag_ptr(_res);
14185         CHECK_ACCESS(_res_ptr);
14186         LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr);
14187         FREE(untag_ptr(_res));
14188         COption_AccessZ_free(_res_conv);
14189 }
14190
14191 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_ok"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
14192         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
14193         *ret_conv = CResult_boolLightningErrorZ_ok(o);
14194         return tag_ptr(ret_conv, true);
14195 }
14196
14197 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_err"))) TS_CResult_boolLightningErrorZ_err(uint64_t e) {
14198         LDKLightningError e_conv;
14199         e_conv.inner = untag_ptr(e);
14200         e_conv.is_owned = ptr_is_owned(e);
14201         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14202         e_conv = LightningError_clone(&e_conv);
14203         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
14204         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
14205         return tag_ptr(ret_conv, true);
14206 }
14207
14208 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_is_ok"))) TS_CResult_boolLightningErrorZ_is_ok(uint64_t o) {
14209         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
14210         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
14211         return ret_conv;
14212 }
14213
14214 void  __attribute__((export_name("TS_CResult_boolLightningErrorZ_free"))) TS_CResult_boolLightningErrorZ_free(uint64_t _res) {
14215         if (!ptr_is_owned(_res)) return;
14216         void* _res_ptr = untag_ptr(_res);
14217         CHECK_ACCESS(_res_ptr);
14218         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
14219         FREE(untag_ptr(_res));
14220         CResult_boolLightningErrorZ_free(_res_conv);
14221 }
14222
14223 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
14224         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
14225         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
14226         return tag_ptr(ret_conv, true);
14227 }
14228 int64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone_ptr"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint64_t arg) {
14229         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
14230         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
14231         return ret_conv;
14232 }
14233
14234 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone"))) TS_CResult_boolLightningErrorZ_clone(uint64_t orig) {
14235         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
14236         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
14237         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
14238         return tag_ptr(ret_conv, true);
14239 }
14240
14241 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
14242         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
14243         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
14244         return tag_ptr(ret_conv, true);
14245 }
14246 int64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint64_t arg) {
14247         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
14248         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
14249         return ret_conv;
14250 }
14251
14252 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint64_t orig) {
14253         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
14254         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
14255         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
14256         return tag_ptr(ret_conv, true);
14257 }
14258
14259 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint64_t a, uint64_t b, uint64_t c) {
14260         LDKChannelAnnouncement a_conv;
14261         a_conv.inner = untag_ptr(a);
14262         a_conv.is_owned = ptr_is_owned(a);
14263         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
14264         a_conv = ChannelAnnouncement_clone(&a_conv);
14265         LDKChannelUpdate b_conv;
14266         b_conv.inner = untag_ptr(b);
14267         b_conv.is_owned = ptr_is_owned(b);
14268         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
14269         b_conv = ChannelUpdate_clone(&b_conv);
14270         LDKChannelUpdate c_conv;
14271         c_conv.inner = untag_ptr(c);
14272         c_conv.is_owned = ptr_is_owned(c);
14273         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
14274         c_conv = ChannelUpdate_clone(&c_conv);
14275         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
14276         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
14277         return tag_ptr(ret_conv, true);
14278 }
14279
14280 void  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint64_t _res) {
14281         if (!ptr_is_owned(_res)) return;
14282         void* _res_ptr = untag_ptr(_res);
14283         CHECK_ACCESS(_res_ptr);
14284         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
14285         FREE(untag_ptr(_res));
14286         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
14287 }
14288
14289 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(uint64_t o) {
14290         void* o_ptr = untag_ptr(o);
14291         CHECK_ACCESS(o_ptr);
14292         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
14293         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
14294         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
14295         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
14296         uint64_t ret_ref = tag_ptr(ret_copy, true);
14297         return ret_ref;
14298 }
14299
14300 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() {
14301         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
14302         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
14303         uint64_t ret_ref = tag_ptr(ret_copy, true);
14304         return ret_ref;
14305 }
14306
14307 void  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint64_t _res) {
14308         if (!ptr_is_owned(_res)) return;
14309         void* _res_ptr = untag_ptr(_res);
14310         CHECK_ACCESS(_res_ptr);
14311         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
14312         FREE(untag_ptr(_res));
14313         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
14314 }
14315
14316 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
14317         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
14318         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
14319         uint64_t ret_ref = tag_ptr(ret_copy, true);
14320         return ret_ref;
14321 }
14322 int64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(uint64_t arg) {
14323         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
14324         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
14325         return ret_conv;
14326 }
14327
14328 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(uint64_t orig) {
14329         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
14330         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
14331         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
14332         uint64_t ret_ref = tag_ptr(ret_copy, true);
14333         return ret_ref;
14334 }
14335
14336 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_ok"))) TS_CResult_NoneLightningErrorZ_ok() {
14337         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14338         *ret_conv = CResult_NoneLightningErrorZ_ok();
14339         return tag_ptr(ret_conv, true);
14340 }
14341
14342 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_err"))) TS_CResult_NoneLightningErrorZ_err(uint64_t e) {
14343         LDKLightningError e_conv;
14344         e_conv.inner = untag_ptr(e);
14345         e_conv.is_owned = ptr_is_owned(e);
14346         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14347         e_conv = LightningError_clone(&e_conv);
14348         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14349         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
14350         return tag_ptr(ret_conv, true);
14351 }
14352
14353 jboolean  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_is_ok"))) TS_CResult_NoneLightningErrorZ_is_ok(uint64_t o) {
14354         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
14355         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
14356         return ret_conv;
14357 }
14358
14359 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_free"))) TS_CResult_NoneLightningErrorZ_free(uint64_t _res) {
14360         if (!ptr_is_owned(_res)) return;
14361         void* _res_ptr = untag_ptr(_res);
14362         CHECK_ACCESS(_res_ptr);
14363         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
14364         FREE(untag_ptr(_res));
14365         CResult_NoneLightningErrorZ_free(_res_conv);
14366 }
14367
14368 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
14369         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14370         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
14371         return tag_ptr(ret_conv, true);
14372 }
14373 int64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone_ptr"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint64_t arg) {
14374         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
14375         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
14376         return ret_conv;
14377 }
14378
14379 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone"))) TS_CResult_NoneLightningErrorZ_clone(uint64_t orig) {
14380         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
14381         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
14382         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
14383         return tag_ptr(ret_conv, true);
14384 }
14385
14386 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok(uint64_t o) {
14387         LDKChannelUpdateInfo o_conv;
14388         o_conv.inner = untag_ptr(o);
14389         o_conv.is_owned = ptr_is_owned(o);
14390         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14391         o_conv = ChannelUpdateInfo_clone(&o_conv);
14392         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
14393         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
14394         return tag_ptr(ret_conv, true);
14395 }
14396
14397 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_err(uint64_t e) {
14398         LDKDecodeError e_conv;
14399         e_conv.inner = untag_ptr(e);
14400         e_conv.is_owned = ptr_is_owned(e);
14401         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14402         e_conv = DecodeError_clone(&e_conv);
14403         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
14404         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
14405         return tag_ptr(ret_conv, true);
14406 }
14407
14408 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(uint64_t o) {
14409         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
14410         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
14411         return ret_conv;
14412 }
14413
14414 void  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_free"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_free(uint64_t _res) {
14415         if (!ptr_is_owned(_res)) return;
14416         void* _res_ptr = untag_ptr(_res);
14417         CHECK_ACCESS(_res_ptr);
14418         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
14419         FREE(untag_ptr(_res));
14420         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
14421 }
14422
14423 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
14424         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
14425         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
14426         return tag_ptr(ret_conv, true);
14427 }
14428 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
14429         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
14430         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
14431         return ret_conv;
14432 }
14433
14434 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone(uint64_t orig) {
14435         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
14436         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
14437         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
14438         return tag_ptr(ret_conv, true);
14439 }
14440
14441 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint64_t o) {
14442         LDKChannelInfo o_conv;
14443         o_conv.inner = untag_ptr(o);
14444         o_conv.is_owned = ptr_is_owned(o);
14445         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14446         o_conv = ChannelInfo_clone(&o_conv);
14447         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
14448         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
14449         return tag_ptr(ret_conv, true);
14450 }
14451
14452 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_err"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint64_t e) {
14453         LDKDecodeError e_conv;
14454         e_conv.inner = untag_ptr(e);
14455         e_conv.is_owned = ptr_is_owned(e);
14456         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14457         e_conv = DecodeError_clone(&e_conv);
14458         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
14459         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
14460         return tag_ptr(ret_conv, true);
14461 }
14462
14463 jboolean  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint64_t o) {
14464         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
14465         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
14466         return ret_conv;
14467 }
14468
14469 void  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_free"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint64_t _res) {
14470         if (!ptr_is_owned(_res)) return;
14471         void* _res_ptr = untag_ptr(_res);
14472         CHECK_ACCESS(_res_ptr);
14473         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
14474         FREE(untag_ptr(_res));
14475         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
14476 }
14477
14478 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
14479         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
14480         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
14481         return tag_ptr(ret_conv, true);
14482 }
14483 int64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
14484         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
14485         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
14486         return ret_conv;
14487 }
14488
14489 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint64_t orig) {
14490         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
14491         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
14492         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
14493         return tag_ptr(ret_conv, true);
14494 }
14495
14496 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint64_t o) {
14497         LDKRoutingFees o_conv;
14498         o_conv.inner = untag_ptr(o);
14499         o_conv.is_owned = ptr_is_owned(o);
14500         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14501         o_conv = RoutingFees_clone(&o_conv);
14502         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14503         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
14504         return tag_ptr(ret_conv, true);
14505 }
14506
14507 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_err"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint64_t e) {
14508         LDKDecodeError e_conv;
14509         e_conv.inner = untag_ptr(e);
14510         e_conv.is_owned = ptr_is_owned(e);
14511         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14512         e_conv = DecodeError_clone(&e_conv);
14513         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14514         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
14515         return tag_ptr(ret_conv, true);
14516 }
14517
14518 jboolean  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_is_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint64_t o) {
14519         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
14520         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
14521         return ret_conv;
14522 }
14523
14524 void  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_free"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint64_t _res) {
14525         if (!ptr_is_owned(_res)) return;
14526         void* _res_ptr = untag_ptr(_res);
14527         CHECK_ACCESS(_res_ptr);
14528         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
14529         FREE(untag_ptr(_res));
14530         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
14531 }
14532
14533 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
14534         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14535         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
14536         return tag_ptr(ret_conv, true);
14537 }
14538 int64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint64_t arg) {
14539         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
14540         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
14541         return ret_conv;
14542 }
14543
14544 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint64_t orig) {
14545         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
14546         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
14547         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
14548         return tag_ptr(ret_conv, true);
14549 }
14550
14551 void  __attribute__((export_name("TS_CVec_NetAddressZ_free"))) TS_CVec_NetAddressZ_free(uint64_tArray _res) {
14552         LDKCVec_NetAddressZ _res_constr;
14553         _res_constr.datalen = _res->arr_len;
14554         if (_res_constr.datalen > 0)
14555                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14556         else
14557                 _res_constr.data = NULL;
14558         uint64_t* _res_vals = _res->elems;
14559         for (size_t m = 0; m < _res_constr.datalen; m++) {
14560                 uint64_t _res_conv_12 = _res_vals[m];
14561                 void* _res_conv_12_ptr = untag_ptr(_res_conv_12);
14562                 CHECK_ACCESS(_res_conv_12_ptr);
14563                 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
14564                 FREE(untag_ptr(_res_conv_12));
14565                 _res_constr.data[m] = _res_conv_12_conv;
14566         }
14567         FREE(_res);
14568         CVec_NetAddressZ_free(_res_constr);
14569 }
14570
14571 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint64_t o) {
14572         LDKNodeAnnouncementInfo o_conv;
14573         o_conv.inner = untag_ptr(o);
14574         o_conv.is_owned = ptr_is_owned(o);
14575         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14576         o_conv = NodeAnnouncementInfo_clone(&o_conv);
14577         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14578         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
14579         return tag_ptr(ret_conv, true);
14580 }
14581
14582 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint64_t e) {
14583         LDKDecodeError e_conv;
14584         e_conv.inner = untag_ptr(e);
14585         e_conv.is_owned = ptr_is_owned(e);
14586         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14587         e_conv = DecodeError_clone(&e_conv);
14588         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14589         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
14590         return tag_ptr(ret_conv, true);
14591 }
14592
14593 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint64_t o) {
14594         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
14595         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
14596         return ret_conv;
14597 }
14598
14599 void  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint64_t _res) {
14600         if (!ptr_is_owned(_res)) return;
14601         void* _res_ptr = untag_ptr(_res);
14602         CHECK_ACCESS(_res_ptr);
14603         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
14604         FREE(untag_ptr(_res));
14605         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
14606 }
14607
14608 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
14609         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14610         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
14611         return tag_ptr(ret_conv, true);
14612 }
14613 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
14614         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
14615         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
14616         return ret_conv;
14617 }
14618
14619 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint64_t orig) {
14620         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
14621         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
14622         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
14623         return tag_ptr(ret_conv, true);
14624 }
14625
14626 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_ok"))) TS_CResult_NodeAliasDecodeErrorZ_ok(uint64_t o) {
14627         LDKNodeAlias o_conv;
14628         o_conv.inner = untag_ptr(o);
14629         o_conv.is_owned = ptr_is_owned(o);
14630         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14631         o_conv = NodeAlias_clone(&o_conv);
14632         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
14633         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
14634         return tag_ptr(ret_conv, true);
14635 }
14636
14637 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_err"))) TS_CResult_NodeAliasDecodeErrorZ_err(uint64_t e) {
14638         LDKDecodeError e_conv;
14639         e_conv.inner = untag_ptr(e);
14640         e_conv.is_owned = ptr_is_owned(e);
14641         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14642         e_conv = DecodeError_clone(&e_conv);
14643         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
14644         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
14645         return tag_ptr(ret_conv, true);
14646 }
14647
14648 jboolean  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_is_ok"))) TS_CResult_NodeAliasDecodeErrorZ_is_ok(uint64_t o) {
14649         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
14650         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
14651         return ret_conv;
14652 }
14653
14654 void  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_free"))) TS_CResult_NodeAliasDecodeErrorZ_free(uint64_t _res) {
14655         if (!ptr_is_owned(_res)) return;
14656         void* _res_ptr = untag_ptr(_res);
14657         CHECK_ACCESS(_res_ptr);
14658         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
14659         FREE(untag_ptr(_res));
14660         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
14661 }
14662
14663 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
14664         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
14665         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
14666         return tag_ptr(ret_conv, true);
14667 }
14668 int64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAliasDecodeErrorZ_clone_ptr(uint64_t arg) {
14669         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
14670         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
14671         return ret_conv;
14672 }
14673
14674 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone"))) TS_CResult_NodeAliasDecodeErrorZ_clone(uint64_t orig) {
14675         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
14676         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
14677         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
14678         return tag_ptr(ret_conv, true);
14679 }
14680
14681 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_ok"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint64_t o) {
14682         LDKNodeInfo o_conv;
14683         o_conv.inner = untag_ptr(o);
14684         o_conv.is_owned = ptr_is_owned(o);
14685         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14686         o_conv = NodeInfo_clone(&o_conv);
14687         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14688         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
14689         return tag_ptr(ret_conv, true);
14690 }
14691
14692 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_err"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint64_t e) {
14693         LDKDecodeError e_conv;
14694         e_conv.inner = untag_ptr(e);
14695         e_conv.is_owned = ptr_is_owned(e);
14696         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14697         e_conv = DecodeError_clone(&e_conv);
14698         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14699         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
14700         return tag_ptr(ret_conv, true);
14701 }
14702
14703 jboolean  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint64_t o) {
14704         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
14705         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
14706         return ret_conv;
14707 }
14708
14709 void  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_free"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint64_t _res) {
14710         if (!ptr_is_owned(_res)) return;
14711         void* _res_ptr = untag_ptr(_res);
14712         CHECK_ACCESS(_res_ptr);
14713         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
14714         FREE(untag_ptr(_res));
14715         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
14716 }
14717
14718 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
14719         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14720         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
14721         return tag_ptr(ret_conv, true);
14722 }
14723 int64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
14724         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
14725         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
14726         return ret_conv;
14727 }
14728
14729 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint64_t orig) {
14730         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
14731         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
14732         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
14733         return tag_ptr(ret_conv, true);
14734 }
14735
14736 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint64_t o) {
14737         LDKNetworkGraph o_conv;
14738         o_conv.inner = untag_ptr(o);
14739         o_conv.is_owned = ptr_is_owned(o);
14740         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14741         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
14742         
14743         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
14744         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
14745         return tag_ptr(ret_conv, true);
14746 }
14747
14748 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_err"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint64_t e) {
14749         LDKDecodeError e_conv;
14750         e_conv.inner = untag_ptr(e);
14751         e_conv.is_owned = ptr_is_owned(e);
14752         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14753         e_conv = DecodeError_clone(&e_conv);
14754         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
14755         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
14756         return tag_ptr(ret_conv, true);
14757 }
14758
14759 jboolean  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_is_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint64_t o) {
14760         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
14761         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
14762         return ret_conv;
14763 }
14764
14765 void  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_free"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint64_t _res) {
14766         if (!ptr_is_owned(_res)) return;
14767         void* _res_ptr = untag_ptr(_res);
14768         CHECK_ACCESS(_res_ptr);
14769         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
14770         FREE(untag_ptr(_res));
14771         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
14772 }
14773
14774 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_some"))) TS_COption_CVec_NetAddressZZ_some(uint64_tArray o) {
14775         LDKCVec_NetAddressZ o_constr;
14776         o_constr.datalen = o->arr_len;
14777         if (o_constr.datalen > 0)
14778                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14779         else
14780                 o_constr.data = NULL;
14781         uint64_t* o_vals = o->elems;
14782         for (size_t m = 0; m < o_constr.datalen; m++) {
14783                 uint64_t o_conv_12 = o_vals[m];
14784                 void* o_conv_12_ptr = untag_ptr(o_conv_12);
14785                 CHECK_ACCESS(o_conv_12_ptr);
14786                 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
14787                 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o_conv_12));
14788                 o_constr.data[m] = o_conv_12_conv;
14789         }
14790         FREE(o);
14791         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14792         *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
14793         uint64_t ret_ref = tag_ptr(ret_copy, true);
14794         return ret_ref;
14795 }
14796
14797 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_none"))) TS_COption_CVec_NetAddressZZ_none() {
14798         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14799         *ret_copy = COption_CVec_NetAddressZZ_none();
14800         uint64_t ret_ref = tag_ptr(ret_copy, true);
14801         return ret_ref;
14802 }
14803
14804 void  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_free"))) TS_COption_CVec_NetAddressZZ_free(uint64_t _res) {
14805         if (!ptr_is_owned(_res)) return;
14806         void* _res_ptr = untag_ptr(_res);
14807         CHECK_ACCESS(_res_ptr);
14808         LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
14809         FREE(untag_ptr(_res));
14810         COption_CVec_NetAddressZZ_free(_res_conv);
14811 }
14812
14813 static inline uint64_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
14814         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14815         *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
14816         uint64_t ret_ref = tag_ptr(ret_copy, true);
14817         return ret_ref;
14818 }
14819 int64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone_ptr"))) TS_COption_CVec_NetAddressZZ_clone_ptr(uint64_t arg) {
14820         LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(arg);
14821         int64_t ret_conv = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
14822         return ret_conv;
14823 }
14824
14825 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone"))) TS_COption_CVec_NetAddressZZ_clone(uint64_t orig) {
14826         LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(orig);
14827         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
14828         *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
14829         uint64_t ret_ref = tag_ptr(ret_copy, true);
14830         return ret_ref;
14831 }
14832
14833 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
14834         LDKDelayedPaymentOutputDescriptor o_conv;
14835         o_conv.inner = untag_ptr(o);
14836         o_conv.is_owned = ptr_is_owned(o);
14837         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14838         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
14839         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14840         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
14841         return tag_ptr(ret_conv, true);
14842 }
14843
14844 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
14845         LDKDecodeError e_conv;
14846         e_conv.inner = untag_ptr(e);
14847         e_conv.is_owned = ptr_is_owned(e);
14848         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14849         e_conv = DecodeError_clone(&e_conv);
14850         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14851         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
14852         return tag_ptr(ret_conv, true);
14853 }
14854
14855 jboolean  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
14856         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
14857         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
14858         return ret_conv;
14859 }
14860
14861 void  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
14862         if (!ptr_is_owned(_res)) return;
14863         void* _res_ptr = untag_ptr(_res);
14864         CHECK_ACCESS(_res_ptr);
14865         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
14866         FREE(untag_ptr(_res));
14867         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
14868 }
14869
14870 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14871         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14872         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
14873         return tag_ptr(ret_conv, true);
14874 }
14875 int64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
14876         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
14877         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
14878         return ret_conv;
14879 }
14880
14881 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
14882         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
14883         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
14884         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
14885         return tag_ptr(ret_conv, true);
14886 }
14887
14888 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
14889         LDKStaticPaymentOutputDescriptor o_conv;
14890         o_conv.inner = untag_ptr(o);
14891         o_conv.is_owned = ptr_is_owned(o);
14892         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14893         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
14894         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14895         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
14896         return tag_ptr(ret_conv, true);
14897 }
14898
14899 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
14900         LDKDecodeError e_conv;
14901         e_conv.inner = untag_ptr(e);
14902         e_conv.is_owned = ptr_is_owned(e);
14903         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14904         e_conv = DecodeError_clone(&e_conv);
14905         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14906         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
14907         return tag_ptr(ret_conv, true);
14908 }
14909
14910 jboolean  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
14911         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
14912         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
14913         return ret_conv;
14914 }
14915
14916 void  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
14917         if (!ptr_is_owned(_res)) return;
14918         void* _res_ptr = untag_ptr(_res);
14919         CHECK_ACCESS(_res_ptr);
14920         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
14921         FREE(untag_ptr(_res));
14922         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
14923 }
14924
14925 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14926         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14927         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
14928         return tag_ptr(ret_conv, true);
14929 }
14930 int64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
14931         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
14932         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
14933         return ret_conv;
14934 }
14935
14936 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
14937         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
14938         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
14939         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
14940         return tag_ptr(ret_conv, true);
14941 }
14942
14943 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
14944         void* o_ptr = untag_ptr(o);
14945         CHECK_ACCESS(o_ptr);
14946         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
14947         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
14948         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14949         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
14950         return tag_ptr(ret_conv, true);
14951 }
14952
14953 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint64_t e) {
14954         LDKDecodeError e_conv;
14955         e_conv.inner = untag_ptr(e);
14956         e_conv.is_owned = ptr_is_owned(e);
14957         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14958         e_conv = DecodeError_clone(&e_conv);
14959         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14960         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
14961         return tag_ptr(ret_conv, true);
14962 }
14963
14964 jboolean  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
14965         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
14966         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
14967         return ret_conv;
14968 }
14969
14970 void  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
14971         if (!ptr_is_owned(_res)) return;
14972         void* _res_ptr = untag_ptr(_res);
14973         CHECK_ACCESS(_res_ptr);
14974         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
14975         FREE(untag_ptr(_res));
14976         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
14977 }
14978
14979 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
14980         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14981         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
14982         return tag_ptr(ret_conv, true);
14983 }
14984 int64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
14985         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
14986         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
14987         return ret_conv;
14988 }
14989
14990 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
14991         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
14992         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
14993         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
14994         return tag_ptr(ret_conv, true);
14995 }
14996
14997 void  __attribute__((export_name("TS_CVec_PaymentPreimageZ_free"))) TS_CVec_PaymentPreimageZ_free(ptrArray _res) {
14998         LDKCVec_PaymentPreimageZ _res_constr;
14999         _res_constr.datalen = _res->arr_len;
15000         if (_res_constr.datalen > 0)
15001                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
15002         else
15003                 _res_constr.data = NULL;
15004         int8_tArray* _res_vals = (void*) _res->elems;
15005         for (size_t m = 0; m < _res_constr.datalen; m++) {
15006                 int8_tArray _res_conv_12 = _res_vals[m];
15007                 LDKThirtyTwoBytes _res_conv_12_ref;
15008                 CHECK(_res_conv_12->arr_len == 32);
15009                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
15010                 _res_constr.data[m] = _res_conv_12_ref;
15011         }
15012         FREE(_res);
15013         CVec_PaymentPreimageZ_free(_res_constr);
15014 }
15015
15016 static inline uint64_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
15017         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15018         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
15019         return tag_ptr(ret_conv, true);
15020 }
15021 int64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(uint64_t arg) {
15022         LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(arg);
15023         int64_t ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
15024         return ret_conv;
15025 }
15026
15027 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint64_t orig) {
15028         LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(orig);
15029         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15030         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
15031         return tag_ptr(ret_conv, true);
15032 }
15033
15034 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_new"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
15035         LDKSignature a_ref;
15036         CHECK(a->arr_len == 64);
15037         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
15038         LDKCVec_SignatureZ b_constr;
15039         b_constr.datalen = b->arr_len;
15040         if (b_constr.datalen > 0)
15041                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15042         else
15043                 b_constr.data = NULL;
15044         int8_tArray* b_vals = (void*) b->elems;
15045         for (size_t m = 0; m < b_constr.datalen; m++) {
15046                 int8_tArray b_conv_12 = b_vals[m];
15047                 LDKSignature b_conv_12_ref;
15048                 CHECK(b_conv_12->arr_len == 64);
15049                 memcpy(b_conv_12_ref.compact_form, b_conv_12->elems, 64); FREE(b_conv_12);
15050                 b_constr.data[m] = b_conv_12_ref;
15051         }
15052         FREE(b);
15053         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
15054         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
15055         return tag_ptr(ret_conv, true);
15056 }
15057
15058 void  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_free"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint64_t _res) {
15059         if (!ptr_is_owned(_res)) return;
15060         void* _res_ptr = untag_ptr(_res);
15061         CHECK_ACCESS(_res_ptr);
15062         LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
15063         FREE(untag_ptr(_res));
15064         C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
15065 }
15066
15067 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint64_t o) {
15068         void* o_ptr = untag_ptr(o);
15069         CHECK_ACCESS(o_ptr);
15070         LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
15071         o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(o));
15072         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15073         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
15074         return tag_ptr(ret_conv, true);
15075 }
15076
15077 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
15078         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15079         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
15080         return tag_ptr(ret_conv, true);
15081 }
15082
15083 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(uint64_t o) {
15084         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(o);
15085         jboolean ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
15086         return ret_conv;
15087 }
15088
15089 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint64_t _res) {
15090         if (!ptr_is_owned(_res)) return;
15091         void* _res_ptr = untag_ptr(_res);
15092         CHECK_ACCESS(_res_ptr);
15093         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
15094         FREE(untag_ptr(_res));
15095         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
15096 }
15097
15098 static inline uint64_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
15099         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15100         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
15101         return tag_ptr(ret_conv, true);
15102 }
15103 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(uint64_t arg) {
15104         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(arg);
15105         int64_t ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
15106         return ret_conv;
15107 }
15108
15109 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint64_t orig) {
15110         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(orig);
15111         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
15112         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
15113         return tag_ptr(ret_conv, true);
15114 }
15115
15116 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_ok"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
15117         LDKSignature o_ref;
15118         CHECK(o->arr_len == 64);
15119         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
15120         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15121         *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
15122         return tag_ptr(ret_conv, true);
15123 }
15124
15125 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_err"))) TS_CResult_SignatureNoneZ_err() {
15126         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15127         *ret_conv = CResult_SignatureNoneZ_err();
15128         return tag_ptr(ret_conv, true);
15129 }
15130
15131 jboolean  __attribute__((export_name("TS_CResult_SignatureNoneZ_is_ok"))) TS_CResult_SignatureNoneZ_is_ok(uint64_t o) {
15132         LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(o);
15133         jboolean ret_conv = CResult_SignatureNoneZ_is_ok(o_conv);
15134         return ret_conv;
15135 }
15136
15137 void  __attribute__((export_name("TS_CResult_SignatureNoneZ_free"))) TS_CResult_SignatureNoneZ_free(uint64_t _res) {
15138         if (!ptr_is_owned(_res)) return;
15139         void* _res_ptr = untag_ptr(_res);
15140         CHECK_ACCESS(_res_ptr);
15141         LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
15142         FREE(untag_ptr(_res));
15143         CResult_SignatureNoneZ_free(_res_conv);
15144 }
15145
15146 static inline uint64_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
15147         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15148         *ret_conv = CResult_SignatureNoneZ_clone(arg);
15149         return tag_ptr(ret_conv, true);
15150 }
15151 int64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_clone_ptr"))) TS_CResult_SignatureNoneZ_clone_ptr(uint64_t arg) {
15152         LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(arg);
15153         int64_t ret_conv = CResult_SignatureNoneZ_clone_ptr(arg_conv);
15154         return ret_conv;
15155 }
15156
15157 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_clone"))) TS_CResult_SignatureNoneZ_clone(uint64_t orig) {
15158         LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(orig);
15159         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
15160         *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
15161         return tag_ptr(ret_conv, true);
15162 }
15163
15164 static inline uint64_t C2Tuple_SignatureSignatureZ_clone_ptr(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR arg) {
15165         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
15166         *ret_conv = C2Tuple_SignatureSignatureZ_clone(arg);
15167         return tag_ptr(ret_conv, true);
15168 }
15169 int64_t  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_clone_ptr"))) TS_C2Tuple_SignatureSignatureZ_clone_ptr(uint64_t arg) {
15170         LDKC2Tuple_SignatureSignatureZ* arg_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(arg);
15171         int64_t ret_conv = C2Tuple_SignatureSignatureZ_clone_ptr(arg_conv);
15172         return ret_conv;
15173 }
15174
15175 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_clone"))) TS_C2Tuple_SignatureSignatureZ_clone(uint64_t orig) {
15176         LDKC2Tuple_SignatureSignatureZ* orig_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(orig);
15177         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
15178         *ret_conv = C2Tuple_SignatureSignatureZ_clone(orig_conv);
15179         return tag_ptr(ret_conv, true);
15180 }
15181
15182 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_new"))) TS_C2Tuple_SignatureSignatureZ_new(int8_tArray a, int8_tArray b) {
15183         LDKSignature a_ref;
15184         CHECK(a->arr_len == 64);
15185         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
15186         LDKSignature b_ref;
15187         CHECK(b->arr_len == 64);
15188         memcpy(b_ref.compact_form, b->elems, 64); FREE(b);
15189         LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ");
15190         *ret_conv = C2Tuple_SignatureSignatureZ_new(a_ref, b_ref);
15191         return tag_ptr(ret_conv, true);
15192 }
15193
15194 void  __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_free"))) TS_C2Tuple_SignatureSignatureZ_free(uint64_t _res) {
15195         if (!ptr_is_owned(_res)) return;
15196         void* _res_ptr = untag_ptr(_res);
15197         CHECK_ACCESS(_res_ptr);
15198         LDKC2Tuple_SignatureSignatureZ _res_conv = *(LDKC2Tuple_SignatureSignatureZ*)(_res_ptr);
15199         FREE(untag_ptr(_res));
15200         C2Tuple_SignatureSignatureZ_free(_res_conv);
15201 }
15202
15203 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_ok(uint64_t o) {
15204         void* o_ptr = untag_ptr(o);
15205         CHECK_ACCESS(o_ptr);
15206         LDKC2Tuple_SignatureSignatureZ o_conv = *(LDKC2Tuple_SignatureSignatureZ*)(o_ptr);
15207         o_conv = C2Tuple_SignatureSignatureZ_clone((LDKC2Tuple_SignatureSignatureZ*)untag_ptr(o));
15208         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
15209         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o_conv);
15210         return tag_ptr(ret_conv, true);
15211 }
15212
15213 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_err"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_err() {
15214         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
15215         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_err();
15216         return tag_ptr(ret_conv, true);
15217 }
15218
15219 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(uint64_t o) {
15220         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(o);
15221         jboolean ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o_conv);
15222         return ret_conv;
15223 }
15224
15225 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_free"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_free(uint64_t _res) {
15226         if (!ptr_is_owned(_res)) return;
15227         void* _res_ptr = untag_ptr(_res);
15228         CHECK_ACCESS(_res_ptr);
15229         LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(_res_ptr);
15230         FREE(untag_ptr(_res));
15231         CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res_conv);
15232 }
15233
15234 static inline uint64_t CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR arg) {
15235         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
15236         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(arg);
15237         return tag_ptr(ret_conv, true);
15238 }
15239 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(uint64_t arg) {
15240         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(arg);
15241         int64_t ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(arg_conv);
15242         return ret_conv;
15243 }
15244
15245 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone(uint64_t orig) {
15246         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(orig);
15247         LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ");
15248         *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig_conv);
15249         return tag_ptr(ret_conv, true);
15250 }
15251
15252 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_ok"))) TS_CResult_SecretKeyNoneZ_ok(int8_tArray o) {
15253         LDKSecretKey o_ref;
15254         CHECK(o->arr_len == 32);
15255         memcpy(o_ref.bytes, o->elems, 32); FREE(o);
15256         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
15257         *ret_conv = CResult_SecretKeyNoneZ_ok(o_ref);
15258         return tag_ptr(ret_conv, true);
15259 }
15260
15261 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_err"))) TS_CResult_SecretKeyNoneZ_err() {
15262         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
15263         *ret_conv = CResult_SecretKeyNoneZ_err();
15264         return tag_ptr(ret_conv, true);
15265 }
15266
15267 jboolean  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_is_ok"))) TS_CResult_SecretKeyNoneZ_is_ok(uint64_t o) {
15268         LDKCResult_SecretKeyNoneZ* o_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(o);
15269         jboolean ret_conv = CResult_SecretKeyNoneZ_is_ok(o_conv);
15270         return ret_conv;
15271 }
15272
15273 void  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_free"))) TS_CResult_SecretKeyNoneZ_free(uint64_t _res) {
15274         if (!ptr_is_owned(_res)) return;
15275         void* _res_ptr = untag_ptr(_res);
15276         CHECK_ACCESS(_res_ptr);
15277         LDKCResult_SecretKeyNoneZ _res_conv = *(LDKCResult_SecretKeyNoneZ*)(_res_ptr);
15278         FREE(untag_ptr(_res));
15279         CResult_SecretKeyNoneZ_free(_res_conv);
15280 }
15281
15282 static inline uint64_t CResult_SecretKeyNoneZ_clone_ptr(LDKCResult_SecretKeyNoneZ *NONNULL_PTR arg) {
15283         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
15284         *ret_conv = CResult_SecretKeyNoneZ_clone(arg);
15285         return tag_ptr(ret_conv, true);
15286 }
15287 int64_t  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_clone_ptr"))) TS_CResult_SecretKeyNoneZ_clone_ptr(uint64_t arg) {
15288         LDKCResult_SecretKeyNoneZ* arg_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(arg);
15289         int64_t ret_conv = CResult_SecretKeyNoneZ_clone_ptr(arg_conv);
15290         return ret_conv;
15291 }
15292
15293 uint64_t  __attribute__((export_name("TS_CResult_SecretKeyNoneZ_clone"))) TS_CResult_SecretKeyNoneZ_clone(uint64_t orig) {
15294         LDKCResult_SecretKeyNoneZ* orig_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(orig);
15295         LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ");
15296         *ret_conv = CResult_SecretKeyNoneZ_clone(orig_conv);
15297         return tag_ptr(ret_conv, true);
15298 }
15299
15300 uint64_t  __attribute__((export_name("TS_COption_ScalarZ_some"))) TS_COption_ScalarZ_some(uint64_t o) {
15301         void* o_ptr = untag_ptr(o);
15302         CHECK_ACCESS(o_ptr);
15303         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
15304         // WARNING: we may need a move here but no clone is available for LDKBigEndianScalar
15305         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
15306         *ret_copy = COption_ScalarZ_some(o_conv);
15307         uint64_t ret_ref = tag_ptr(ret_copy, true);
15308         return ret_ref;
15309 }
15310
15311 uint64_t  __attribute__((export_name("TS_COption_ScalarZ_none"))) TS_COption_ScalarZ_none() {
15312         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
15313         *ret_copy = COption_ScalarZ_none();
15314         uint64_t ret_ref = tag_ptr(ret_copy, true);
15315         return ret_ref;
15316 }
15317
15318 void  __attribute__((export_name("TS_COption_ScalarZ_free"))) TS_COption_ScalarZ_free(uint64_t _res) {
15319         if (!ptr_is_owned(_res)) return;
15320         void* _res_ptr = untag_ptr(_res);
15321         CHECK_ACCESS(_res_ptr);
15322         LDKCOption_ScalarZ _res_conv = *(LDKCOption_ScalarZ*)(_res_ptr);
15323         FREE(untag_ptr(_res));
15324         COption_ScalarZ_free(_res_conv);
15325 }
15326
15327 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_ok"))) TS_CResult_SharedSecretNoneZ_ok(int8_tArray o) {
15328         LDKThirtyTwoBytes o_ref;
15329         CHECK(o->arr_len == 32);
15330         memcpy(o_ref.data, o->elems, 32); FREE(o);
15331         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
15332         *ret_conv = CResult_SharedSecretNoneZ_ok(o_ref);
15333         return tag_ptr(ret_conv, true);
15334 }
15335
15336 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_err"))) TS_CResult_SharedSecretNoneZ_err() {
15337         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
15338         *ret_conv = CResult_SharedSecretNoneZ_err();
15339         return tag_ptr(ret_conv, true);
15340 }
15341
15342 jboolean  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_is_ok"))) TS_CResult_SharedSecretNoneZ_is_ok(uint64_t o) {
15343         LDKCResult_SharedSecretNoneZ* o_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(o);
15344         jboolean ret_conv = CResult_SharedSecretNoneZ_is_ok(o_conv);
15345         return ret_conv;
15346 }
15347
15348 void  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_free"))) TS_CResult_SharedSecretNoneZ_free(uint64_t _res) {
15349         if (!ptr_is_owned(_res)) return;
15350         void* _res_ptr = untag_ptr(_res);
15351         CHECK_ACCESS(_res_ptr);
15352         LDKCResult_SharedSecretNoneZ _res_conv = *(LDKCResult_SharedSecretNoneZ*)(_res_ptr);
15353         FREE(untag_ptr(_res));
15354         CResult_SharedSecretNoneZ_free(_res_conv);
15355 }
15356
15357 static inline uint64_t CResult_SharedSecretNoneZ_clone_ptr(LDKCResult_SharedSecretNoneZ *NONNULL_PTR arg) {
15358         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
15359         *ret_conv = CResult_SharedSecretNoneZ_clone(arg);
15360         return tag_ptr(ret_conv, true);
15361 }
15362 int64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_clone_ptr"))) TS_CResult_SharedSecretNoneZ_clone_ptr(uint64_t arg) {
15363         LDKCResult_SharedSecretNoneZ* arg_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(arg);
15364         int64_t ret_conv = CResult_SharedSecretNoneZ_clone_ptr(arg_conv);
15365         return ret_conv;
15366 }
15367
15368 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_clone"))) TS_CResult_SharedSecretNoneZ_clone(uint64_t orig) {
15369         LDKCResult_SharedSecretNoneZ* orig_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(orig);
15370         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
15371         *ret_conv = CResult_SharedSecretNoneZ_clone(orig_conv);
15372         return tag_ptr(ret_conv, true);
15373 }
15374
15375 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_ok"))) TS_CResult_SignDecodeErrorZ_ok(uint64_t o) {
15376         void* o_ptr = untag_ptr(o);
15377         CHECK_ACCESS(o_ptr);
15378         LDKSign o_conv = *(LDKSign*)(o_ptr);
15379         if (o_conv.free == LDKSign_JCalls_free) {
15380                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
15381                 LDKSign_JCalls_cloned(&o_conv);
15382         }
15383         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
15384         *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
15385         return tag_ptr(ret_conv, true);
15386 }
15387
15388 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_err"))) TS_CResult_SignDecodeErrorZ_err(uint64_t e) {
15389         LDKDecodeError e_conv;
15390         e_conv.inner = untag_ptr(e);
15391         e_conv.is_owned = ptr_is_owned(e);
15392         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15393         e_conv = DecodeError_clone(&e_conv);
15394         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
15395         *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
15396         return tag_ptr(ret_conv, true);
15397 }
15398
15399 jboolean  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_is_ok"))) TS_CResult_SignDecodeErrorZ_is_ok(uint64_t o) {
15400         LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(o);
15401         jboolean ret_conv = CResult_SignDecodeErrorZ_is_ok(o_conv);
15402         return ret_conv;
15403 }
15404
15405 void  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_free"))) TS_CResult_SignDecodeErrorZ_free(uint64_t _res) {
15406         if (!ptr_is_owned(_res)) return;
15407         void* _res_ptr = untag_ptr(_res);
15408         CHECK_ACCESS(_res_ptr);
15409         LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr);
15410         FREE(untag_ptr(_res));
15411         CResult_SignDecodeErrorZ_free(_res_conv);
15412 }
15413
15414 static inline uint64_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) {
15415         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
15416         *ret_conv = CResult_SignDecodeErrorZ_clone(arg);
15417         return tag_ptr(ret_conv, true);
15418 }
15419 int64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone_ptr"))) TS_CResult_SignDecodeErrorZ_clone_ptr(uint64_t arg) {
15420         LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(arg);
15421         int64_t ret_conv = CResult_SignDecodeErrorZ_clone_ptr(arg_conv);
15422         return ret_conv;
15423 }
15424
15425 uint64_t  __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone"))) TS_CResult_SignDecodeErrorZ_clone(uint64_t orig) {
15426         LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(orig);
15427         LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
15428         *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
15429         return tag_ptr(ret_conv, true);
15430 }
15431
15432 void  __attribute__((export_name("TS_CVec_u5Z_free"))) TS_CVec_u5Z_free(ptrArray _res) {
15433         LDKCVec_u5Z _res_constr;
15434         _res_constr.datalen = _res->arr_len;
15435         if (_res_constr.datalen > 0)
15436                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
15437         else
15438                 _res_constr.data = NULL;
15439         int8_t* _res_vals = (void*) _res->elems;
15440         for (size_t h = 0; h < _res_constr.datalen; h++) {
15441                 int8_t _res_conv_7 = _res_vals[h];
15442                 
15443                 _res_constr.data[h] = (LDKu5){ ._0 = _res_conv_7 };
15444         }
15445         FREE(_res);
15446         CVec_u5Z_free(_res_constr);
15447 }
15448
15449 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
15450         LDKRecoverableSignature o_ref;
15451         CHECK(o->arr_len == 68);
15452         memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
15453         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
15454         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
15455         return tag_ptr(ret_conv, true);
15456 }
15457
15458 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_err"))) TS_CResult_RecoverableSignatureNoneZ_err() {
15459         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
15460         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
15461         return tag_ptr(ret_conv, true);
15462 }
15463
15464 jboolean  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_is_ok"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint64_t o) {
15465         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
15466         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
15467         return ret_conv;
15468 }
15469
15470 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_free"))) TS_CResult_RecoverableSignatureNoneZ_free(uint64_t _res) {
15471         if (!ptr_is_owned(_res)) return;
15472         void* _res_ptr = untag_ptr(_res);
15473         CHECK_ACCESS(_res_ptr);
15474         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
15475         FREE(untag_ptr(_res));
15476         CResult_RecoverableSignatureNoneZ_free(_res_conv);
15477 }
15478
15479 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
15480         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
15481         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
15482         return tag_ptr(ret_conv, true);
15483 }
15484 int64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone_ptr"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint64_t arg) {
15485         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
15486         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
15487         return ret_conv;
15488 }
15489
15490 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint64_t orig) {
15491         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
15492         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
15493         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
15494         return tag_ptr(ret_conv, true);
15495 }
15496
15497 void  __attribute__((export_name("TS_CVec_u8Z_free"))) TS_CVec_u8Z_free(int8_tArray _res) {
15498         LDKCVec_u8Z _res_ref;
15499         _res_ref.datalen = _res->arr_len;
15500         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
15501         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
15502         CVec_u8Z_free(_res_ref);
15503 }
15504
15505 void  __attribute__((export_name("TS_CVec_CVec_u8ZZ_free"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
15506         LDKCVec_CVec_u8ZZ _res_constr;
15507         _res_constr.datalen = _res->arr_len;
15508         if (_res_constr.datalen > 0)
15509                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
15510         else
15511                 _res_constr.data = NULL;
15512         int8_tArray* _res_vals = (void*) _res->elems;
15513         for (size_t m = 0; m < _res_constr.datalen; m++) {
15514                 int8_tArray _res_conv_12 = _res_vals[m];
15515                 LDKCVec_u8Z _res_conv_12_ref;
15516                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
15517                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
15518                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
15519                 _res_constr.data[m] = _res_conv_12_ref;
15520         }
15521         FREE(_res);
15522         CVec_CVec_u8ZZ_free(_res_constr);
15523 }
15524
15525 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
15526         LDKCVec_CVec_u8ZZ o_constr;
15527         o_constr.datalen = o->arr_len;
15528         if (o_constr.datalen > 0)
15529                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
15530         else
15531                 o_constr.data = NULL;
15532         int8_tArray* o_vals = (void*) o->elems;
15533         for (size_t m = 0; m < o_constr.datalen; m++) {
15534                 int8_tArray o_conv_12 = o_vals[m];
15535                 LDKCVec_u8Z o_conv_12_ref;
15536                 o_conv_12_ref.datalen = o_conv_12->arr_len;
15537                 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
15538                 memcpy(o_conv_12_ref.data, o_conv_12->elems, o_conv_12_ref.datalen); FREE(o_conv_12);
15539                 o_constr.data[m] = o_conv_12_ref;
15540         }
15541         FREE(o);
15542         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15543         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
15544         return tag_ptr(ret_conv, true);
15545 }
15546
15547 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
15548         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15549         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
15550         return tag_ptr(ret_conv, true);
15551 }
15552
15553 jboolean  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok(uint64_t o) {
15554         LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(o);
15555         jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
15556         return ret_conv;
15557 }
15558
15559 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_free"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint64_t _res) {
15560         if (!ptr_is_owned(_res)) return;
15561         void* _res_ptr = untag_ptr(_res);
15562         CHECK_ACCESS(_res_ptr);
15563         LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
15564         FREE(untag_ptr(_res));
15565         CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
15566 }
15567
15568 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
15569         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15570         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
15571         return tag_ptr(ret_conv, true);
15572 }
15573 int64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(uint64_t arg) {
15574         LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(arg);
15575         int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
15576         return ret_conv;
15577 }
15578
15579 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint64_t orig) {
15580         LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(orig);
15581         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15582         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
15583         return tag_ptr(ret_conv, true);
15584 }
15585
15586 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint64_t o) {
15587         LDKInMemorySigner o_conv;
15588         o_conv.inner = untag_ptr(o);
15589         o_conv.is_owned = ptr_is_owned(o);
15590         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15591         o_conv = InMemorySigner_clone(&o_conv);
15592         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15593         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
15594         return tag_ptr(ret_conv, true);
15595 }
15596
15597 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_err"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint64_t e) {
15598         LDKDecodeError e_conv;
15599         e_conv.inner = untag_ptr(e);
15600         e_conv.is_owned = ptr_is_owned(e);
15601         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15602         e_conv = DecodeError_clone(&e_conv);
15603         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15604         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
15605         return tag_ptr(ret_conv, true);
15606 }
15607
15608 jboolean  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_is_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint64_t o) {
15609         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
15610         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
15611         return ret_conv;
15612 }
15613
15614 void  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_free"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint64_t _res) {
15615         if (!ptr_is_owned(_res)) return;
15616         void* _res_ptr = untag_ptr(_res);
15617         CHECK_ACCESS(_res_ptr);
15618         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
15619         FREE(untag_ptr(_res));
15620         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
15621 }
15622
15623 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
15624         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15625         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
15626         return tag_ptr(ret_conv, true);
15627 }
15628 int64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint64_t arg) {
15629         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
15630         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
15631         return ret_conv;
15632 }
15633
15634 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint64_t orig) {
15635         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
15636         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15637         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
15638         return tag_ptr(ret_conv, true);
15639 }
15640
15641 void  __attribute__((export_name("TS_CVec_TxOutZ_free"))) TS_CVec_TxOutZ_free(uint64_tArray _res) {
15642         LDKCVec_TxOutZ _res_constr;
15643         _res_constr.datalen = _res->arr_len;
15644         if (_res_constr.datalen > 0)
15645                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
15646         else
15647                 _res_constr.data = NULL;
15648         uint64_t* _res_vals = _res->elems;
15649         for (size_t h = 0; h < _res_constr.datalen; h++) {
15650                 uint64_t _res_conv_7 = _res_vals[h];
15651                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
15652                 CHECK_ACCESS(_res_conv_7_ptr);
15653                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
15654                 FREE(untag_ptr(_res_conv_7));
15655                 _res_constr.data[h] = _res_conv_7_conv;
15656         }
15657         FREE(_res);
15658         CVec_TxOutZ_free(_res_constr);
15659 }
15660
15661 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_ok"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
15662         LDKTransaction o_ref;
15663         o_ref.datalen = o->arr_len;
15664         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
15665         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
15666         o_ref.data_is_owned = true;
15667         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15668         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
15669         return tag_ptr(ret_conv, true);
15670 }
15671
15672 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_err"))) TS_CResult_TransactionNoneZ_err() {
15673         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15674         *ret_conv = CResult_TransactionNoneZ_err();
15675         return tag_ptr(ret_conv, true);
15676 }
15677
15678 jboolean  __attribute__((export_name("TS_CResult_TransactionNoneZ_is_ok"))) TS_CResult_TransactionNoneZ_is_ok(uint64_t o) {
15679         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
15680         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
15681         return ret_conv;
15682 }
15683
15684 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_free"))) TS_CResult_TransactionNoneZ_free(uint64_t _res) {
15685         if (!ptr_is_owned(_res)) return;
15686         void* _res_ptr = untag_ptr(_res);
15687         CHECK_ACCESS(_res_ptr);
15688         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
15689         FREE(untag_ptr(_res));
15690         CResult_TransactionNoneZ_free(_res_conv);
15691 }
15692
15693 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
15694         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15695         *ret_conv = CResult_TransactionNoneZ_clone(arg);
15696         return tag_ptr(ret_conv, true);
15697 }
15698 int64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone_ptr"))) TS_CResult_TransactionNoneZ_clone_ptr(uint64_t arg) {
15699         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
15700         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
15701         return ret_conv;
15702 }
15703
15704 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone"))) TS_CResult_TransactionNoneZ_clone(uint64_t orig) {
15705         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
15706         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15707         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
15708         return tag_ptr(ret_conv, true);
15709 }
15710
15711 uint64_t  __attribute__((export_name("TS_COption_u16Z_some"))) TS_COption_u16Z_some(int16_t o) {
15712         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15713         *ret_copy = COption_u16Z_some(o);
15714         uint64_t ret_ref = tag_ptr(ret_copy, true);
15715         return ret_ref;
15716 }
15717
15718 uint64_t  __attribute__((export_name("TS_COption_u16Z_none"))) TS_COption_u16Z_none() {
15719         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15720         *ret_copy = COption_u16Z_none();
15721         uint64_t ret_ref = tag_ptr(ret_copy, true);
15722         return ret_ref;
15723 }
15724
15725 void  __attribute__((export_name("TS_COption_u16Z_free"))) TS_COption_u16Z_free(uint64_t _res) {
15726         if (!ptr_is_owned(_res)) return;
15727         void* _res_ptr = untag_ptr(_res);
15728         CHECK_ACCESS(_res_ptr);
15729         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
15730         FREE(untag_ptr(_res));
15731         COption_u16Z_free(_res_conv);
15732 }
15733
15734 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
15735         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15736         *ret_copy = COption_u16Z_clone(arg);
15737         uint64_t ret_ref = tag_ptr(ret_copy, true);
15738         return ret_ref;
15739 }
15740 int64_t  __attribute__((export_name("TS_COption_u16Z_clone_ptr"))) TS_COption_u16Z_clone_ptr(uint64_t arg) {
15741         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
15742         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
15743         return ret_conv;
15744 }
15745
15746 uint64_t  __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_clone(uint64_t orig) {
15747         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
15748         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
15749         *ret_copy = COption_u16Z_clone(orig_conv);
15750         uint64_t ret_ref = tag_ptr(ret_copy, true);
15751         return ret_ref;
15752 }
15753
15754 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_ok"))) TS_CResult_NoneAPIErrorZ_ok() {
15755         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15756         *ret_conv = CResult_NoneAPIErrorZ_ok();
15757         return tag_ptr(ret_conv, true);
15758 }
15759
15760 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_err"))) TS_CResult_NoneAPIErrorZ_err(uint64_t e) {
15761         void* e_ptr = untag_ptr(e);
15762         CHECK_ACCESS(e_ptr);
15763         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15764         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
15765         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15766         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
15767         return tag_ptr(ret_conv, true);
15768 }
15769
15770 jboolean  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_is_ok"))) TS_CResult_NoneAPIErrorZ_is_ok(uint64_t o) {
15771         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
15772         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
15773         return ret_conv;
15774 }
15775
15776 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_free"))) TS_CResult_NoneAPIErrorZ_free(uint64_t _res) {
15777         if (!ptr_is_owned(_res)) return;
15778         void* _res_ptr = untag_ptr(_res);
15779         CHECK_ACCESS(_res_ptr);
15780         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
15781         FREE(untag_ptr(_res));
15782         CResult_NoneAPIErrorZ_free(_res_conv);
15783 }
15784
15785 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
15786         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15787         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
15788         return tag_ptr(ret_conv, true);
15789 }
15790 int64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone_ptr"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint64_t arg) {
15791         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
15792         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
15793         return ret_conv;
15794 }
15795
15796 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone"))) TS_CResult_NoneAPIErrorZ_clone(uint64_t orig) {
15797         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
15798         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
15799         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
15800         return tag_ptr(ret_conv, true);
15801 }
15802
15803 void  __attribute__((export_name("TS_CVec_CResult_NoneAPIErrorZZ_free"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint64_tArray _res) {
15804         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
15805         _res_constr.datalen = _res->arr_len;
15806         if (_res_constr.datalen > 0)
15807                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
15808         else
15809                 _res_constr.data = NULL;
15810         uint64_t* _res_vals = _res->elems;
15811         for (size_t w = 0; w < _res_constr.datalen; w++) {
15812                 uint64_t _res_conv_22 = _res_vals[w];
15813                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
15814                 CHECK_ACCESS(_res_conv_22_ptr);
15815                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
15816                 FREE(untag_ptr(_res_conv_22));
15817                 _res_constr.data[w] = _res_conv_22_conv;
15818         }
15819         FREE(_res);
15820         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
15821 }
15822
15823 void  __attribute__((export_name("TS_CVec_APIErrorZ_free"))) TS_CVec_APIErrorZ_free(uint64_tArray _res) {
15824         LDKCVec_APIErrorZ _res_constr;
15825         _res_constr.datalen = _res->arr_len;
15826         if (_res_constr.datalen > 0)
15827                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
15828         else
15829                 _res_constr.data = NULL;
15830         uint64_t* _res_vals = _res->elems;
15831         for (size_t k = 0; k < _res_constr.datalen; k++) {
15832                 uint64_t _res_conv_10 = _res_vals[k];
15833                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
15834                 CHECK_ACCESS(_res_conv_10_ptr);
15835                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
15836                 FREE(untag_ptr(_res_conv_10));
15837                 _res_constr.data[k] = _res_conv_10_conv;
15838         }
15839         FREE(_res);
15840         CVec_APIErrorZ_free(_res_constr);
15841 }
15842
15843 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_ok"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) {
15844         LDKThirtyTwoBytes o_ref;
15845         CHECK(o->arr_len == 32);
15846         memcpy(o_ref.data, o->elems, 32); FREE(o);
15847         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15848         *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
15849         return tag_ptr(ret_conv, true);
15850 }
15851
15852 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_err"))) TS_CResult__u832APIErrorZ_err(uint64_t e) {
15853         void* e_ptr = untag_ptr(e);
15854         CHECK_ACCESS(e_ptr);
15855         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
15856         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
15857         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15858         *ret_conv = CResult__u832APIErrorZ_err(e_conv);
15859         return tag_ptr(ret_conv, true);
15860 }
15861
15862 jboolean  __attribute__((export_name("TS_CResult__u832APIErrorZ_is_ok"))) TS_CResult__u832APIErrorZ_is_ok(uint64_t o) {
15863         LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(o);
15864         jboolean ret_conv = CResult__u832APIErrorZ_is_ok(o_conv);
15865         return ret_conv;
15866 }
15867
15868 void  __attribute__((export_name("TS_CResult__u832APIErrorZ_free"))) TS_CResult__u832APIErrorZ_free(uint64_t _res) {
15869         if (!ptr_is_owned(_res)) return;
15870         void* _res_ptr = untag_ptr(_res);
15871         CHECK_ACCESS(_res_ptr);
15872         LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
15873         FREE(untag_ptr(_res));
15874         CResult__u832APIErrorZ_free(_res_conv);
15875 }
15876
15877 static inline uint64_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
15878         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15879         *ret_conv = CResult__u832APIErrorZ_clone(arg);
15880         return tag_ptr(ret_conv, true);
15881 }
15882 int64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_clone_ptr"))) TS_CResult__u832APIErrorZ_clone_ptr(uint64_t arg) {
15883         LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(arg);
15884         int64_t ret_conv = CResult__u832APIErrorZ_clone_ptr(arg_conv);
15885         return ret_conv;
15886 }
15887
15888 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_clone"))) TS_CResult__u832APIErrorZ_clone(uint64_t orig) {
15889         LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(orig);
15890         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
15891         *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
15892         return tag_ptr(ret_conv, true);
15893 }
15894
15895 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_ok(int8_tArray o) {
15896         LDKThirtyTwoBytes o_ref;
15897         CHECK(o->arr_len == 32);
15898         memcpy(o_ref.data, o->elems, 32); FREE(o);
15899         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15900         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref);
15901         return tag_ptr(ret_conv, true);
15902 }
15903
15904 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_err"))) TS_CResult_PaymentIdPaymentSendFailureZ_err(uint64_t e) {
15905         void* e_ptr = untag_ptr(e);
15906         CHECK_ACCESS(e_ptr);
15907         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
15908         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
15909         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15910         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv);
15911         return tag_ptr(ret_conv, true);
15912 }
15913
15914 jboolean  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_is_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_is_ok(uint64_t o) {
15915         LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(o);
15916         jboolean ret_conv = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv);
15917         return ret_conv;
15918 }
15919
15920 void  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_free"))) TS_CResult_PaymentIdPaymentSendFailureZ_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_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr);
15925         FREE(untag_ptr(_res));
15926         CResult_PaymentIdPaymentSendFailureZ_free(_res_conv);
15927 }
15928
15929 static inline uint64_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) {
15930         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15931         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg);
15932         return tag_ptr(ret_conv, true);
15933 }
15934 int64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr(uint64_t arg) {
15935         LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(arg);
15936         int64_t ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv);
15937         return ret_conv;
15938 }
15939
15940 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_clone"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone(uint64_t orig) {
15941         LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(orig);
15942         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
15943         *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv);
15944         return tag_ptr(ret_conv, true);
15945 }
15946
15947 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() {
15948         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15949         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
15950         return tag_ptr(ret_conv, true);
15951 }
15952
15953 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint64_t e) {
15954         void* e_ptr = untag_ptr(e);
15955         CHECK_ACCESS(e_ptr);
15956         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
15957         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
15958         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15959         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
15960         return tag_ptr(ret_conv, true);
15961 }
15962
15963 jboolean  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint64_t o) {
15964         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
15965         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
15966         return ret_conv;
15967 }
15968
15969 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint64_t _res) {
15970         if (!ptr_is_owned(_res)) return;
15971         void* _res_ptr = untag_ptr(_res);
15972         CHECK_ACCESS(_res_ptr);
15973         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
15974         FREE(untag_ptr(_res));
15975         CResult_NonePaymentSendFailureZ_free(_res_conv);
15976 }
15977
15978 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
15979         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15980         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
15981         return tag_ptr(ret_conv, true);
15982 }
15983 int64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint64_t arg) {
15984         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
15985         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
15986         return ret_conv;
15987 }
15988
15989 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint64_t orig) {
15990         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
15991         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
15992         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
15993         return tag_ptr(ret_conv, true);
15994 }
15995
15996 static inline uint64_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
15997         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
15998         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
15999         return tag_ptr(ret_conv, true);
16000 }
16001 int64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr(uint64_t arg) {
16002         LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(arg);
16003         int64_t ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
16004         return ret_conv;
16005 }
16006
16007 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint64_t orig) {
16008         LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(orig);
16009         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
16010         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
16011         return tag_ptr(ret_conv, true);
16012 }
16013
16014 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_new"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, int8_tArray b) {
16015         LDKThirtyTwoBytes a_ref;
16016         CHECK(a->arr_len == 32);
16017         memcpy(a_ref.data, a->elems, 32); FREE(a);
16018         LDKThirtyTwoBytes b_ref;
16019         CHECK(b->arr_len == 32);
16020         memcpy(b_ref.data, b->elems, 32); FREE(b);
16021         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
16022         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
16023         return tag_ptr(ret_conv, true);
16024 }
16025
16026 void  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_free"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint64_t _res) {
16027         if (!ptr_is_owned(_res)) return;
16028         void* _res_ptr = untag_ptr(_res);
16029         CHECK_ACCESS(_res_ptr);
16030         LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
16031         FREE(untag_ptr(_res));
16032         C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
16033 }
16034
16035 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint64_t o) {
16036         void* o_ptr = untag_ptr(o);
16037         CHECK_ACCESS(o_ptr);
16038         LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
16039         o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(o));
16040         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16041         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
16042         return tag_ptr(ret_conv, true);
16043 }
16044
16045 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint64_t e) {
16046         void* e_ptr = untag_ptr(e);
16047         CHECK_ACCESS(e_ptr);
16048         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
16049         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
16050         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16051         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
16052         return tag_ptr(ret_conv, true);
16053 }
16054
16055 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(uint64_t o) {
16056         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(o);
16057         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
16058         return ret_conv;
16059 }
16060
16061 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint64_t _res) {
16062         if (!ptr_is_owned(_res)) return;
16063         void* _res_ptr = untag_ptr(_res);
16064         CHECK_ACCESS(_res_ptr);
16065         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
16066         FREE(untag_ptr(_res));
16067         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
16068 }
16069
16070 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
16071         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16072         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
16073         return tag_ptr(ret_conv, true);
16074 }
16075 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(uint64_t arg) {
16076         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(arg);
16077         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
16078         return ret_conv;
16079 }
16080
16081 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint64_t orig) {
16082         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(orig);
16083         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
16084         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
16085         return tag_ptr(ret_conv, true);
16086 }
16087
16088 void  __attribute__((export_name("TS_CVec_ThirtyTwoBytesZ_free"))) TS_CVec_ThirtyTwoBytesZ_free(ptrArray _res) {
16089         LDKCVec_ThirtyTwoBytesZ _res_constr;
16090         _res_constr.datalen = _res->arr_len;
16091         if (_res_constr.datalen > 0)
16092                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
16093         else
16094                 _res_constr.data = NULL;
16095         int8_tArray* _res_vals = (void*) _res->elems;
16096         for (size_t m = 0; m < _res_constr.datalen; m++) {
16097                 int8_tArray _res_conv_12 = _res_vals[m];
16098                 LDKThirtyTwoBytes _res_conv_12_ref;
16099                 CHECK(_res_conv_12->arr_len == 32);
16100                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
16101                 _res_constr.data[m] = _res_conv_12_ref;
16102         }
16103         FREE(_res);
16104         CVec_ThirtyTwoBytesZ_free(_res_constr);
16105 }
16106
16107 static inline uint64_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
16108         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16109         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
16110         return tag_ptr(ret_conv, true);
16111 }
16112 int64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(uint64_t arg) {
16113         LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(arg);
16114         int64_t ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
16115         return ret_conv;
16116 }
16117
16118 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint64_t orig) {
16119         LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(orig);
16120         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16121         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
16122         return tag_ptr(ret_conv, true);
16123 }
16124
16125 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_new"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
16126         LDKThirtyTwoBytes a_ref;
16127         CHECK(a->arr_len == 32);
16128         memcpy(a_ref.data, a->elems, 32); FREE(a);
16129         LDKThirtyTwoBytes b_ref;
16130         CHECK(b->arr_len == 32);
16131         memcpy(b_ref.data, b->elems, 32); FREE(b);
16132         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16133         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
16134         return tag_ptr(ret_conv, true);
16135 }
16136
16137 void  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_free"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint64_t _res) {
16138         if (!ptr_is_owned(_res)) return;
16139         void* _res_ptr = untag_ptr(_res);
16140         CHECK_ACCESS(_res_ptr);
16141         LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
16142         FREE(untag_ptr(_res));
16143         C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
16144 }
16145
16146 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(uint64_t o) {
16147         void* o_ptr = untag_ptr(o);
16148         CHECK_ACCESS(o_ptr);
16149         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
16150         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
16151         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16152         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
16153         return tag_ptr(ret_conv, true);
16154 }
16155
16156 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() {
16157         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16158         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
16159         return tag_ptr(ret_conv, true);
16160 }
16161
16162 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(uint64_t o) {
16163         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(o);
16164         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
16165         return ret_conv;
16166 }
16167
16168 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(uint64_t _res) {
16169         if (!ptr_is_owned(_res)) return;
16170         void* _res_ptr = untag_ptr(_res);
16171         CHECK_ACCESS(_res_ptr);
16172         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
16173         FREE(untag_ptr(_res));
16174         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
16175 }
16176
16177 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
16178         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16179         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
16180         return tag_ptr(ret_conv, true);
16181 }
16182 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(uint64_t arg) {
16183         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(arg);
16184         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
16185         return ret_conv;
16186 }
16187
16188 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(uint64_t orig) {
16189         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(orig);
16190         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
16191         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
16192         return tag_ptr(ret_conv, true);
16193 }
16194
16195 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(uint64_t o) {
16196         void* o_ptr = untag_ptr(o);
16197         CHECK_ACCESS(o_ptr);
16198         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
16199         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
16200         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16201         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv);
16202         return tag_ptr(ret_conv, true);
16203 }
16204
16205 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(uint64_t e) {
16206         void* e_ptr = untag_ptr(e);
16207         CHECK_ACCESS(e_ptr);
16208         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16209         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
16210         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16211         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv);
16212         return tag_ptr(ret_conv, true);
16213 }
16214
16215 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(uint64_t o) {
16216         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(o);
16217         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv);
16218         return ret_conv;
16219 }
16220
16221 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(uint64_t _res) {
16222         if (!ptr_is_owned(_res)) return;
16223         void* _res_ptr = untag_ptr(_res);
16224         CHECK_ACCESS(_res_ptr);
16225         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr);
16226         FREE(untag_ptr(_res));
16227         CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv);
16228 }
16229
16230 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) {
16231         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16232         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg);
16233         return tag_ptr(ret_conv, true);
16234 }
16235 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(uint64_t arg) {
16236         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(arg);
16237         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv);
16238         return ret_conv;
16239 }
16240
16241 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(uint64_t orig) {
16242         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)untag_ptr(orig);
16243         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
16244         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv);
16245         return tag_ptr(ret_conv, true);
16246 }
16247
16248 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_ok"))) TS_CResult_PaymentSecretNoneZ_ok(int8_tArray o) {
16249         LDKThirtyTwoBytes o_ref;
16250         CHECK(o->arr_len == 32);
16251         memcpy(o_ref.data, o->elems, 32); FREE(o);
16252         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16253         *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
16254         return tag_ptr(ret_conv, true);
16255 }
16256
16257 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_err"))) TS_CResult_PaymentSecretNoneZ_err() {
16258         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16259         *ret_conv = CResult_PaymentSecretNoneZ_err();
16260         return tag_ptr(ret_conv, true);
16261 }
16262
16263 jboolean  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_is_ok"))) TS_CResult_PaymentSecretNoneZ_is_ok(uint64_t o) {
16264         LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(o);
16265         jboolean ret_conv = CResult_PaymentSecretNoneZ_is_ok(o_conv);
16266         return ret_conv;
16267 }
16268
16269 void  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_free"))) TS_CResult_PaymentSecretNoneZ_free(uint64_t _res) {
16270         if (!ptr_is_owned(_res)) return;
16271         void* _res_ptr = untag_ptr(_res);
16272         CHECK_ACCESS(_res_ptr);
16273         LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
16274         FREE(untag_ptr(_res));
16275         CResult_PaymentSecretNoneZ_free(_res_conv);
16276 }
16277
16278 static inline uint64_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
16279         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16280         *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
16281         return tag_ptr(ret_conv, true);
16282 }
16283 int64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone_ptr"))) TS_CResult_PaymentSecretNoneZ_clone_ptr(uint64_t arg) {
16284         LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(arg);
16285         int64_t ret_conv = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
16286         return ret_conv;
16287 }
16288
16289 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone"))) TS_CResult_PaymentSecretNoneZ_clone(uint64_t orig) {
16290         LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(orig);
16291         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
16292         *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
16293         return tag_ptr(ret_conv, true);
16294 }
16295
16296 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_ok"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) {
16297         LDKThirtyTwoBytes o_ref;
16298         CHECK(o->arr_len == 32);
16299         memcpy(o_ref.data, o->elems, 32); FREE(o);
16300         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16301         *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
16302         return tag_ptr(ret_conv, true);
16303 }
16304
16305 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_err"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint64_t e) {
16306         void* e_ptr = untag_ptr(e);
16307         CHECK_ACCESS(e_ptr);
16308         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16309         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
16310         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16311         *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
16312         return tag_ptr(ret_conv, true);
16313 }
16314
16315 jboolean  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_is_ok"))) TS_CResult_PaymentSecretAPIErrorZ_is_ok(uint64_t o) {
16316         LDKCResult_PaymentSecretAPIErrorZ* o_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(o);
16317         jboolean ret_conv = CResult_PaymentSecretAPIErrorZ_is_ok(o_conv);
16318         return ret_conv;
16319 }
16320
16321 void  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_free"))) TS_CResult_PaymentSecretAPIErrorZ_free(uint64_t _res) {
16322         if (!ptr_is_owned(_res)) return;
16323         void* _res_ptr = untag_ptr(_res);
16324         CHECK_ACCESS(_res_ptr);
16325         LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(_res_ptr);
16326         FREE(untag_ptr(_res));
16327         CResult_PaymentSecretAPIErrorZ_free(_res_conv);
16328 }
16329
16330 static inline uint64_t CResult_PaymentSecretAPIErrorZ_clone_ptr(LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR arg) {
16331         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16332         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(arg);
16333         return tag_ptr(ret_conv, true);
16334 }
16335 int64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone_ptr"))) TS_CResult_PaymentSecretAPIErrorZ_clone_ptr(uint64_t arg) {
16336         LDKCResult_PaymentSecretAPIErrorZ* arg_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(arg);
16337         int64_t ret_conv = CResult_PaymentSecretAPIErrorZ_clone_ptr(arg_conv);
16338         return ret_conv;
16339 }
16340
16341 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretAPIErrorZ_clone"))) TS_CResult_PaymentSecretAPIErrorZ_clone(uint64_t orig) {
16342         LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)untag_ptr(orig);
16343         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16344         *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
16345         return tag_ptr(ret_conv, true);
16346 }
16347
16348 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_ok(int8_tArray o) {
16349         LDKThirtyTwoBytes o_ref;
16350         CHECK(o->arr_len == 32);
16351         memcpy(o_ref.data, o->elems, 32); FREE(o);
16352         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16353         *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
16354         return tag_ptr(ret_conv, true);
16355 }
16356
16357 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_err"))) TS_CResult_PaymentPreimageAPIErrorZ_err(uint64_t e) {
16358         void* e_ptr = untag_ptr(e);
16359         CHECK_ACCESS(e_ptr);
16360         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
16361         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
16362         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16363         *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
16364         return tag_ptr(ret_conv, true);
16365 }
16366
16367 jboolean  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_is_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_is_ok(uint64_t o) {
16368         LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(o);
16369         jboolean ret_conv = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
16370         return ret_conv;
16371 }
16372
16373 void  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_free"))) TS_CResult_PaymentPreimageAPIErrorZ_free(uint64_t _res) {
16374         if (!ptr_is_owned(_res)) return;
16375         void* _res_ptr = untag_ptr(_res);
16376         CHECK_ACCESS(_res_ptr);
16377         LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
16378         FREE(untag_ptr(_res));
16379         CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
16380 }
16381
16382 static inline uint64_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
16383         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16384         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
16385         return tag_ptr(ret_conv, true);
16386 }
16387 int64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr"))) TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr(uint64_t arg) {
16388         LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(arg);
16389         int64_t ret_conv = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
16390         return ret_conv;
16391 }
16392
16393 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone"))) TS_CResult_PaymentPreimageAPIErrorZ_clone(uint64_t orig) {
16394         LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(orig);
16395         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
16396         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
16397         return tag_ptr(ret_conv, true);
16398 }
16399
16400 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(uint64_t o) {
16401         LDKCounterpartyForwardingInfo o_conv;
16402         o_conv.inner = untag_ptr(o);
16403         o_conv.is_owned = ptr_is_owned(o);
16404         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16405         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
16406         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
16407         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
16408         return tag_ptr(ret_conv, true);
16409 }
16410
16411 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(uint64_t e) {
16412         LDKDecodeError e_conv;
16413         e_conv.inner = untag_ptr(e);
16414         e_conv.is_owned = ptr_is_owned(e);
16415         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16416         e_conv = DecodeError_clone(&e_conv);
16417         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
16418         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
16419         return tag_ptr(ret_conv, true);
16420 }
16421
16422 jboolean  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(uint64_t o) {
16423         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
16424         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
16425         return ret_conv;
16426 }
16427
16428 void  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(uint64_t _res) {
16429         if (!ptr_is_owned(_res)) return;
16430         void* _res_ptr = untag_ptr(_res);
16431         CHECK_ACCESS(_res_ptr);
16432         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
16433         FREE(untag_ptr(_res));
16434         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
16435 }
16436
16437 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
16438         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
16439         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
16440         return tag_ptr(ret_conv, true);
16441 }
16442 int64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
16443         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
16444         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
16445         return ret_conv;
16446 }
16447
16448 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(uint64_t orig) {
16449         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
16450         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
16451         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
16452         return tag_ptr(ret_conv, true);
16453 }
16454
16455 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_ok(uint64_t o) {
16456         LDKChannelCounterparty o_conv;
16457         o_conv.inner = untag_ptr(o);
16458         o_conv.is_owned = ptr_is_owned(o);
16459         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16460         o_conv = ChannelCounterparty_clone(&o_conv);
16461         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
16462         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
16463         return tag_ptr(ret_conv, true);
16464 }
16465
16466 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_err(uint64_t e) {
16467         LDKDecodeError e_conv;
16468         e_conv.inner = untag_ptr(e);
16469         e_conv.is_owned = ptr_is_owned(e);
16470         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16471         e_conv = DecodeError_clone(&e_conv);
16472         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
16473         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
16474         return tag_ptr(ret_conv, true);
16475 }
16476
16477 jboolean  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(uint64_t o) {
16478         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
16479         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
16480         return ret_conv;
16481 }
16482
16483 void  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_free"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_free(uint64_t _res) {
16484         if (!ptr_is_owned(_res)) return;
16485         void* _res_ptr = untag_ptr(_res);
16486         CHECK_ACCESS(_res_ptr);
16487         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
16488         FREE(untag_ptr(_res));
16489         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
16490 }
16491
16492 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
16493         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
16494         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
16495         return tag_ptr(ret_conv, true);
16496 }
16497 int64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(uint64_t arg) {
16498         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
16499         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
16500         return ret_conv;
16501 }
16502
16503 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone(uint64_t orig) {
16504         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
16505         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
16506         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
16507         return tag_ptr(ret_conv, true);
16508 }
16509
16510 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_ok(uint64_t o) {
16511         LDKChannelDetails o_conv;
16512         o_conv.inner = untag_ptr(o);
16513         o_conv.is_owned = ptr_is_owned(o);
16514         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16515         o_conv = ChannelDetails_clone(&o_conv);
16516         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
16517         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
16518         return tag_ptr(ret_conv, true);
16519 }
16520
16521 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_err(uint64_t e) {
16522         LDKDecodeError e_conv;
16523         e_conv.inner = untag_ptr(e);
16524         e_conv.is_owned = ptr_is_owned(e);
16525         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16526         e_conv = DecodeError_clone(&e_conv);
16527         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
16528         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
16529         return tag_ptr(ret_conv, true);
16530 }
16531
16532 jboolean  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_is_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_is_ok(uint64_t o) {
16533         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
16534         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
16535         return ret_conv;
16536 }
16537
16538 void  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_free"))) TS_CResult_ChannelDetailsDecodeErrorZ_free(uint64_t _res) {
16539         if (!ptr_is_owned(_res)) return;
16540         void* _res_ptr = untag_ptr(_res);
16541         CHECK_ACCESS(_res_ptr);
16542         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
16543         FREE(untag_ptr(_res));
16544         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
16545 }
16546
16547 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
16548         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
16549         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
16550         return tag_ptr(ret_conv, true);
16551 }
16552 int64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(uint64_t arg) {
16553         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
16554         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
16555         return ret_conv;
16556 }
16557
16558 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone(uint64_t orig) {
16559         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
16560         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
16561         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
16562         return tag_ptr(ret_conv, true);
16563 }
16564
16565 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_ok(uint64_t o) {
16566         LDKPhantomRouteHints o_conv;
16567         o_conv.inner = untag_ptr(o);
16568         o_conv.is_owned = ptr_is_owned(o);
16569         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16570         o_conv = PhantomRouteHints_clone(&o_conv);
16571         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
16572         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
16573         return tag_ptr(ret_conv, true);
16574 }
16575
16576 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_err(uint64_t e) {
16577         LDKDecodeError e_conv;
16578         e_conv.inner = untag_ptr(e);
16579         e_conv.is_owned = ptr_is_owned(e);
16580         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16581         e_conv = DecodeError_clone(&e_conv);
16582         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
16583         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
16584         return tag_ptr(ret_conv, true);
16585 }
16586
16587 jboolean  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(uint64_t o) {
16588         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
16589         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
16590         return ret_conv;
16591 }
16592
16593 void  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_free"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_free(uint64_t _res) {
16594         if (!ptr_is_owned(_res)) return;
16595         void* _res_ptr = untag_ptr(_res);
16596         CHECK_ACCESS(_res_ptr);
16597         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
16598         FREE(untag_ptr(_res));
16599         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
16600 }
16601
16602 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
16603         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
16604         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
16605         return tag_ptr(ret_conv, true);
16606 }
16607 int64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(uint64_t arg) {
16608         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
16609         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
16610         return ret_conv;
16611 }
16612
16613 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone(uint64_t orig) {
16614         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
16615         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
16616         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
16617         return tag_ptr(ret_conv, true);
16618 }
16619
16620 void  __attribute__((export_name("TS_CVec_ChannelMonitorZ_free"))) TS_CVec_ChannelMonitorZ_free(uint64_tArray _res) {
16621         LDKCVec_ChannelMonitorZ _res_constr;
16622         _res_constr.datalen = _res->arr_len;
16623         if (_res_constr.datalen > 0)
16624                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
16625         else
16626                 _res_constr.data = NULL;
16627         uint64_t* _res_vals = _res->elems;
16628         for (size_t q = 0; q < _res_constr.datalen; q++) {
16629                 uint64_t _res_conv_16 = _res_vals[q];
16630                 LDKChannelMonitor _res_conv_16_conv;
16631                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
16632                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
16633                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
16634                 _res_constr.data[q] = _res_conv_16_conv;
16635         }
16636         FREE(_res);
16637         CVec_ChannelMonitorZ_free(_res_constr);
16638 }
16639
16640 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_new"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint64_t b) {
16641         LDKThirtyTwoBytes a_ref;
16642         CHECK(a->arr_len == 32);
16643         memcpy(a_ref.data, a->elems, 32); FREE(a);
16644         LDKChannelManager b_conv;
16645         b_conv.inner = untag_ptr(b);
16646         b_conv.is_owned = ptr_is_owned(b);
16647         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
16648         // WARNING: we need a move here but no clone is available for LDKChannelManager
16649         
16650         LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
16651         *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
16652         return tag_ptr(ret_conv, true);
16653 }
16654
16655 void  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_free"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint64_t _res) {
16656         if (!ptr_is_owned(_res)) return;
16657         void* _res_ptr = untag_ptr(_res);
16658         CHECK_ACCESS(_res_ptr);
16659         LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
16660         FREE(untag_ptr(_res));
16661         C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
16662 }
16663
16664 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint64_t o) {
16665         void* o_ptr = untag_ptr(o);
16666         CHECK_ACCESS(o_ptr);
16667         LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
16668         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
16669         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16670         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
16671         return tag_ptr(ret_conv, true);
16672 }
16673
16674 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint64_t e) {
16675         LDKDecodeError e_conv;
16676         e_conv.inner = untag_ptr(e);
16677         e_conv.is_owned = ptr_is_owned(e);
16678         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16679         e_conv = DecodeError_clone(&e_conv);
16680         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16681         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
16682         return tag_ptr(ret_conv, true);
16683 }
16684
16685 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(uint64_t o) {
16686         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(o);
16687         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
16688         return ret_conv;
16689 }
16690
16691 void  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint64_t _res) {
16692         if (!ptr_is_owned(_res)) return;
16693         void* _res_ptr = untag_ptr(_res);
16694         CHECK_ACCESS(_res_ptr);
16695         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
16696         FREE(untag_ptr(_res));
16697         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
16698 }
16699
16700 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint64_t o) {
16701         LDKChannelConfig o_conv;
16702         o_conv.inner = untag_ptr(o);
16703         o_conv.is_owned = ptr_is_owned(o);
16704         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16705         o_conv = ChannelConfig_clone(&o_conv);
16706         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16707         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
16708         return tag_ptr(ret_conv, true);
16709 }
16710
16711 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_err"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint64_t e) {
16712         LDKDecodeError e_conv;
16713         e_conv.inner = untag_ptr(e);
16714         e_conv.is_owned = ptr_is_owned(e);
16715         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16716         e_conv = DecodeError_clone(&e_conv);
16717         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16718         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
16719         return tag_ptr(ret_conv, true);
16720 }
16721
16722 jboolean  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_is_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint64_t o) {
16723         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
16724         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
16725         return ret_conv;
16726 }
16727
16728 void  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_free"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint64_t _res) {
16729         if (!ptr_is_owned(_res)) return;
16730         void* _res_ptr = untag_ptr(_res);
16731         CHECK_ACCESS(_res_ptr);
16732         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
16733         FREE(untag_ptr(_res));
16734         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
16735 }
16736
16737 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
16738         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16739         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
16740         return tag_ptr(ret_conv, true);
16741 }
16742 int64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint64_t arg) {
16743         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
16744         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
16745         return ret_conv;
16746 }
16747
16748 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint64_t orig) {
16749         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
16750         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
16751         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
16752         return tag_ptr(ret_conv, true);
16753 }
16754
16755 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint64_t o) {
16756         LDKOutPoint o_conv;
16757         o_conv.inner = untag_ptr(o);
16758         o_conv.is_owned = ptr_is_owned(o);
16759         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16760         o_conv = OutPoint_clone(&o_conv);
16761         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
16762         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
16763         return tag_ptr(ret_conv, true);
16764 }
16765
16766 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_err"))) TS_CResult_OutPointDecodeErrorZ_err(uint64_t e) {
16767         LDKDecodeError e_conv;
16768         e_conv.inner = untag_ptr(e);
16769         e_conv.is_owned = ptr_is_owned(e);
16770         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16771         e_conv = DecodeError_clone(&e_conv);
16772         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
16773         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
16774         return tag_ptr(ret_conv, true);
16775 }
16776
16777 jboolean  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_is_ok"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint64_t o) {
16778         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
16779         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
16780         return ret_conv;
16781 }
16782
16783 void  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_free"))) TS_CResult_OutPointDecodeErrorZ_free(uint64_t _res) {
16784         if (!ptr_is_owned(_res)) return;
16785         void* _res_ptr = untag_ptr(_res);
16786         CHECK_ACCESS(_res_ptr);
16787         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
16788         FREE(untag_ptr(_res));
16789         CResult_OutPointDecodeErrorZ_free(_res_conv);
16790 }
16791
16792 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
16793         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
16794         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
16795         return tag_ptr(ret_conv, true);
16796 }
16797 int64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone_ptr"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint64_t arg) {
16798         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
16799         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
16800         return ret_conv;
16801 }
16802
16803 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone"))) TS_CResult_OutPointDecodeErrorZ_clone(uint64_t orig) {
16804         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
16805         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
16806         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
16807         return tag_ptr(ret_conv, true);
16808 }
16809
16810 uint64_t  __attribute__((export_name("TS_COption_TypeZ_some"))) TS_COption_TypeZ_some(uint64_t o) {
16811         void* o_ptr = untag_ptr(o);
16812         CHECK_ACCESS(o_ptr);
16813         LDKType o_conv = *(LDKType*)(o_ptr);
16814         if (o_conv.free == LDKType_JCalls_free) {
16815                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16816                 LDKType_JCalls_cloned(&o_conv);
16817         }
16818         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
16819         *ret_copy = COption_TypeZ_some(o_conv);
16820         uint64_t ret_ref = tag_ptr(ret_copy, true);
16821         return ret_ref;
16822 }
16823
16824 uint64_t  __attribute__((export_name("TS_COption_TypeZ_none"))) TS_COption_TypeZ_none() {
16825         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
16826         *ret_copy = COption_TypeZ_none();
16827         uint64_t ret_ref = tag_ptr(ret_copy, true);
16828         return ret_ref;
16829 }
16830
16831 void  __attribute__((export_name("TS_COption_TypeZ_free"))) TS_COption_TypeZ_free(uint64_t _res) {
16832         if (!ptr_is_owned(_res)) return;
16833         void* _res_ptr = untag_ptr(_res);
16834         CHECK_ACCESS(_res_ptr);
16835         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
16836         FREE(untag_ptr(_res));
16837         COption_TypeZ_free(_res_conv);
16838 }
16839
16840 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
16841         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
16842         *ret_copy = COption_TypeZ_clone(arg);
16843         uint64_t ret_ref = tag_ptr(ret_copy, true);
16844         return ret_ref;
16845 }
16846 int64_t  __attribute__((export_name("TS_COption_TypeZ_clone_ptr"))) TS_COption_TypeZ_clone_ptr(uint64_t arg) {
16847         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
16848         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
16849         return ret_conv;
16850 }
16851
16852 uint64_t  __attribute__((export_name("TS_COption_TypeZ_clone"))) TS_COption_TypeZ_clone(uint64_t orig) {
16853         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
16854         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
16855         *ret_copy = COption_TypeZ_clone(orig_conv);
16856         uint64_t ret_ref = tag_ptr(ret_copy, true);
16857         return ret_ref;
16858 }
16859
16860 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint64_t o) {
16861         void* o_ptr = untag_ptr(o);
16862         CHECK_ACCESS(o_ptr);
16863         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
16864         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
16865         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16866         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
16867         return tag_ptr(ret_conv, true);
16868 }
16869
16870 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_err"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint64_t e) {
16871         LDKDecodeError e_conv;
16872         e_conv.inner = untag_ptr(e);
16873         e_conv.is_owned = ptr_is_owned(e);
16874         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16875         e_conv = DecodeError_clone(&e_conv);
16876         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16877         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
16878         return tag_ptr(ret_conv, true);
16879 }
16880
16881 jboolean  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_is_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint64_t o) {
16882         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
16883         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
16884         return ret_conv;
16885 }
16886
16887 void  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_free"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint64_t _res) {
16888         if (!ptr_is_owned(_res)) return;
16889         void* _res_ptr = untag_ptr(_res);
16890         CHECK_ACCESS(_res_ptr);
16891         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
16892         FREE(untag_ptr(_res));
16893         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
16894 }
16895
16896 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
16897         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16898         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
16899         return tag_ptr(ret_conv, true);
16900 }
16901 int64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint64_t arg) {
16902         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
16903         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
16904         return ret_conv;
16905 }
16906
16907 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint64_t orig) {
16908         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
16909         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
16910         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
16911         return tag_ptr(ret_conv, true);
16912 }
16913
16914 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_ok"))) TS_CResult_PaymentIdPaymentErrorZ_ok(int8_tArray o) {
16915         LDKThirtyTwoBytes o_ref;
16916         CHECK(o->arr_len == 32);
16917         memcpy(o_ref.data, o->elems, 32); FREE(o);
16918         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
16919         *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
16920         return tag_ptr(ret_conv, true);
16921 }
16922
16923 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_err"))) TS_CResult_PaymentIdPaymentErrorZ_err(uint64_t e) {
16924         void* e_ptr = untag_ptr(e);
16925         CHECK_ACCESS(e_ptr);
16926         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
16927         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
16928         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
16929         *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
16930         return tag_ptr(ret_conv, true);
16931 }
16932
16933 jboolean  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_is_ok"))) TS_CResult_PaymentIdPaymentErrorZ_is_ok(uint64_t o) {
16934         LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(o);
16935         jboolean ret_conv = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
16936         return ret_conv;
16937 }
16938
16939 void  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_free"))) TS_CResult_PaymentIdPaymentErrorZ_free(uint64_t _res) {
16940         if (!ptr_is_owned(_res)) return;
16941         void* _res_ptr = untag_ptr(_res);
16942         CHECK_ACCESS(_res_ptr);
16943         LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
16944         FREE(untag_ptr(_res));
16945         CResult_PaymentIdPaymentErrorZ_free(_res_conv);
16946 }
16947
16948 static inline uint64_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
16949         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
16950         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
16951         return tag_ptr(ret_conv, true);
16952 }
16953 int64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone_ptr"))) TS_CResult_PaymentIdPaymentErrorZ_clone_ptr(uint64_t arg) {
16954         LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(arg);
16955         int64_t ret_conv = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
16956         return ret_conv;
16957 }
16958
16959 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone"))) TS_CResult_PaymentIdPaymentErrorZ_clone(uint64_t orig) {
16960         LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(orig);
16961         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
16962         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
16963         return tag_ptr(ret_conv, true);
16964 }
16965
16966 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_ok(uint64_t o) {
16967         LDKInFlightHtlcs o_conv;
16968         o_conv.inner = untag_ptr(o);
16969         o_conv.is_owned = ptr_is_owned(o);
16970         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16971         // WARNING: we need a move here but no clone is available for LDKInFlightHtlcs
16972         
16973         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
16974         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
16975         return tag_ptr(ret_conv, true);
16976 }
16977
16978 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_err(uint64_t e) {
16979         LDKDecodeError e_conv;
16980         e_conv.inner = untag_ptr(e);
16981         e_conv.is_owned = ptr_is_owned(e);
16982         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16983         e_conv = DecodeError_clone(&e_conv);
16984         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
16985         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
16986         return tag_ptr(ret_conv, true);
16987 }
16988
16989 jboolean  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok(uint64_t o) {
16990         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
16991         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
16992         return ret_conv;
16993 }
16994
16995 void  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_free"))) TS_CResult_InFlightHtlcsDecodeErrorZ_free(uint64_t _res) {
16996         if (!ptr_is_owned(_res)) return;
16997         void* _res_ptr = untag_ptr(_res);
16998         CHECK_ACCESS(_res_ptr);
16999         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
17000         FREE(untag_ptr(_res));
17001         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
17002 }
17003
17004 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_ok"))) TS_CResult_SiPrefixParseErrorZ_ok(uint32_t o) {
17005         LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
17006         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
17007         *ret_conv = CResult_SiPrefixParseErrorZ_ok(o_conv);
17008         return tag_ptr(ret_conv, true);
17009 }
17010
17011 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_err"))) TS_CResult_SiPrefixParseErrorZ_err(uint64_t e) {
17012         void* e_ptr = untag_ptr(e);
17013         CHECK_ACCESS(e_ptr);
17014         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
17015         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
17016         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
17017         *ret_conv = CResult_SiPrefixParseErrorZ_err(e_conv);
17018         return tag_ptr(ret_conv, true);
17019 }
17020
17021 jboolean  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_is_ok"))) TS_CResult_SiPrefixParseErrorZ_is_ok(uint64_t o) {
17022         LDKCResult_SiPrefixParseErrorZ* o_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(o);
17023         jboolean ret_conv = CResult_SiPrefixParseErrorZ_is_ok(o_conv);
17024         return ret_conv;
17025 }
17026
17027 void  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_free"))) TS_CResult_SiPrefixParseErrorZ_free(uint64_t _res) {
17028         if (!ptr_is_owned(_res)) return;
17029         void* _res_ptr = untag_ptr(_res);
17030         CHECK_ACCESS(_res_ptr);
17031         LDKCResult_SiPrefixParseErrorZ _res_conv = *(LDKCResult_SiPrefixParseErrorZ*)(_res_ptr);
17032         FREE(untag_ptr(_res));
17033         CResult_SiPrefixParseErrorZ_free(_res_conv);
17034 }
17035
17036 static inline uint64_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg) {
17037         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
17038         *ret_conv = CResult_SiPrefixParseErrorZ_clone(arg);
17039         return tag_ptr(ret_conv, true);
17040 }
17041 int64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone_ptr"))) TS_CResult_SiPrefixParseErrorZ_clone_ptr(uint64_t arg) {
17042         LDKCResult_SiPrefixParseErrorZ* arg_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(arg);
17043         int64_t ret_conv = CResult_SiPrefixParseErrorZ_clone_ptr(arg_conv);
17044         return ret_conv;
17045 }
17046
17047 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone"))) TS_CResult_SiPrefixParseErrorZ_clone(uint64_t orig) {
17048         LDKCResult_SiPrefixParseErrorZ* orig_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(orig);
17049         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
17050         *ret_conv = CResult_SiPrefixParseErrorZ_clone(orig_conv);
17051         return tag_ptr(ret_conv, true);
17052 }
17053
17054 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_ok(uint64_t o) {
17055         LDKInvoice o_conv;
17056         o_conv.inner = untag_ptr(o);
17057         o_conv.is_owned = ptr_is_owned(o);
17058         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17059         o_conv = Invoice_clone(&o_conv);
17060         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
17061         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_ok(o_conv);
17062         return tag_ptr(ret_conv, true);
17063 }
17064
17065 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_err(uint64_t e) {
17066         void* e_ptr = untag_ptr(e);
17067         CHECK_ACCESS(e_ptr);
17068         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
17069         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
17070         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
17071         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_err(e_conv);
17072         return tag_ptr(ret_conv, true);
17073 }
17074
17075 jboolean  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok(uint64_t o) {
17076         LDKCResult_InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
17077         jboolean ret_conv = CResult_InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
17078         return ret_conv;
17079 }
17080
17081 void  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_free"))) TS_CResult_InvoiceParseOrSemanticErrorZ_free(uint64_t _res) {
17082         if (!ptr_is_owned(_res)) return;
17083         void* _res_ptr = untag_ptr(_res);
17084         CHECK_ACCESS(_res_ptr);
17085         LDKCResult_InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_InvoiceParseOrSemanticErrorZ*)(_res_ptr);
17086         FREE(untag_ptr(_res));
17087         CResult_InvoiceParseOrSemanticErrorZ_free(_res_conv);
17088 }
17089
17090 static inline uint64_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
17091         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
17092         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(arg);
17093         return tag_ptr(ret_conv, true);
17094 }
17095 int64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(uint64_t arg) {
17096         LDKCResult_InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
17097         int64_t ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
17098         return ret_conv;
17099 }
17100
17101 uint64_t  __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone(uint64_t orig) {
17102         LDKCResult_InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
17103         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
17104         *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(orig_conv);
17105         return tag_ptr(ret_conv, true);
17106 }
17107
17108 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_ok(uint64_t o) {
17109         LDKSignedRawInvoice o_conv;
17110         o_conv.inner = untag_ptr(o);
17111         o_conv.is_owned = ptr_is_owned(o);
17112         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17113         o_conv = SignedRawInvoice_clone(&o_conv);
17114         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
17115         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_ok(o_conv);
17116         return tag_ptr(ret_conv, true);
17117 }
17118
17119 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_err(uint64_t e) {
17120         void* e_ptr = untag_ptr(e);
17121         CHECK_ACCESS(e_ptr);
17122         LDKParseError e_conv = *(LDKParseError*)(e_ptr);
17123         e_conv = ParseError_clone((LDKParseError*)untag_ptr(e));
17124         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
17125         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_err(e_conv);
17126         return tag_ptr(ret_conv, true);
17127 }
17128
17129 jboolean  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_is_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_is_ok(uint64_t o) {
17130         LDKCResult_SignedRawInvoiceParseErrorZ* o_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(o);
17131         jboolean ret_conv = CResult_SignedRawInvoiceParseErrorZ_is_ok(o_conv);
17132         return ret_conv;
17133 }
17134
17135 void  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_free"))) TS_CResult_SignedRawInvoiceParseErrorZ_free(uint64_t _res) {
17136         if (!ptr_is_owned(_res)) return;
17137         void* _res_ptr = untag_ptr(_res);
17138         CHECK_ACCESS(_res_ptr);
17139         LDKCResult_SignedRawInvoiceParseErrorZ _res_conv = *(LDKCResult_SignedRawInvoiceParseErrorZ*)(_res_ptr);
17140         FREE(untag_ptr(_res));
17141         CResult_SignedRawInvoiceParseErrorZ_free(_res_conv);
17142 }
17143
17144 static inline uint64_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg) {
17145         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
17146         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(arg);
17147         return tag_ptr(ret_conv, true);
17148 }
17149 int64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr(uint64_t arg) {
17150         LDKCResult_SignedRawInvoiceParseErrorZ* arg_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(arg);
17151         int64_t ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone_ptr(arg_conv);
17152         return ret_conv;
17153 }
17154
17155 uint64_t  __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone(uint64_t orig) {
17156         LDKCResult_SignedRawInvoiceParseErrorZ* orig_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(orig);
17157         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
17158         *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(orig_conv);
17159         return tag_ptr(ret_conv, true);
17160 }
17161
17162 static inline uint64_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) {
17163         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
17164         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg);
17165         return tag_ptr(ret_conv, true);
17166 }
17167 int64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(uint64_t arg) {
17168         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(arg);
17169         int64_t ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv);
17170         return ret_conv;
17171 }
17172
17173 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint64_t orig) {
17174         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(orig);
17175         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
17176         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
17177         return tag_ptr(ret_conv, true);
17178 }
17179
17180 uint64_t  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint64_t a, int8_tArray b, uint64_t c) {
17181         LDKRawInvoice a_conv;
17182         a_conv.inner = untag_ptr(a);
17183         a_conv.is_owned = ptr_is_owned(a);
17184         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
17185         a_conv = RawInvoice_clone(&a_conv);
17186         LDKThirtyTwoBytes b_ref;
17187         CHECK(b->arr_len == 32);
17188         memcpy(b_ref.data, b->elems, 32); FREE(b);
17189         LDKInvoiceSignature c_conv;
17190         c_conv.inner = untag_ptr(c);
17191         c_conv.is_owned = ptr_is_owned(c);
17192         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
17193         c_conv = InvoiceSignature_clone(&c_conv);
17194         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
17195         *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
17196         return tag_ptr(ret_conv, true);
17197 }
17198
17199 void  __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint64_t _res) {
17200         if (!ptr_is_owned(_res)) return;
17201         void* _res_ptr = untag_ptr(_res);
17202         CHECK_ACCESS(_res_ptr);
17203         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr);
17204         FREE(untag_ptr(_res));
17205         C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
17206 }
17207
17208 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_ok"))) TS_CResult_PayeePubKeyErrorZ_ok(uint64_t o) {
17209         LDKPayeePubKey o_conv;
17210         o_conv.inner = untag_ptr(o);
17211         o_conv.is_owned = ptr_is_owned(o);
17212         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17213         o_conv = PayeePubKey_clone(&o_conv);
17214         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
17215         *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
17216         return tag_ptr(ret_conv, true);
17217 }
17218
17219 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_err"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
17220         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
17221         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
17222         *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
17223         return tag_ptr(ret_conv, true);
17224 }
17225
17226 jboolean  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_is_ok"))) TS_CResult_PayeePubKeyErrorZ_is_ok(uint64_t o) {
17227         LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(o);
17228         jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
17229         return ret_conv;
17230 }
17231
17232 void  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_free"))) TS_CResult_PayeePubKeyErrorZ_free(uint64_t _res) {
17233         if (!ptr_is_owned(_res)) return;
17234         void* _res_ptr = untag_ptr(_res);
17235         CHECK_ACCESS(_res_ptr);
17236         LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
17237         FREE(untag_ptr(_res));
17238         CResult_PayeePubKeyErrorZ_free(_res_conv);
17239 }
17240
17241 static inline uint64_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
17242         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
17243         *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
17244         return tag_ptr(ret_conv, true);
17245 }
17246 int64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone_ptr"))) TS_CResult_PayeePubKeyErrorZ_clone_ptr(uint64_t arg) {
17247         LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(arg);
17248         int64_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
17249         return ret_conv;
17250 }
17251
17252 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone"))) TS_CResult_PayeePubKeyErrorZ_clone(uint64_t orig) {
17253         LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(orig);
17254         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
17255         *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
17256         return tag_ptr(ret_conv, true);
17257 }
17258
17259 void  __attribute__((export_name("TS_CVec_PrivateRouteZ_free"))) TS_CVec_PrivateRouteZ_free(uint64_tArray _res) {
17260         LDKCVec_PrivateRouteZ _res_constr;
17261         _res_constr.datalen = _res->arr_len;
17262         if (_res_constr.datalen > 0)
17263                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
17264         else
17265                 _res_constr.data = NULL;
17266         uint64_t* _res_vals = _res->elems;
17267         for (size_t o = 0; o < _res_constr.datalen; o++) {
17268                 uint64_t _res_conv_14 = _res_vals[o];
17269                 LDKPrivateRoute _res_conv_14_conv;
17270                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
17271                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
17272                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
17273                 _res_constr.data[o] = _res_conv_14_conv;
17274         }
17275         FREE(_res);
17276         CVec_PrivateRouteZ_free(_res_constr);
17277 }
17278
17279 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint64_t o) {
17280         LDKPositiveTimestamp o_conv;
17281         o_conv.inner = untag_ptr(o);
17282         o_conv.is_owned = ptr_is_owned(o);
17283         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17284         o_conv = PositiveTimestamp_clone(&o_conv);
17285         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
17286         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
17287         return tag_ptr(ret_conv, true);
17288 }
17289
17290 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_err"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
17291         LDKCreationError e_conv = LDKCreationError_from_js(e);
17292         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
17293         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
17294         return tag_ptr(ret_conv, true);
17295 }
17296
17297 jboolean  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_is_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint64_t o) {
17298         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
17299         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
17300         return ret_conv;
17301 }
17302
17303 void  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_free"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint64_t _res) {
17304         if (!ptr_is_owned(_res)) return;
17305         void* _res_ptr = untag_ptr(_res);
17306         CHECK_ACCESS(_res_ptr);
17307         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
17308         FREE(untag_ptr(_res));
17309         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
17310 }
17311
17312 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
17313         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
17314         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
17315         return tag_ptr(ret_conv, true);
17316 }
17317 int64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint64_t arg) {
17318         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
17319         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
17320         return ret_conv;
17321 }
17322
17323 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint64_t orig) {
17324         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
17325         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
17326         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
17327         return tag_ptr(ret_conv, true);
17328 }
17329
17330 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_ok"))) TS_CResult_NoneSemanticErrorZ_ok() {
17331         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
17332         *ret_conv = CResult_NoneSemanticErrorZ_ok();
17333         return tag_ptr(ret_conv, true);
17334 }
17335
17336 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_err"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) {
17337         LDKSemanticError e_conv = LDKSemanticError_from_js(e);
17338         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
17339         *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
17340         return tag_ptr(ret_conv, true);
17341 }
17342
17343 jboolean  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_is_ok"))) TS_CResult_NoneSemanticErrorZ_is_ok(uint64_t o) {
17344         LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(o);
17345         jboolean ret_conv = CResult_NoneSemanticErrorZ_is_ok(o_conv);
17346         return ret_conv;
17347 }
17348
17349 void  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_free"))) TS_CResult_NoneSemanticErrorZ_free(uint64_t _res) {
17350         if (!ptr_is_owned(_res)) return;
17351         void* _res_ptr = untag_ptr(_res);
17352         CHECK_ACCESS(_res_ptr);
17353         LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr);
17354         FREE(untag_ptr(_res));
17355         CResult_NoneSemanticErrorZ_free(_res_conv);
17356 }
17357
17358 static inline uint64_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) {
17359         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
17360         *ret_conv = CResult_NoneSemanticErrorZ_clone(arg);
17361         return tag_ptr(ret_conv, true);
17362 }
17363 int64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone_ptr"))) TS_CResult_NoneSemanticErrorZ_clone_ptr(uint64_t arg) {
17364         LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(arg);
17365         int64_t ret_conv = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv);
17366         return ret_conv;
17367 }
17368
17369 uint64_t  __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone"))) TS_CResult_NoneSemanticErrorZ_clone(uint64_t orig) {
17370         LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(orig);
17371         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
17372         *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
17373         return tag_ptr(ret_conv, true);
17374 }
17375
17376 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_ok"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint64_t o) {
17377         LDKInvoice o_conv;
17378         o_conv.inner = untag_ptr(o);
17379         o_conv.is_owned = ptr_is_owned(o);
17380         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17381         o_conv = Invoice_clone(&o_conv);
17382         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
17383         *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
17384         return tag_ptr(ret_conv, true);
17385 }
17386
17387 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_err"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) {
17388         LDKSemanticError e_conv = LDKSemanticError_from_js(e);
17389         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
17390         *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
17391         return tag_ptr(ret_conv, true);
17392 }
17393
17394 jboolean  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_is_ok"))) TS_CResult_InvoiceSemanticErrorZ_is_ok(uint64_t o) {
17395         LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(o);
17396         jboolean ret_conv = CResult_InvoiceSemanticErrorZ_is_ok(o_conv);
17397         return ret_conv;
17398 }
17399
17400 void  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_free"))) TS_CResult_InvoiceSemanticErrorZ_free(uint64_t _res) {
17401         if (!ptr_is_owned(_res)) return;
17402         void* _res_ptr = untag_ptr(_res);
17403         CHECK_ACCESS(_res_ptr);
17404         LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr);
17405         FREE(untag_ptr(_res));
17406         CResult_InvoiceSemanticErrorZ_free(_res_conv);
17407 }
17408
17409 static inline uint64_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) {
17410         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
17411         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg);
17412         return tag_ptr(ret_conv, true);
17413 }
17414 int64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceSemanticErrorZ_clone_ptr(uint64_t arg) {
17415         LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(arg);
17416         int64_t ret_conv = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv);
17417         return ret_conv;
17418 }
17419
17420 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint64_t orig) {
17421         LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(orig);
17422         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
17423         *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
17424         return tag_ptr(ret_conv, true);
17425 }
17426
17427 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_ok"))) TS_CResult_DescriptionCreationErrorZ_ok(uint64_t o) {
17428         LDKDescription o_conv;
17429         o_conv.inner = untag_ptr(o);
17430         o_conv.is_owned = ptr_is_owned(o);
17431         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17432         o_conv = Description_clone(&o_conv);
17433         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
17434         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
17435         return tag_ptr(ret_conv, true);
17436 }
17437
17438 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_err"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
17439         LDKCreationError e_conv = LDKCreationError_from_js(e);
17440         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
17441         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
17442         return tag_ptr(ret_conv, true);
17443 }
17444
17445 jboolean  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_is_ok"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint64_t o) {
17446         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
17447         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
17448         return ret_conv;
17449 }
17450
17451 void  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_free"))) TS_CResult_DescriptionCreationErrorZ_free(uint64_t _res) {
17452         if (!ptr_is_owned(_res)) return;
17453         void* _res_ptr = untag_ptr(_res);
17454         CHECK_ACCESS(_res_ptr);
17455         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
17456         FREE(untag_ptr(_res));
17457         CResult_DescriptionCreationErrorZ_free(_res_conv);
17458 }
17459
17460 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
17461         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
17462         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
17463         return tag_ptr(ret_conv, true);
17464 }
17465 int64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone_ptr"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint64_t arg) {
17466         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
17467         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
17468         return ret_conv;
17469 }
17470
17471 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone"))) TS_CResult_DescriptionCreationErrorZ_clone(uint64_t orig) {
17472         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
17473         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
17474         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
17475         return tag_ptr(ret_conv, true);
17476 }
17477
17478 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_ok"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint64_t o) {
17479         LDKPrivateRoute o_conv;
17480         o_conv.inner = untag_ptr(o);
17481         o_conv.is_owned = ptr_is_owned(o);
17482         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17483         o_conv = PrivateRoute_clone(&o_conv);
17484         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
17485         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
17486         return tag_ptr(ret_conv, true);
17487 }
17488
17489 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_err"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
17490         LDKCreationError e_conv = LDKCreationError_from_js(e);
17491         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
17492         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
17493         return tag_ptr(ret_conv, true);
17494 }
17495
17496 jboolean  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_is_ok"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint64_t o) {
17497         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
17498         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
17499         return ret_conv;
17500 }
17501
17502 void  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_free"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint64_t _res) {
17503         if (!ptr_is_owned(_res)) return;
17504         void* _res_ptr = untag_ptr(_res);
17505         CHECK_ACCESS(_res_ptr);
17506         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
17507         FREE(untag_ptr(_res));
17508         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
17509 }
17510
17511 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
17512         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
17513         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
17514         return tag_ptr(ret_conv, true);
17515 }
17516 int64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone_ptr"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint64_t arg) {
17517         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
17518         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
17519         return ret_conv;
17520 }
17521
17522 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint64_t orig) {
17523         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
17524         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
17525         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
17526         return tag_ptr(ret_conv, true);
17527 }
17528
17529 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_ok"))) TS_CResult_StringErrorZ_ok(jstring o) {
17530         LDKStr o_conv = str_ref_to_owned_c(o);
17531         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17532         *ret_conv = CResult_StringErrorZ_ok(o_conv);
17533         return tag_ptr(ret_conv, true);
17534 }
17535
17536 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_err"))) TS_CResult_StringErrorZ_err(uint32_t e) {
17537         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
17538         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17539         *ret_conv = CResult_StringErrorZ_err(e_conv);
17540         return tag_ptr(ret_conv, true);
17541 }
17542
17543 jboolean  __attribute__((export_name("TS_CResult_StringErrorZ_is_ok"))) TS_CResult_StringErrorZ_is_ok(uint64_t o) {
17544         LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)untag_ptr(o);
17545         jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv);
17546         return ret_conv;
17547 }
17548
17549 void  __attribute__((export_name("TS_CResult_StringErrorZ_free"))) TS_CResult_StringErrorZ_free(uint64_t _res) {
17550         if (!ptr_is_owned(_res)) return;
17551         void* _res_ptr = untag_ptr(_res);
17552         CHECK_ACCESS(_res_ptr);
17553         LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
17554         FREE(untag_ptr(_res));
17555         CResult_StringErrorZ_free(_res_conv);
17556 }
17557
17558 static inline uint64_t CResult_StringErrorZ_clone_ptr(LDKCResult_StringErrorZ *NONNULL_PTR arg) {
17559         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17560         *ret_conv = CResult_StringErrorZ_clone(arg);
17561         return tag_ptr(ret_conv, true);
17562 }
17563 int64_t  __attribute__((export_name("TS_CResult_StringErrorZ_clone_ptr"))) TS_CResult_StringErrorZ_clone_ptr(uint64_t arg) {
17564         LDKCResult_StringErrorZ* arg_conv = (LDKCResult_StringErrorZ*)untag_ptr(arg);
17565         int64_t ret_conv = CResult_StringErrorZ_clone_ptr(arg_conv);
17566         return ret_conv;
17567 }
17568
17569 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_clone"))) TS_CResult_StringErrorZ_clone(uint64_t orig) {
17570         LDKCResult_StringErrorZ* orig_conv = (LDKCResult_StringErrorZ*)untag_ptr(orig);
17571         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
17572         *ret_conv = CResult_StringErrorZ_clone(orig_conv);
17573         return tag_ptr(ret_conv, true);
17574 }
17575
17576 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint64_t o) {
17577         LDKChannelMonitorUpdate o_conv;
17578         o_conv.inner = untag_ptr(o);
17579         o_conv.is_owned = ptr_is_owned(o);
17580         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17581         o_conv = ChannelMonitorUpdate_clone(&o_conv);
17582         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17583         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
17584         return tag_ptr(ret_conv, true);
17585 }
17586
17587 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint64_t e) {
17588         LDKDecodeError e_conv;
17589         e_conv.inner = untag_ptr(e);
17590         e_conv.is_owned = ptr_is_owned(e);
17591         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17592         e_conv = DecodeError_clone(&e_conv);
17593         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17594         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
17595         return tag_ptr(ret_conv, true);
17596 }
17597
17598 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint64_t o) {
17599         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
17600         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
17601         return ret_conv;
17602 }
17603
17604 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint64_t _res) {
17605         if (!ptr_is_owned(_res)) return;
17606         void* _res_ptr = untag_ptr(_res);
17607         CHECK_ACCESS(_res_ptr);
17608         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
17609         FREE(untag_ptr(_res));
17610         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
17611 }
17612
17613 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
17614         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17615         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
17616         return tag_ptr(ret_conv, true);
17617 }
17618 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
17619         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
17620         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
17621         return ret_conv;
17622 }
17623
17624 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint64_t orig) {
17625         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
17626         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
17627         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
17628         return tag_ptr(ret_conv, true);
17629 }
17630
17631 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint64_t o) {
17632         void* o_ptr = untag_ptr(o);
17633         CHECK_ACCESS(o_ptr);
17634         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
17635         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
17636         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17637         *ret_copy = COption_MonitorEventZ_some(o_conv);
17638         uint64_t ret_ref = tag_ptr(ret_copy, true);
17639         return ret_ref;
17640 }
17641
17642 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() {
17643         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17644         *ret_copy = COption_MonitorEventZ_none();
17645         uint64_t ret_ref = tag_ptr(ret_copy, true);
17646         return ret_ref;
17647 }
17648
17649 void  __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint64_t _res) {
17650         if (!ptr_is_owned(_res)) return;
17651         void* _res_ptr = untag_ptr(_res);
17652         CHECK_ACCESS(_res_ptr);
17653         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
17654         FREE(untag_ptr(_res));
17655         COption_MonitorEventZ_free(_res_conv);
17656 }
17657
17658 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
17659         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17660         *ret_copy = COption_MonitorEventZ_clone(arg);
17661         uint64_t ret_ref = tag_ptr(ret_copy, true);
17662         return ret_ref;
17663 }
17664 int64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint64_t arg) {
17665         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
17666         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
17667         return ret_conv;
17668 }
17669
17670 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint64_t orig) {
17671         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
17672         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
17673         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
17674         uint64_t ret_ref = tag_ptr(ret_copy, true);
17675         return ret_ref;
17676 }
17677
17678 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint64_t o) {
17679         void* o_ptr = untag_ptr(o);
17680         CHECK_ACCESS(o_ptr);
17681         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
17682         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
17683         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17684         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
17685         return tag_ptr(ret_conv, true);
17686 }
17687
17688 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint64_t e) {
17689         LDKDecodeError e_conv;
17690         e_conv.inner = untag_ptr(e);
17691         e_conv.is_owned = ptr_is_owned(e);
17692         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17693         e_conv = DecodeError_clone(&e_conv);
17694         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17695         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
17696         return tag_ptr(ret_conv, true);
17697 }
17698
17699 jboolean  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint64_t o) {
17700         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
17701         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
17702         return ret_conv;
17703 }
17704
17705 void  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint64_t _res) {
17706         if (!ptr_is_owned(_res)) return;
17707         void* _res_ptr = untag_ptr(_res);
17708         CHECK_ACCESS(_res_ptr);
17709         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
17710         FREE(untag_ptr(_res));
17711         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
17712 }
17713
17714 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
17715         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17716         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
17717         return tag_ptr(ret_conv, true);
17718 }
17719 int64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint64_t arg) {
17720         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
17721         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
17722         return ret_conv;
17723 }
17724
17725 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint64_t orig) {
17726         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
17727         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
17728         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
17729         return tag_ptr(ret_conv, true);
17730 }
17731
17732 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint64_t o) {
17733         LDKHTLCUpdate o_conv;
17734         o_conv.inner = untag_ptr(o);
17735         o_conv.is_owned = ptr_is_owned(o);
17736         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17737         o_conv = HTLCUpdate_clone(&o_conv);
17738         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17739         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
17740         return tag_ptr(ret_conv, true);
17741 }
17742
17743 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint64_t e) {
17744         LDKDecodeError e_conv;
17745         e_conv.inner = untag_ptr(e);
17746         e_conv.is_owned = ptr_is_owned(e);
17747         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
17748         e_conv = DecodeError_clone(&e_conv);
17749         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17750         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
17751         return tag_ptr(ret_conv, true);
17752 }
17753
17754 jboolean  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_is_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint64_t o) {
17755         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
17756         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
17757         return ret_conv;
17758 }
17759
17760 void  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_free"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint64_t _res) {
17761         if (!ptr_is_owned(_res)) return;
17762         void* _res_ptr = untag_ptr(_res);
17763         CHECK_ACCESS(_res_ptr);
17764         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
17765         FREE(untag_ptr(_res));
17766         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
17767 }
17768
17769 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
17770         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17771         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
17772         return tag_ptr(ret_conv, true);
17773 }
17774 int64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
17775         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
17776         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
17777         return ret_conv;
17778 }
17779
17780 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint64_t orig) {
17781         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
17782         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
17783         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
17784         return tag_ptr(ret_conv, true);
17785 }
17786
17787 static inline uint64_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
17788         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
17789         *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
17790         return tag_ptr(ret_conv, true);
17791 }
17792 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone_ptr"))) TS_C2Tuple_OutPointScriptZ_clone_ptr(uint64_t arg) {
17793         LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(arg);
17794         int64_t ret_conv = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
17795         return ret_conv;
17796 }
17797
17798 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone"))) TS_C2Tuple_OutPointScriptZ_clone(uint64_t orig) {
17799         LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(orig);
17800         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
17801         *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
17802         return tag_ptr(ret_conv, true);
17803 }
17804
17805 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_new"))) TS_C2Tuple_OutPointScriptZ_new(uint64_t a, int8_tArray b) {
17806         LDKOutPoint a_conv;
17807         a_conv.inner = untag_ptr(a);
17808         a_conv.is_owned = ptr_is_owned(a);
17809         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
17810         a_conv = OutPoint_clone(&a_conv);
17811         LDKCVec_u8Z b_ref;
17812         b_ref.datalen = b->arr_len;
17813         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
17814         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
17815         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
17816         *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
17817         return tag_ptr(ret_conv, true);
17818 }
17819
17820 void  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_free"))) TS_C2Tuple_OutPointScriptZ_free(uint64_t _res) {
17821         if (!ptr_is_owned(_res)) return;
17822         void* _res_ptr = untag_ptr(_res);
17823         CHECK_ACCESS(_res_ptr);
17824         LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
17825         FREE(untag_ptr(_res));
17826         C2Tuple_OutPointScriptZ_free(_res_conv);
17827 }
17828
17829 static inline uint64_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
17830         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
17831         *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
17832         return tag_ptr(ret_conv, true);
17833 }
17834 int64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone_ptr"))) TS_C2Tuple_u32ScriptZ_clone_ptr(uint64_t arg) {
17835         LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(arg);
17836         int64_t ret_conv = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
17837         return ret_conv;
17838 }
17839
17840 uint64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone"))) TS_C2Tuple_u32ScriptZ_clone(uint64_t orig) {
17841         LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(orig);
17842         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
17843         *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
17844         return tag_ptr(ret_conv, true);
17845 }
17846
17847 uint64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_new"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
17848         LDKCVec_u8Z b_ref;
17849         b_ref.datalen = b->arr_len;
17850         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
17851         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
17852         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
17853         *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
17854         return tag_ptr(ret_conv, true);
17855 }
17856
17857 void  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_free"))) TS_C2Tuple_u32ScriptZ_free(uint64_t _res) {
17858         if (!ptr_is_owned(_res)) return;
17859         void* _res_ptr = untag_ptr(_res);
17860         CHECK_ACCESS(_res_ptr);
17861         LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
17862         FREE(untag_ptr(_res));
17863         C2Tuple_u32ScriptZ_free(_res_conv);
17864 }
17865
17866 void  __attribute__((export_name("TS_CVec_C2Tuple_u32ScriptZZ_free"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint64_tArray _res) {
17867         LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
17868         _res_constr.datalen = _res->arr_len;
17869         if (_res_constr.datalen > 0)
17870                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
17871         else
17872                 _res_constr.data = NULL;
17873         uint64_t* _res_vals = _res->elems;
17874         for (size_t v = 0; v < _res_constr.datalen; v++) {
17875                 uint64_t _res_conv_21 = _res_vals[v];
17876                 void* _res_conv_21_ptr = untag_ptr(_res_conv_21);
17877                 CHECK_ACCESS(_res_conv_21_ptr);
17878                 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
17879                 FREE(untag_ptr(_res_conv_21));
17880                 _res_constr.data[v] = _res_conv_21_conv;
17881         }
17882         FREE(_res);
17883         CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
17884 }
17885
17886 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
17887         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
17888         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
17889         return tag_ptr(ret_conv, true);
17890 }
17891 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(uint64_t arg) {
17892         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(arg);
17893         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
17894         return ret_conv;
17895 }
17896
17897 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint64_t orig) {
17898         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(orig);
17899         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
17900         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
17901         return tag_ptr(ret_conv, true);
17902 }
17903
17904 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint64_tArray b) {
17905         LDKThirtyTwoBytes a_ref;
17906         CHECK(a->arr_len == 32);
17907         memcpy(a_ref.data, a->elems, 32); FREE(a);
17908         LDKCVec_C2Tuple_u32ScriptZZ b_constr;
17909         b_constr.datalen = b->arr_len;
17910         if (b_constr.datalen > 0)
17911                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
17912         else
17913                 b_constr.data = NULL;
17914         uint64_t* b_vals = b->elems;
17915         for (size_t v = 0; v < b_constr.datalen; v++) {
17916                 uint64_t b_conv_21 = b_vals[v];
17917                 void* b_conv_21_ptr = untag_ptr(b_conv_21);
17918                 CHECK_ACCESS(b_conv_21_ptr);
17919                 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
17920                 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)untag_ptr(b_conv_21));
17921                 b_constr.data[v] = b_conv_21_conv;
17922         }
17923         FREE(b);
17924         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
17925         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
17926         return tag_ptr(ret_conv, true);
17927 }
17928
17929 void  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint64_t _res) {
17930         if (!ptr_is_owned(_res)) return;
17931         void* _res_ptr = untag_ptr(_res);
17932         CHECK_ACCESS(_res_ptr);
17933         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
17934         FREE(untag_ptr(_res));
17935         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
17936 }
17937
17938 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint64_tArray _res) {
17939         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
17940         _res_constr.datalen = _res->arr_len;
17941         if (_res_constr.datalen > 0)
17942                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
17943         else
17944                 _res_constr.data = NULL;
17945         uint64_t* _res_vals = _res->elems;
17946         for (size_t o = 0; o < _res_constr.datalen; o++) {
17947                 uint64_t _res_conv_40 = _res_vals[o];
17948                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
17949                 CHECK_ACCESS(_res_conv_40_ptr);
17950                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
17951                 FREE(untag_ptr(_res_conv_40));
17952                 _res_constr.data[o] = _res_conv_40_conv;
17953         }
17954         FREE(_res);
17955         CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
17956 }
17957
17958 void  __attribute__((export_name("TS_CVec_EventZ_free"))) TS_CVec_EventZ_free(uint64_tArray _res) {
17959         LDKCVec_EventZ _res_constr;
17960         _res_constr.datalen = _res->arr_len;
17961         if (_res_constr.datalen > 0)
17962                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
17963         else
17964                 _res_constr.data = NULL;
17965         uint64_t* _res_vals = _res->elems;
17966         for (size_t h = 0; h < _res_constr.datalen; h++) {
17967                 uint64_t _res_conv_7 = _res_vals[h];
17968                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
17969                 CHECK_ACCESS(_res_conv_7_ptr);
17970                 LDKEvent _res_conv_7_conv = *(LDKEvent*)(_res_conv_7_ptr);
17971                 FREE(untag_ptr(_res_conv_7));
17972                 _res_constr.data[h] = _res_conv_7_conv;
17973         }
17974         FREE(_res);
17975         CVec_EventZ_free(_res_constr);
17976 }
17977
17978 void  __attribute__((export_name("TS_CVec_TransactionZ_free"))) TS_CVec_TransactionZ_free(ptrArray _res) {
17979         LDKCVec_TransactionZ _res_constr;
17980         _res_constr.datalen = _res->arr_len;
17981         if (_res_constr.datalen > 0)
17982                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
17983         else
17984                 _res_constr.data = NULL;
17985         int8_tArray* _res_vals = (void*) _res->elems;
17986         for (size_t m = 0; m < _res_constr.datalen; m++) {
17987                 int8_tArray _res_conv_12 = _res_vals[m];
17988                 LDKTransaction _res_conv_12_ref;
17989                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
17990                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
17991                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
17992                 _res_conv_12_ref.data_is_owned = true;
17993                 _res_constr.data[m] = _res_conv_12_ref;
17994         }
17995         FREE(_res);
17996         CVec_TransactionZ_free(_res_constr);
17997 }
17998
17999 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
18000         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18001         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
18002         return tag_ptr(ret_conv, true);
18003 }
18004 int64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone_ptr"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint64_t arg) {
18005         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
18006         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
18007         return ret_conv;
18008 }
18009
18010 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone"))) TS_C2Tuple_u32TxOutZ_clone(uint64_t orig) {
18011         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
18012         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18013         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
18014         return tag_ptr(ret_conv, true);
18015 }
18016
18017 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_new"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint64_t b) {
18018         void* b_ptr = untag_ptr(b);
18019         CHECK_ACCESS(b_ptr);
18020         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
18021         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
18022         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
18023         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
18024         return tag_ptr(ret_conv, true);
18025 }
18026
18027 void  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_free"))) TS_C2Tuple_u32TxOutZ_free(uint64_t _res) {
18028         if (!ptr_is_owned(_res)) return;
18029         void* _res_ptr = untag_ptr(_res);
18030         CHECK_ACCESS(_res_ptr);
18031         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
18032         FREE(untag_ptr(_res));
18033         C2Tuple_u32TxOutZ_free(_res_conv);
18034 }
18035
18036 void  __attribute__((export_name("TS_CVec_C2Tuple_u32TxOutZZ_free"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint64_tArray _res) {
18037         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
18038         _res_constr.datalen = _res->arr_len;
18039         if (_res_constr.datalen > 0)
18040                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
18041         else
18042                 _res_constr.data = NULL;
18043         uint64_t* _res_vals = _res->elems;
18044         for (size_t u = 0; u < _res_constr.datalen; u++) {
18045                 uint64_t _res_conv_20 = _res_vals[u];
18046                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
18047                 CHECK_ACCESS(_res_conv_20_ptr);
18048                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
18049                 FREE(untag_ptr(_res_conv_20));
18050                 _res_constr.data[u] = _res_conv_20_conv;
18051         }
18052         FREE(_res);
18053         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
18054 }
18055
18056 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
18057         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18058         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
18059         return tag_ptr(ret_conv, true);
18060 }
18061 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint64_t arg) {
18062         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
18063         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
18064         return ret_conv;
18065 }
18066
18067 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint64_t orig) {
18068         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
18069         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18070         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
18071         return tag_ptr(ret_conv, true);
18072 }
18073
18074 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint64_tArray b) {
18075         LDKThirtyTwoBytes a_ref;
18076         CHECK(a->arr_len == 32);
18077         memcpy(a_ref.data, a->elems, 32); FREE(a);
18078         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
18079         b_constr.datalen = b->arr_len;
18080         if (b_constr.datalen > 0)
18081                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
18082         else
18083                 b_constr.data = NULL;
18084         uint64_t* b_vals = b->elems;
18085         for (size_t u = 0; u < b_constr.datalen; u++) {
18086                 uint64_t b_conv_20 = b_vals[u];
18087                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
18088                 CHECK_ACCESS(b_conv_20_ptr);
18089                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
18090                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
18091                 b_constr.data[u] = b_conv_20_conv;
18092         }
18093         FREE(b);
18094         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
18095         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
18096         return tag_ptr(ret_conv, true);
18097 }
18098
18099 void  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint64_t _res) {
18100         if (!ptr_is_owned(_res)) return;
18101         void* _res_ptr = untag_ptr(_res);
18102         CHECK_ACCESS(_res_ptr);
18103         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
18104         FREE(untag_ptr(_res));
18105         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
18106 }
18107
18108 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint64_tArray _res) {
18109         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
18110         _res_constr.datalen = _res->arr_len;
18111         if (_res_constr.datalen > 0)
18112                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
18113         else
18114                 _res_constr.data = NULL;
18115         uint64_t* _res_vals = _res->elems;
18116         for (size_t n = 0; n < _res_constr.datalen; n++) {
18117                 uint64_t _res_conv_39 = _res_vals[n];
18118                 void* _res_conv_39_ptr = untag_ptr(_res_conv_39);
18119                 CHECK_ACCESS(_res_conv_39_ptr);
18120                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
18121                 FREE(untag_ptr(_res_conv_39));
18122                 _res_constr.data[n] = _res_conv_39_conv;
18123         }
18124         FREE(_res);
18125         CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
18126 }
18127
18128 void  __attribute__((export_name("TS_CVec_BalanceZ_free"))) TS_CVec_BalanceZ_free(uint64_tArray _res) {
18129         LDKCVec_BalanceZ _res_constr;
18130         _res_constr.datalen = _res->arr_len;
18131         if (_res_constr.datalen > 0)
18132                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
18133         else
18134                 _res_constr.data = NULL;
18135         uint64_t* _res_vals = _res->elems;
18136         for (size_t j = 0; j < _res_constr.datalen; j++) {
18137                 uint64_t _res_conv_9 = _res_vals[j];
18138                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
18139                 CHECK_ACCESS(_res_conv_9_ptr);
18140                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
18141                 FREE(untag_ptr(_res_conv_9));
18142                 _res_constr.data[j] = _res_conv_9_conv;
18143         }
18144         FREE(_res);
18145         CVec_BalanceZ_free(_res_constr);
18146 }
18147
18148 static inline uint64_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
18149         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18150         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
18151         return tag_ptr(ret_conv, true);
18152 }
18153 int64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr(uint64_t arg) {
18154         LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(arg);
18155         int64_t ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
18156         return ret_conv;
18157 }
18158
18159 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint64_t orig) {
18160         LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(orig);
18161         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18162         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
18163         return tag_ptr(ret_conv, true);
18164 }
18165
18166 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_new"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint64_t b) {
18167         LDKThirtyTwoBytes a_ref;
18168         CHECK(a->arr_len == 32);
18169         memcpy(a_ref.data, a->elems, 32); FREE(a);
18170         LDKChannelMonitor b_conv;
18171         b_conv.inner = untag_ptr(b);
18172         b_conv.is_owned = ptr_is_owned(b);
18173         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
18174         b_conv = ChannelMonitor_clone(&b_conv);
18175         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
18176         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
18177         return tag_ptr(ret_conv, true);
18178 }
18179
18180 void  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_free"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint64_t _res) {
18181         if (!ptr_is_owned(_res)) return;
18182         void* _res_ptr = untag_ptr(_res);
18183         CHECK_ACCESS(_res_ptr);
18184         LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
18185         FREE(untag_ptr(_res));
18186         C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
18187 }
18188
18189 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint64_t o) {
18190         void* o_ptr = untag_ptr(o);
18191         CHECK_ACCESS(o_ptr);
18192         LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
18193         o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(o));
18194         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18195         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
18196         return tag_ptr(ret_conv, true);
18197 }
18198
18199 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint64_t e) {
18200         LDKDecodeError e_conv;
18201         e_conv.inner = untag_ptr(e);
18202         e_conv.is_owned = ptr_is_owned(e);
18203         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18204         e_conv = DecodeError_clone(&e_conv);
18205         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18206         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
18207         return tag_ptr(ret_conv, true);
18208 }
18209
18210 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(uint64_t o) {
18211         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(o);
18212         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
18213         return ret_conv;
18214 }
18215
18216 void  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint64_t _res) {
18217         if (!ptr_is_owned(_res)) return;
18218         void* _res_ptr = untag_ptr(_res);
18219         CHECK_ACCESS(_res_ptr);
18220         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
18221         FREE(untag_ptr(_res));
18222         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
18223 }
18224
18225 static inline uint64_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
18226         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18227         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
18228         return tag_ptr(ret_conv, true);
18229 }
18230 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(uint64_t arg) {
18231         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
18232         int64_t ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
18233         return ret_conv;
18234 }
18235
18236 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint64_t orig) {
18237         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
18238         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
18239         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
18240         return tag_ptr(ret_conv, true);
18241 }
18242
18243 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
18244         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
18245         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
18246         return tag_ptr(ret_conv, true);
18247 }
18248 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone_ptr"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint64_t arg) {
18249         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
18250         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
18251         return ret_conv;
18252 }
18253
18254 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint64_t orig) {
18255         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
18256         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
18257         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
18258         return tag_ptr(ret_conv, true);
18259 }
18260
18261 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_new"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint64_t b) {
18262         LDKPublicKey a_ref;
18263         CHECK(a->arr_len == 33);
18264         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
18265         void* b_ptr = untag_ptr(b);
18266         CHECK_ACCESS(b_ptr);
18267         LDKType b_conv = *(LDKType*)(b_ptr);
18268         if (b_conv.free == LDKType_JCalls_free) {
18269                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18270                 LDKType_JCalls_cloned(&b_conv);
18271         }
18272         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
18273         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
18274         return tag_ptr(ret_conv, true);
18275 }
18276
18277 void  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_free"))) TS_C2Tuple_PublicKeyTypeZ_free(uint64_t _res) {
18278         if (!ptr_is_owned(_res)) return;
18279         void* _res_ptr = untag_ptr(_res);
18280         CHECK_ACCESS(_res_ptr);
18281         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
18282         FREE(untag_ptr(_res));
18283         C2Tuple_PublicKeyTypeZ_free(_res_conv);
18284 }
18285
18286 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyTypeZZ_free"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint64_tArray _res) {
18287         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
18288         _res_constr.datalen = _res->arr_len;
18289         if (_res_constr.datalen > 0)
18290                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
18291         else
18292                 _res_constr.data = NULL;
18293         uint64_t* _res_vals = _res->elems;
18294         for (size_t z = 0; z < _res_constr.datalen; z++) {
18295                 uint64_t _res_conv_25 = _res_vals[z];
18296                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
18297                 CHECK_ACCESS(_res_conv_25_ptr);
18298                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
18299                 FREE(untag_ptr(_res_conv_25));
18300                 _res_constr.data[z] = _res_conv_25_conv;
18301         }
18302         FREE(_res);
18303         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
18304 }
18305
18306 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_some"))) TS_COption_NetAddressZ_some(uint64_t o) {
18307         void* o_ptr = untag_ptr(o);
18308         CHECK_ACCESS(o_ptr);
18309         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
18310         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
18311         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18312         *ret_copy = COption_NetAddressZ_some(o_conv);
18313         uint64_t ret_ref = tag_ptr(ret_copy, true);
18314         return ret_ref;
18315 }
18316
18317 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_none"))) TS_COption_NetAddressZ_none() {
18318         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18319         *ret_copy = COption_NetAddressZ_none();
18320         uint64_t ret_ref = tag_ptr(ret_copy, true);
18321         return ret_ref;
18322 }
18323
18324 void  __attribute__((export_name("TS_COption_NetAddressZ_free"))) TS_COption_NetAddressZ_free(uint64_t _res) {
18325         if (!ptr_is_owned(_res)) return;
18326         void* _res_ptr = untag_ptr(_res);
18327         CHECK_ACCESS(_res_ptr);
18328         LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr);
18329         FREE(untag_ptr(_res));
18330         COption_NetAddressZ_free(_res_conv);
18331 }
18332
18333 static inline uint64_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) {
18334         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18335         *ret_copy = COption_NetAddressZ_clone(arg);
18336         uint64_t ret_ref = tag_ptr(ret_copy, true);
18337         return ret_ref;
18338 }
18339 int64_t  __attribute__((export_name("TS_COption_NetAddressZ_clone_ptr"))) TS_COption_NetAddressZ_clone_ptr(uint64_t arg) {
18340         LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)untag_ptr(arg);
18341         int64_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv);
18342         return ret_conv;
18343 }
18344
18345 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_clone"))) TS_COption_NetAddressZ_clone(uint64_t orig) {
18346         LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)untag_ptr(orig);
18347         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
18348         *ret_copy = COption_NetAddressZ_clone(orig_conv);
18349         uint64_t ret_ref = tag_ptr(ret_copy, true);
18350         return ret_ref;
18351 }
18352
18353 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
18354         LDKCVec_u8Z o_ref;
18355         o_ref.datalen = o->arr_len;
18356         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
18357         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
18358         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18359         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
18360         return tag_ptr(ret_conv, true);
18361 }
18362
18363 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint64_t e) {
18364         LDKPeerHandleError e_conv;
18365         e_conv.inner = untag_ptr(e);
18366         e_conv.is_owned = ptr_is_owned(e);
18367         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18368         e_conv = PeerHandleError_clone(&e_conv);
18369         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18370         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
18371         return tag_ptr(ret_conv, true);
18372 }
18373
18374 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint64_t o) {
18375         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
18376         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
18377         return ret_conv;
18378 }
18379
18380 void  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint64_t _res) {
18381         if (!ptr_is_owned(_res)) return;
18382         void* _res_ptr = untag_ptr(_res);
18383         CHECK_ACCESS(_res_ptr);
18384         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
18385         FREE(untag_ptr(_res));
18386         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
18387 }
18388
18389 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
18390         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18391         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
18392         return tag_ptr(ret_conv, true);
18393 }
18394 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint64_t arg) {
18395         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
18396         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
18397         return ret_conv;
18398 }
18399
18400 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint64_t orig) {
18401         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
18402         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
18403         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
18404         return tag_ptr(ret_conv, true);
18405 }
18406
18407 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() {
18408         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18409         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
18410         return tag_ptr(ret_conv, true);
18411 }
18412
18413 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint64_t e) {
18414         LDKPeerHandleError e_conv;
18415         e_conv.inner = untag_ptr(e);
18416         e_conv.is_owned = ptr_is_owned(e);
18417         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18418         e_conv = PeerHandleError_clone(&e_conv);
18419         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18420         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
18421         return tag_ptr(ret_conv, true);
18422 }
18423
18424 jboolean  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint64_t o) {
18425         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
18426         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
18427         return ret_conv;
18428 }
18429
18430 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint64_t _res) {
18431         if (!ptr_is_owned(_res)) return;
18432         void* _res_ptr = untag_ptr(_res);
18433         CHECK_ACCESS(_res_ptr);
18434         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
18435         FREE(untag_ptr(_res));
18436         CResult_NonePeerHandleErrorZ_free(_res_conv);
18437 }
18438
18439 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
18440         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18441         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
18442         return tag_ptr(ret_conv, true);
18443 }
18444 int64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint64_t arg) {
18445         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
18446         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
18447         return ret_conv;
18448 }
18449
18450 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint64_t orig) {
18451         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
18452         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
18453         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
18454         return tag_ptr(ret_conv, true);
18455 }
18456
18457 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
18458         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18459         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
18460         return tag_ptr(ret_conv, true);
18461 }
18462
18463 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint64_t e) {
18464         LDKPeerHandleError e_conv;
18465         e_conv.inner = untag_ptr(e);
18466         e_conv.is_owned = ptr_is_owned(e);
18467         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18468         e_conv = PeerHandleError_clone(&e_conv);
18469         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18470         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
18471         return tag_ptr(ret_conv, true);
18472 }
18473
18474 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint64_t o) {
18475         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
18476         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
18477         return ret_conv;
18478 }
18479
18480 void  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint64_t _res) {
18481         if (!ptr_is_owned(_res)) return;
18482         void* _res_ptr = untag_ptr(_res);
18483         CHECK_ACCESS(_res_ptr);
18484         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
18485         FREE(untag_ptr(_res));
18486         CResult_boolPeerHandleErrorZ_free(_res_conv);
18487 }
18488
18489 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
18490         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18491         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
18492         return tag_ptr(ret_conv, true);
18493 }
18494 int64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint64_t arg) {
18495         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
18496         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
18497         return ret_conv;
18498 }
18499
18500 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint64_t orig) {
18501         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
18502         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
18503         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
18504         return tag_ptr(ret_conv, true);
18505 }
18506
18507 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_ok"))) TS_CResult_NoneSendErrorZ_ok() {
18508         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
18509         *ret_conv = CResult_NoneSendErrorZ_ok();
18510         return tag_ptr(ret_conv, true);
18511 }
18512
18513 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_err"))) TS_CResult_NoneSendErrorZ_err(uint64_t e) {
18514         void* e_ptr = untag_ptr(e);
18515         CHECK_ACCESS(e_ptr);
18516         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
18517         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
18518         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
18519         *ret_conv = CResult_NoneSendErrorZ_err(e_conv);
18520         return tag_ptr(ret_conv, true);
18521 }
18522
18523 jboolean  __attribute__((export_name("TS_CResult_NoneSendErrorZ_is_ok"))) TS_CResult_NoneSendErrorZ_is_ok(uint64_t o) {
18524         LDKCResult_NoneSendErrorZ* o_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(o);
18525         jboolean ret_conv = CResult_NoneSendErrorZ_is_ok(o_conv);
18526         return ret_conv;
18527 }
18528
18529 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_free"))) TS_CResult_NoneSendErrorZ_free(uint64_t _res) {
18530         if (!ptr_is_owned(_res)) return;
18531         void* _res_ptr = untag_ptr(_res);
18532         CHECK_ACCESS(_res_ptr);
18533         LDKCResult_NoneSendErrorZ _res_conv = *(LDKCResult_NoneSendErrorZ*)(_res_ptr);
18534         FREE(untag_ptr(_res));
18535         CResult_NoneSendErrorZ_free(_res_conv);
18536 }
18537
18538 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_ok"))) TS_CResult_u32GraphSyncErrorZ_ok(int32_t o) {
18539         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
18540         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
18541         return tag_ptr(ret_conv, true);
18542 }
18543
18544 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_err"))) TS_CResult_u32GraphSyncErrorZ_err(uint64_t e) {
18545         void* e_ptr = untag_ptr(e);
18546         CHECK_ACCESS(e_ptr);
18547         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
18548         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
18549         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
18550         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
18551         return tag_ptr(ret_conv, true);
18552 }
18553
18554 jboolean  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_is_ok"))) TS_CResult_u32GraphSyncErrorZ_is_ok(uint64_t o) {
18555         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
18556         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
18557         return ret_conv;
18558 }
18559
18560 void  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_free"))) TS_CResult_u32GraphSyncErrorZ_free(uint64_t _res) {
18561         if (!ptr_is_owned(_res)) return;
18562         void* _res_ptr = untag_ptr(_res);
18563         CHECK_ACCESS(_res_ptr);
18564         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
18565         FREE(untag_ptr(_res));
18566         CResult_u32GraphSyncErrorZ_free(_res_conv);
18567 }
18568
18569 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_ok"))) TS_CResult_NoneErrorZ_ok() {
18570         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
18571         *ret_conv = CResult_NoneErrorZ_ok();
18572         return tag_ptr(ret_conv, true);
18573 }
18574
18575 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_err"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
18576         LDKIOError e_conv = LDKIOError_from_js(e);
18577         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
18578         *ret_conv = CResult_NoneErrorZ_err(e_conv);
18579         return tag_ptr(ret_conv, true);
18580 }
18581
18582 jboolean  __attribute__((export_name("TS_CResult_NoneErrorZ_is_ok"))) TS_CResult_NoneErrorZ_is_ok(uint64_t o) {
18583         LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)untag_ptr(o);
18584         jboolean ret_conv = CResult_NoneErrorZ_is_ok(o_conv);
18585         return ret_conv;
18586 }
18587
18588 void  __attribute__((export_name("TS_CResult_NoneErrorZ_free"))) TS_CResult_NoneErrorZ_free(uint64_t _res) {
18589         if (!ptr_is_owned(_res)) return;
18590         void* _res_ptr = untag_ptr(_res);
18591         CHECK_ACCESS(_res_ptr);
18592         LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
18593         FREE(untag_ptr(_res));
18594         CResult_NoneErrorZ_free(_res_conv);
18595 }
18596
18597 static inline uint64_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
18598         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
18599         *ret_conv = CResult_NoneErrorZ_clone(arg);
18600         return tag_ptr(ret_conv, true);
18601 }
18602 int64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_clone_ptr"))) TS_CResult_NoneErrorZ_clone_ptr(uint64_t arg) {
18603         LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)untag_ptr(arg);
18604         int64_t ret_conv = CResult_NoneErrorZ_clone_ptr(arg_conv);
18605         return ret_conv;
18606 }
18607
18608 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_clone"))) TS_CResult_NoneErrorZ_clone(uint64_t orig) {
18609         LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)untag_ptr(orig);
18610         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
18611         *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
18612         return tag_ptr(ret_conv, true);
18613 }
18614
18615 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_ok"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint64_t o) {
18616         void* o_ptr = untag_ptr(o);
18617         CHECK_ACCESS(o_ptr);
18618         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
18619         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
18620         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
18621         *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
18622         return tag_ptr(ret_conv, true);
18623 }
18624
18625 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_err"))) TS_CResult_NetAddressDecodeErrorZ_err(uint64_t e) {
18626         LDKDecodeError e_conv;
18627         e_conv.inner = untag_ptr(e);
18628         e_conv.is_owned = ptr_is_owned(e);
18629         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18630         e_conv = DecodeError_clone(&e_conv);
18631         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
18632         *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
18633         return tag_ptr(ret_conv, true);
18634 }
18635
18636 jboolean  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_is_ok"))) TS_CResult_NetAddressDecodeErrorZ_is_ok(uint64_t o) {
18637         LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(o);
18638         jboolean ret_conv = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
18639         return ret_conv;
18640 }
18641
18642 void  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_free"))) TS_CResult_NetAddressDecodeErrorZ_free(uint64_t _res) {
18643         if (!ptr_is_owned(_res)) return;
18644         void* _res_ptr = untag_ptr(_res);
18645         CHECK_ACCESS(_res_ptr);
18646         LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
18647         FREE(untag_ptr(_res));
18648         CResult_NetAddressDecodeErrorZ_free(_res_conv);
18649 }
18650
18651 static inline uint64_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
18652         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
18653         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
18654         return tag_ptr(ret_conv, true);
18655 }
18656 int64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone_ptr"))) TS_CResult_NetAddressDecodeErrorZ_clone_ptr(uint64_t arg) {
18657         LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(arg);
18658         int64_t ret_conv = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
18659         return ret_conv;
18660 }
18661
18662 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint64_t orig) {
18663         LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(orig);
18664         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
18665         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
18666         return tag_ptr(ret_conv, true);
18667 }
18668
18669 void  __attribute__((export_name("TS_CVec_UpdateAddHTLCZ_free"))) TS_CVec_UpdateAddHTLCZ_free(uint64_tArray _res) {
18670         LDKCVec_UpdateAddHTLCZ _res_constr;
18671         _res_constr.datalen = _res->arr_len;
18672         if (_res_constr.datalen > 0)
18673                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
18674         else
18675                 _res_constr.data = NULL;
18676         uint64_t* _res_vals = _res->elems;
18677         for (size_t p = 0; p < _res_constr.datalen; p++) {
18678                 uint64_t _res_conv_15 = _res_vals[p];
18679                 LDKUpdateAddHTLC _res_conv_15_conv;
18680                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
18681                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
18682                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
18683                 _res_constr.data[p] = _res_conv_15_conv;
18684         }
18685         FREE(_res);
18686         CVec_UpdateAddHTLCZ_free(_res_constr);
18687 }
18688
18689 void  __attribute__((export_name("TS_CVec_UpdateFulfillHTLCZ_free"))) TS_CVec_UpdateFulfillHTLCZ_free(uint64_tArray _res) {
18690         LDKCVec_UpdateFulfillHTLCZ _res_constr;
18691         _res_constr.datalen = _res->arr_len;
18692         if (_res_constr.datalen > 0)
18693                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
18694         else
18695                 _res_constr.data = NULL;
18696         uint64_t* _res_vals = _res->elems;
18697         for (size_t t = 0; t < _res_constr.datalen; t++) {
18698                 uint64_t _res_conv_19 = _res_vals[t];
18699                 LDKUpdateFulfillHTLC _res_conv_19_conv;
18700                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
18701                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
18702                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
18703                 _res_constr.data[t] = _res_conv_19_conv;
18704         }
18705         FREE(_res);
18706         CVec_UpdateFulfillHTLCZ_free(_res_constr);
18707 }
18708
18709 void  __attribute__((export_name("TS_CVec_UpdateFailHTLCZ_free"))) TS_CVec_UpdateFailHTLCZ_free(uint64_tArray _res) {
18710         LDKCVec_UpdateFailHTLCZ _res_constr;
18711         _res_constr.datalen = _res->arr_len;
18712         if (_res_constr.datalen > 0)
18713                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
18714         else
18715                 _res_constr.data = NULL;
18716         uint64_t* _res_vals = _res->elems;
18717         for (size_t q = 0; q < _res_constr.datalen; q++) {
18718                 uint64_t _res_conv_16 = _res_vals[q];
18719                 LDKUpdateFailHTLC _res_conv_16_conv;
18720                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
18721                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
18722                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
18723                 _res_constr.data[q] = _res_conv_16_conv;
18724         }
18725         FREE(_res);
18726         CVec_UpdateFailHTLCZ_free(_res_constr);
18727 }
18728
18729 void  __attribute__((export_name("TS_CVec_UpdateFailMalformedHTLCZ_free"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint64_tArray _res) {
18730         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
18731         _res_constr.datalen = _res->arr_len;
18732         if (_res_constr.datalen > 0)
18733                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
18734         else
18735                 _res_constr.data = NULL;
18736         uint64_t* _res_vals = _res->elems;
18737         for (size_t z = 0; z < _res_constr.datalen; z++) {
18738                 uint64_t _res_conv_25 = _res_vals[z];
18739                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
18740                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
18741                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
18742                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
18743                 _res_constr.data[z] = _res_conv_25_conv;
18744         }
18745         FREE(_res);
18746         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
18747 }
18748
18749 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint64_t o) {
18750         LDKAcceptChannel o_conv;
18751         o_conv.inner = untag_ptr(o);
18752         o_conv.is_owned = ptr_is_owned(o);
18753         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18754         o_conv = AcceptChannel_clone(&o_conv);
18755         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18756         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
18757         return tag_ptr(ret_conv, true);
18758 }
18759
18760 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_err"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint64_t e) {
18761         LDKDecodeError e_conv;
18762         e_conv.inner = untag_ptr(e);
18763         e_conv.is_owned = ptr_is_owned(e);
18764         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18765         e_conv = DecodeError_clone(&e_conv);
18766         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18767         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
18768         return tag_ptr(ret_conv, true);
18769 }
18770
18771 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint64_t o) {
18772         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
18773         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
18774         return ret_conv;
18775 }
18776
18777 void  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_free"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint64_t _res) {
18778         if (!ptr_is_owned(_res)) return;
18779         void* _res_ptr = untag_ptr(_res);
18780         CHECK_ACCESS(_res_ptr);
18781         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
18782         FREE(untag_ptr(_res));
18783         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
18784 }
18785
18786 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
18787         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18788         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
18789         return tag_ptr(ret_conv, true);
18790 }
18791 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
18792         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
18793         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
18794         return ret_conv;
18795 }
18796
18797 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint64_t orig) {
18798         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
18799         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
18800         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
18801         return tag_ptr(ret_conv, true);
18802 }
18803
18804 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint64_t o) {
18805         LDKAnnouncementSignatures o_conv;
18806         o_conv.inner = untag_ptr(o);
18807         o_conv.is_owned = ptr_is_owned(o);
18808         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18809         o_conv = AnnouncementSignatures_clone(&o_conv);
18810         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18811         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
18812         return tag_ptr(ret_conv, true);
18813 }
18814
18815 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint64_t e) {
18816         LDKDecodeError e_conv;
18817         e_conv.inner = untag_ptr(e);
18818         e_conv.is_owned = ptr_is_owned(e);
18819         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18820         e_conv = DecodeError_clone(&e_conv);
18821         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18822         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
18823         return tag_ptr(ret_conv, true);
18824 }
18825
18826 jboolean  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint64_t o) {
18827         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
18828         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
18829         return ret_conv;
18830 }
18831
18832 void  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_free"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint64_t _res) {
18833         if (!ptr_is_owned(_res)) return;
18834         void* _res_ptr = untag_ptr(_res);
18835         CHECK_ACCESS(_res_ptr);
18836         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
18837         FREE(untag_ptr(_res));
18838         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
18839 }
18840
18841 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
18842         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18843         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
18844         return tag_ptr(ret_conv, true);
18845 }
18846 int64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18847         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
18848         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
18849         return ret_conv;
18850 }
18851
18852 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint64_t orig) {
18853         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
18854         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
18855         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
18856         return tag_ptr(ret_conv, true);
18857 }
18858
18859 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint64_t o) {
18860         LDKChannelReestablish o_conv;
18861         o_conv.inner = untag_ptr(o);
18862         o_conv.is_owned = ptr_is_owned(o);
18863         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18864         o_conv = ChannelReestablish_clone(&o_conv);
18865         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18866         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
18867         return tag_ptr(ret_conv, true);
18868 }
18869
18870 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint64_t e) {
18871         LDKDecodeError e_conv;
18872         e_conv.inner = untag_ptr(e);
18873         e_conv.is_owned = ptr_is_owned(e);
18874         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18875         e_conv = DecodeError_clone(&e_conv);
18876         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18877         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
18878         return tag_ptr(ret_conv, true);
18879 }
18880
18881 jboolean  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_is_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint64_t o) {
18882         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
18883         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
18884         return ret_conv;
18885 }
18886
18887 void  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_free"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint64_t _res) {
18888         if (!ptr_is_owned(_res)) return;
18889         void* _res_ptr = untag_ptr(_res);
18890         CHECK_ACCESS(_res_ptr);
18891         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
18892         FREE(untag_ptr(_res));
18893         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
18894 }
18895
18896 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
18897         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18898         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
18899         return tag_ptr(ret_conv, true);
18900 }
18901 int64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint64_t arg) {
18902         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
18903         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
18904         return ret_conv;
18905 }
18906
18907 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint64_t orig) {
18908         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
18909         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
18910         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
18911         return tag_ptr(ret_conv, true);
18912 }
18913
18914 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint64_t o) {
18915         LDKClosingSigned o_conv;
18916         o_conv.inner = untag_ptr(o);
18917         o_conv.is_owned = ptr_is_owned(o);
18918         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18919         o_conv = ClosingSigned_clone(&o_conv);
18920         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
18921         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
18922         return tag_ptr(ret_conv, true);
18923 }
18924
18925 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_err"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint64_t e) {
18926         LDKDecodeError e_conv;
18927         e_conv.inner = untag_ptr(e);
18928         e_conv.is_owned = ptr_is_owned(e);
18929         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18930         e_conv = DecodeError_clone(&e_conv);
18931         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
18932         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
18933         return tag_ptr(ret_conv, true);
18934 }
18935
18936 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint64_t o) {
18937         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
18938         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
18939         return ret_conv;
18940 }
18941
18942 void  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_free"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint64_t _res) {
18943         if (!ptr_is_owned(_res)) return;
18944         void* _res_ptr = untag_ptr(_res);
18945         CHECK_ACCESS(_res_ptr);
18946         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
18947         FREE(untag_ptr(_res));
18948         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
18949 }
18950
18951 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
18952         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
18953         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
18954         return tag_ptr(ret_conv, true);
18955 }
18956 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
18957         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
18958         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
18959         return ret_conv;
18960 }
18961
18962 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint64_t orig) {
18963         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
18964         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
18965         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
18966         return tag_ptr(ret_conv, true);
18967 }
18968
18969 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint64_t o) {
18970         LDKClosingSignedFeeRange o_conv;
18971         o_conv.inner = untag_ptr(o);
18972         o_conv.is_owned = ptr_is_owned(o);
18973         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18974         o_conv = ClosingSignedFeeRange_clone(&o_conv);
18975         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
18976         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
18977         return tag_ptr(ret_conv, true);
18978 }
18979
18980 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint64_t e) {
18981         LDKDecodeError e_conv;
18982         e_conv.inner = untag_ptr(e);
18983         e_conv.is_owned = ptr_is_owned(e);
18984         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
18985         e_conv = DecodeError_clone(&e_conv);
18986         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
18987         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
18988         return tag_ptr(ret_conv, true);
18989 }
18990
18991 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint64_t o) {
18992         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
18993         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
18994         return ret_conv;
18995 }
18996
18997 void  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint64_t _res) {
18998         if (!ptr_is_owned(_res)) return;
18999         void* _res_ptr = untag_ptr(_res);
19000         CHECK_ACCESS(_res_ptr);
19001         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
19002         FREE(untag_ptr(_res));
19003         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
19004 }
19005
19006 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
19007         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
19008         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
19009         return tag_ptr(ret_conv, true);
19010 }
19011 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
19012         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
19013         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
19014         return ret_conv;
19015 }
19016
19017 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint64_t orig) {
19018         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
19019         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
19020         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
19021         return tag_ptr(ret_conv, true);
19022 }
19023
19024 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint64_t o) {
19025         LDKCommitmentSigned o_conv;
19026         o_conv.inner = untag_ptr(o);
19027         o_conv.is_owned = ptr_is_owned(o);
19028         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19029         o_conv = CommitmentSigned_clone(&o_conv);
19030         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
19031         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
19032         return tag_ptr(ret_conv, true);
19033 }
19034
19035 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint64_t e) {
19036         LDKDecodeError e_conv;
19037         e_conv.inner = untag_ptr(e);
19038         e_conv.is_owned = ptr_is_owned(e);
19039         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19040         e_conv = DecodeError_clone(&e_conv);
19041         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
19042         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
19043         return tag_ptr(ret_conv, true);
19044 }
19045
19046 jboolean  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_is_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint64_t o) {
19047         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
19048         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
19049         return ret_conv;
19050 }
19051
19052 void  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_free"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint64_t _res) {
19053         if (!ptr_is_owned(_res)) return;
19054         void* _res_ptr = untag_ptr(_res);
19055         CHECK_ACCESS(_res_ptr);
19056         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
19057         FREE(untag_ptr(_res));
19058         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
19059 }
19060
19061 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
19062         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
19063         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
19064         return tag_ptr(ret_conv, true);
19065 }
19066 int64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
19067         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
19068         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
19069         return ret_conv;
19070 }
19071
19072 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint64_t orig) {
19073         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
19074         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
19075         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
19076         return tag_ptr(ret_conv, true);
19077 }
19078
19079 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint64_t o) {
19080         LDKFundingCreated o_conv;
19081         o_conv.inner = untag_ptr(o);
19082         o_conv.is_owned = ptr_is_owned(o);
19083         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19084         o_conv = FundingCreated_clone(&o_conv);
19085         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
19086         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
19087         return tag_ptr(ret_conv, true);
19088 }
19089
19090 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_err"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint64_t e) {
19091         LDKDecodeError e_conv;
19092         e_conv.inner = untag_ptr(e);
19093         e_conv.is_owned = ptr_is_owned(e);
19094         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19095         e_conv = DecodeError_clone(&e_conv);
19096         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
19097         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
19098         return tag_ptr(ret_conv, true);
19099 }
19100
19101 jboolean  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_is_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint64_t o) {
19102         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
19103         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
19104         return ret_conv;
19105 }
19106
19107 void  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_free"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint64_t _res) {
19108         if (!ptr_is_owned(_res)) return;
19109         void* _res_ptr = untag_ptr(_res);
19110         CHECK_ACCESS(_res_ptr);
19111         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
19112         FREE(untag_ptr(_res));
19113         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
19114 }
19115
19116 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
19117         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
19118         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
19119         return tag_ptr(ret_conv, true);
19120 }
19121 int64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint64_t arg) {
19122         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
19123         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
19124         return ret_conv;
19125 }
19126
19127 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint64_t orig) {
19128         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
19129         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
19130         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
19131         return tag_ptr(ret_conv, true);
19132 }
19133
19134 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_ok"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint64_t o) {
19135         LDKFundingSigned o_conv;
19136         o_conv.inner = untag_ptr(o);
19137         o_conv.is_owned = ptr_is_owned(o);
19138         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19139         o_conv = FundingSigned_clone(&o_conv);
19140         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
19141         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
19142         return tag_ptr(ret_conv, true);
19143 }
19144
19145 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_err"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint64_t e) {
19146         LDKDecodeError e_conv;
19147         e_conv.inner = untag_ptr(e);
19148         e_conv.is_owned = ptr_is_owned(e);
19149         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19150         e_conv = DecodeError_clone(&e_conv);
19151         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
19152         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
19153         return tag_ptr(ret_conv, true);
19154 }
19155
19156 jboolean  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_is_ok"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint64_t o) {
19157         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
19158         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
19159         return ret_conv;
19160 }
19161
19162 void  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_free"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint64_t _res) {
19163         if (!ptr_is_owned(_res)) return;
19164         void* _res_ptr = untag_ptr(_res);
19165         CHECK_ACCESS(_res_ptr);
19166         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
19167         FREE(untag_ptr(_res));
19168         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
19169 }
19170
19171 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
19172         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
19173         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
19174         return tag_ptr(ret_conv, true);
19175 }
19176 int64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
19177         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
19178         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
19179         return ret_conv;
19180 }
19181
19182 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint64_t orig) {
19183         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
19184         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
19185         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
19186         return tag_ptr(ret_conv, true);
19187 }
19188
19189 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_ok(uint64_t o) {
19190         LDKChannelReady o_conv;
19191         o_conv.inner = untag_ptr(o);
19192         o_conv.is_owned = ptr_is_owned(o);
19193         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19194         o_conv = ChannelReady_clone(&o_conv);
19195         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
19196         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
19197         return tag_ptr(ret_conv, true);
19198 }
19199
19200 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_err"))) TS_CResult_ChannelReadyDecodeErrorZ_err(uint64_t e) {
19201         LDKDecodeError e_conv;
19202         e_conv.inner = untag_ptr(e);
19203         e_conv.is_owned = ptr_is_owned(e);
19204         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19205         e_conv = DecodeError_clone(&e_conv);
19206         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
19207         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
19208         return tag_ptr(ret_conv, true);
19209 }
19210
19211 jboolean  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_is_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_is_ok(uint64_t o) {
19212         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
19213         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
19214         return ret_conv;
19215 }
19216
19217 void  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_free"))) TS_CResult_ChannelReadyDecodeErrorZ_free(uint64_t _res) {
19218         if (!ptr_is_owned(_res)) return;
19219         void* _res_ptr = untag_ptr(_res);
19220         CHECK_ACCESS(_res_ptr);
19221         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
19222         FREE(untag_ptr(_res));
19223         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
19224 }
19225
19226 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
19227         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
19228         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
19229         return tag_ptr(ret_conv, true);
19230 }
19231 int64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr(uint64_t arg) {
19232         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
19233         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
19234         return ret_conv;
19235 }
19236
19237 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone"))) TS_CResult_ChannelReadyDecodeErrorZ_clone(uint64_t orig) {
19238         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
19239         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
19240         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
19241         return tag_ptr(ret_conv, true);
19242 }
19243
19244 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_ok"))) TS_CResult_InitDecodeErrorZ_ok(uint64_t o) {
19245         LDKInit o_conv;
19246         o_conv.inner = untag_ptr(o);
19247         o_conv.is_owned = ptr_is_owned(o);
19248         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19249         o_conv = Init_clone(&o_conv);
19250         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
19251         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
19252         return tag_ptr(ret_conv, true);
19253 }
19254
19255 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_err"))) TS_CResult_InitDecodeErrorZ_err(uint64_t e) {
19256         LDKDecodeError e_conv;
19257         e_conv.inner = untag_ptr(e);
19258         e_conv.is_owned = ptr_is_owned(e);
19259         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19260         e_conv = DecodeError_clone(&e_conv);
19261         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
19262         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
19263         return tag_ptr(ret_conv, true);
19264 }
19265
19266 jboolean  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_is_ok"))) TS_CResult_InitDecodeErrorZ_is_ok(uint64_t o) {
19267         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
19268         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
19269         return ret_conv;
19270 }
19271
19272 void  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_free"))) TS_CResult_InitDecodeErrorZ_free(uint64_t _res) {
19273         if (!ptr_is_owned(_res)) return;
19274         void* _res_ptr = untag_ptr(_res);
19275         CHECK_ACCESS(_res_ptr);
19276         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
19277         FREE(untag_ptr(_res));
19278         CResult_InitDecodeErrorZ_free(_res_conv);
19279 }
19280
19281 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
19282         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
19283         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
19284         return tag_ptr(ret_conv, true);
19285 }
19286 int64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone_ptr"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint64_t arg) {
19287         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
19288         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
19289         return ret_conv;
19290 }
19291
19292 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone"))) TS_CResult_InitDecodeErrorZ_clone(uint64_t orig) {
19293         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
19294         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
19295         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
19296         return tag_ptr(ret_conv, true);
19297 }
19298
19299 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_ok"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint64_t o) {
19300         LDKOpenChannel o_conv;
19301         o_conv.inner = untag_ptr(o);
19302         o_conv.is_owned = ptr_is_owned(o);
19303         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19304         o_conv = OpenChannel_clone(&o_conv);
19305         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
19306         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
19307         return tag_ptr(ret_conv, true);
19308 }
19309
19310 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_err"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint64_t e) {
19311         LDKDecodeError e_conv;
19312         e_conv.inner = untag_ptr(e);
19313         e_conv.is_owned = ptr_is_owned(e);
19314         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19315         e_conv = DecodeError_clone(&e_conv);
19316         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
19317         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
19318         return tag_ptr(ret_conv, true);
19319 }
19320
19321 jboolean  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_is_ok"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint64_t o) {
19322         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
19323         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
19324         return ret_conv;
19325 }
19326
19327 void  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_free"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint64_t _res) {
19328         if (!ptr_is_owned(_res)) return;
19329         void* _res_ptr = untag_ptr(_res);
19330         CHECK_ACCESS(_res_ptr);
19331         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
19332         FREE(untag_ptr(_res));
19333         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
19334 }
19335
19336 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
19337         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
19338         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
19339         return tag_ptr(ret_conv, true);
19340 }
19341 int64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
19342         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
19343         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
19344         return ret_conv;
19345 }
19346
19347 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint64_t orig) {
19348         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
19349         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
19350         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
19351         return tag_ptr(ret_conv, true);
19352 }
19353
19354 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint64_t o) {
19355         LDKRevokeAndACK o_conv;
19356         o_conv.inner = untag_ptr(o);
19357         o_conv.is_owned = ptr_is_owned(o);
19358         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19359         o_conv = RevokeAndACK_clone(&o_conv);
19360         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
19361         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
19362         return tag_ptr(ret_conv, true);
19363 }
19364
19365 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint64_t e) {
19366         LDKDecodeError e_conv;
19367         e_conv.inner = untag_ptr(e);
19368         e_conv.is_owned = ptr_is_owned(e);
19369         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19370         e_conv = DecodeError_clone(&e_conv);
19371         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
19372         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
19373         return tag_ptr(ret_conv, true);
19374 }
19375
19376 jboolean  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_is_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint64_t o) {
19377         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
19378         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
19379         return ret_conv;
19380 }
19381
19382 void  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_free"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint64_t _res) {
19383         if (!ptr_is_owned(_res)) return;
19384         void* _res_ptr = untag_ptr(_res);
19385         CHECK_ACCESS(_res_ptr);
19386         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
19387         FREE(untag_ptr(_res));
19388         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
19389 }
19390
19391 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
19392         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
19393         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
19394         return tag_ptr(ret_conv, true);
19395 }
19396 int64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint64_t arg) {
19397         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
19398         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
19399         return ret_conv;
19400 }
19401
19402 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint64_t orig) {
19403         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
19404         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
19405         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
19406         return tag_ptr(ret_conv, true);
19407 }
19408
19409 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_ok"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint64_t o) {
19410         LDKShutdown o_conv;
19411         o_conv.inner = untag_ptr(o);
19412         o_conv.is_owned = ptr_is_owned(o);
19413         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19414         o_conv = Shutdown_clone(&o_conv);
19415         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
19416         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
19417         return tag_ptr(ret_conv, true);
19418 }
19419
19420 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_err"))) TS_CResult_ShutdownDecodeErrorZ_err(uint64_t e) {
19421         LDKDecodeError e_conv;
19422         e_conv.inner = untag_ptr(e);
19423         e_conv.is_owned = ptr_is_owned(e);
19424         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19425         e_conv = DecodeError_clone(&e_conv);
19426         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
19427         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
19428         return tag_ptr(ret_conv, true);
19429 }
19430
19431 jboolean  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_is_ok"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint64_t o) {
19432         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
19433         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
19434         return ret_conv;
19435 }
19436
19437 void  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_free"))) TS_CResult_ShutdownDecodeErrorZ_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_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
19442         FREE(untag_ptr(_res));
19443         CResult_ShutdownDecodeErrorZ_free(_res_conv);
19444 }
19445
19446 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
19447         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
19448         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
19449         return tag_ptr(ret_conv, true);
19450 }
19451 int64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint64_t arg) {
19452         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
19453         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
19454         return ret_conv;
19455 }
19456
19457 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint64_t orig) {
19458         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
19459         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
19460         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
19461         return tag_ptr(ret_conv, true);
19462 }
19463
19464 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint64_t o) {
19465         LDKUpdateFailHTLC o_conv;
19466         o_conv.inner = untag_ptr(o);
19467         o_conv.is_owned = ptr_is_owned(o);
19468         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19469         o_conv = UpdateFailHTLC_clone(&o_conv);
19470         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
19471         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
19472         return tag_ptr(ret_conv, true);
19473 }
19474
19475 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint64_t e) {
19476         LDKDecodeError e_conv;
19477         e_conv.inner = untag_ptr(e);
19478         e_conv.is_owned = ptr_is_owned(e);
19479         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19480         e_conv = DecodeError_clone(&e_conv);
19481         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
19482         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
19483         return tag_ptr(ret_conv, true);
19484 }
19485
19486 jboolean  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint64_t o) {
19487         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
19488         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
19489         return ret_conv;
19490 }
19491
19492 void  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint64_t _res) {
19493         if (!ptr_is_owned(_res)) return;
19494         void* _res_ptr = untag_ptr(_res);
19495         CHECK_ACCESS(_res_ptr);
19496         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
19497         FREE(untag_ptr(_res));
19498         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
19499 }
19500
19501 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
19502         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
19503         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
19504         return tag_ptr(ret_conv, true);
19505 }
19506 int64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
19507         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
19508         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
19509         return ret_conv;
19510 }
19511
19512 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint64_t orig) {
19513         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
19514         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
19515         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
19516         return tag_ptr(ret_conv, true);
19517 }
19518
19519 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint64_t o) {
19520         LDKUpdateFailMalformedHTLC o_conv;
19521         o_conv.inner = untag_ptr(o);
19522         o_conv.is_owned = ptr_is_owned(o);
19523         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19524         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
19525         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
19526         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
19527         return tag_ptr(ret_conv, true);
19528 }
19529
19530 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint64_t e) {
19531         LDKDecodeError e_conv;
19532         e_conv.inner = untag_ptr(e);
19533         e_conv.is_owned = ptr_is_owned(e);
19534         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19535         e_conv = DecodeError_clone(&e_conv);
19536         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
19537         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
19538         return tag_ptr(ret_conv, true);
19539 }
19540
19541 jboolean  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint64_t o) {
19542         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
19543         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
19544         return ret_conv;
19545 }
19546
19547 void  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint64_t _res) {
19548         if (!ptr_is_owned(_res)) return;
19549         void* _res_ptr = untag_ptr(_res);
19550         CHECK_ACCESS(_res_ptr);
19551         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
19552         FREE(untag_ptr(_res));
19553         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
19554 }
19555
19556 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
19557         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
19558         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
19559         return tag_ptr(ret_conv, true);
19560 }
19561 int64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
19562         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
19563         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
19564         return ret_conv;
19565 }
19566
19567 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint64_t orig) {
19568         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
19569         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
19570         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
19571         return tag_ptr(ret_conv, true);
19572 }
19573
19574 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint64_t o) {
19575         LDKUpdateFee o_conv;
19576         o_conv.inner = untag_ptr(o);
19577         o_conv.is_owned = ptr_is_owned(o);
19578         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19579         o_conv = UpdateFee_clone(&o_conv);
19580         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
19581         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
19582         return tag_ptr(ret_conv, true);
19583 }
19584
19585 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_err"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint64_t e) {
19586         LDKDecodeError e_conv;
19587         e_conv.inner = untag_ptr(e);
19588         e_conv.is_owned = ptr_is_owned(e);
19589         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19590         e_conv = DecodeError_clone(&e_conv);
19591         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
19592         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
19593         return tag_ptr(ret_conv, true);
19594 }
19595
19596 jboolean  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_is_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint64_t o) {
19597         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
19598         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
19599         return ret_conv;
19600 }
19601
19602 void  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_free"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint64_t _res) {
19603         if (!ptr_is_owned(_res)) return;
19604         void* _res_ptr = untag_ptr(_res);
19605         CHECK_ACCESS(_res_ptr);
19606         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
19607         FREE(untag_ptr(_res));
19608         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
19609 }
19610
19611 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
19612         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
19613         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
19614         return tag_ptr(ret_conv, true);
19615 }
19616 int64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint64_t arg) {
19617         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
19618         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
19619         return ret_conv;
19620 }
19621
19622 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint64_t orig) {
19623         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
19624         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
19625         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
19626         return tag_ptr(ret_conv, true);
19627 }
19628
19629 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint64_t o) {
19630         LDKUpdateFulfillHTLC o_conv;
19631         o_conv.inner = untag_ptr(o);
19632         o_conv.is_owned = ptr_is_owned(o);
19633         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19634         o_conv = UpdateFulfillHTLC_clone(&o_conv);
19635         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
19636         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
19637         return tag_ptr(ret_conv, true);
19638 }
19639
19640 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint64_t e) {
19641         LDKDecodeError e_conv;
19642         e_conv.inner = untag_ptr(e);
19643         e_conv.is_owned = ptr_is_owned(e);
19644         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19645         e_conv = DecodeError_clone(&e_conv);
19646         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
19647         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
19648         return tag_ptr(ret_conv, true);
19649 }
19650
19651 jboolean  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint64_t o) {
19652         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
19653         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
19654         return ret_conv;
19655 }
19656
19657 void  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint64_t _res) {
19658         if (!ptr_is_owned(_res)) return;
19659         void* _res_ptr = untag_ptr(_res);
19660         CHECK_ACCESS(_res_ptr);
19661         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
19662         FREE(untag_ptr(_res));
19663         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
19664 }
19665
19666 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
19667         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
19668         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
19669         return tag_ptr(ret_conv, true);
19670 }
19671 int64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
19672         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
19673         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
19674         return ret_conv;
19675 }
19676
19677 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint64_t orig) {
19678         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
19679         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
19680         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
19681         return tag_ptr(ret_conv, true);
19682 }
19683
19684 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint64_t o) {
19685         LDKUpdateAddHTLC o_conv;
19686         o_conv.inner = untag_ptr(o);
19687         o_conv.is_owned = ptr_is_owned(o);
19688         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19689         o_conv = UpdateAddHTLC_clone(&o_conv);
19690         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
19691         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
19692         return tag_ptr(ret_conv, true);
19693 }
19694
19695 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint64_t e) {
19696         LDKDecodeError e_conv;
19697         e_conv.inner = untag_ptr(e);
19698         e_conv.is_owned = ptr_is_owned(e);
19699         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19700         e_conv = DecodeError_clone(&e_conv);
19701         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
19702         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
19703         return tag_ptr(ret_conv, true);
19704 }
19705
19706 jboolean  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint64_t o) {
19707         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
19708         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
19709         return ret_conv;
19710 }
19711
19712 void  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_free"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint64_t _res) {
19713         if (!ptr_is_owned(_res)) return;
19714         void* _res_ptr = untag_ptr(_res);
19715         CHECK_ACCESS(_res_ptr);
19716         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
19717         FREE(untag_ptr(_res));
19718         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
19719 }
19720
19721 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
19722         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
19723         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
19724         return tag_ptr(ret_conv, true);
19725 }
19726 int64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
19727         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
19728         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
19729         return ret_conv;
19730 }
19731
19732 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint64_t orig) {
19733         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
19734         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
19735         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
19736         return tag_ptr(ret_conv, true);
19737 }
19738
19739 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_ok"))) TS_CResult_OnionMessageDecodeErrorZ_ok(uint64_t o) {
19740         LDKOnionMessage o_conv;
19741         o_conv.inner = untag_ptr(o);
19742         o_conv.is_owned = ptr_is_owned(o);
19743         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19744         o_conv = OnionMessage_clone(&o_conv);
19745         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
19746         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
19747         return tag_ptr(ret_conv, true);
19748 }
19749
19750 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_err"))) TS_CResult_OnionMessageDecodeErrorZ_err(uint64_t e) {
19751         LDKDecodeError e_conv;
19752         e_conv.inner = untag_ptr(e);
19753         e_conv.is_owned = ptr_is_owned(e);
19754         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19755         e_conv = DecodeError_clone(&e_conv);
19756         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
19757         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
19758         return tag_ptr(ret_conv, true);
19759 }
19760
19761 jboolean  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_is_ok"))) TS_CResult_OnionMessageDecodeErrorZ_is_ok(uint64_t o) {
19762         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
19763         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
19764         return ret_conv;
19765 }
19766
19767 void  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_free"))) TS_CResult_OnionMessageDecodeErrorZ_free(uint64_t _res) {
19768         if (!ptr_is_owned(_res)) return;
19769         void* _res_ptr = untag_ptr(_res);
19770         CHECK_ACCESS(_res_ptr);
19771         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
19772         FREE(untag_ptr(_res));
19773         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
19774 }
19775
19776 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
19777         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
19778         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
19779         return tag_ptr(ret_conv, true);
19780 }
19781 int64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OnionMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
19782         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
19783         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
19784         return ret_conv;
19785 }
19786
19787 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone"))) TS_CResult_OnionMessageDecodeErrorZ_clone(uint64_t orig) {
19788         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
19789         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
19790         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
19791         return tag_ptr(ret_conv, true);
19792 }
19793
19794 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_ok"))) TS_CResult_PingDecodeErrorZ_ok(uint64_t o) {
19795         LDKPing o_conv;
19796         o_conv.inner = untag_ptr(o);
19797         o_conv.is_owned = ptr_is_owned(o);
19798         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19799         o_conv = Ping_clone(&o_conv);
19800         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19801         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
19802         return tag_ptr(ret_conv, true);
19803 }
19804
19805 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_err"))) TS_CResult_PingDecodeErrorZ_err(uint64_t e) {
19806         LDKDecodeError e_conv;
19807         e_conv.inner = untag_ptr(e);
19808         e_conv.is_owned = ptr_is_owned(e);
19809         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19810         e_conv = DecodeError_clone(&e_conv);
19811         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19812         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
19813         return tag_ptr(ret_conv, true);
19814 }
19815
19816 jboolean  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_is_ok"))) TS_CResult_PingDecodeErrorZ_is_ok(uint64_t o) {
19817         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
19818         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
19819         return ret_conv;
19820 }
19821
19822 void  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_free"))) TS_CResult_PingDecodeErrorZ_free(uint64_t _res) {
19823         if (!ptr_is_owned(_res)) return;
19824         void* _res_ptr = untag_ptr(_res);
19825         CHECK_ACCESS(_res_ptr);
19826         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
19827         FREE(untag_ptr(_res));
19828         CResult_PingDecodeErrorZ_free(_res_conv);
19829 }
19830
19831 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
19832         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19833         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
19834         return tag_ptr(ret_conv, true);
19835 }
19836 int64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone_ptr"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint64_t arg) {
19837         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
19838         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
19839         return ret_conv;
19840 }
19841
19842 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone"))) TS_CResult_PingDecodeErrorZ_clone(uint64_t orig) {
19843         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
19844         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
19845         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
19846         return tag_ptr(ret_conv, true);
19847 }
19848
19849 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_ok"))) TS_CResult_PongDecodeErrorZ_ok(uint64_t o) {
19850         LDKPong o_conv;
19851         o_conv.inner = untag_ptr(o);
19852         o_conv.is_owned = ptr_is_owned(o);
19853         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19854         o_conv = Pong_clone(&o_conv);
19855         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19856         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
19857         return tag_ptr(ret_conv, true);
19858 }
19859
19860 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_err"))) TS_CResult_PongDecodeErrorZ_err(uint64_t e) {
19861         LDKDecodeError e_conv;
19862         e_conv.inner = untag_ptr(e);
19863         e_conv.is_owned = ptr_is_owned(e);
19864         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19865         e_conv = DecodeError_clone(&e_conv);
19866         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19867         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
19868         return tag_ptr(ret_conv, true);
19869 }
19870
19871 jboolean  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_is_ok"))) TS_CResult_PongDecodeErrorZ_is_ok(uint64_t o) {
19872         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
19873         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
19874         return ret_conv;
19875 }
19876
19877 void  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_free"))) TS_CResult_PongDecodeErrorZ_free(uint64_t _res) {
19878         if (!ptr_is_owned(_res)) return;
19879         void* _res_ptr = untag_ptr(_res);
19880         CHECK_ACCESS(_res_ptr);
19881         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
19882         FREE(untag_ptr(_res));
19883         CResult_PongDecodeErrorZ_free(_res_conv);
19884 }
19885
19886 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
19887         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19888         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
19889         return tag_ptr(ret_conv, true);
19890 }
19891 int64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone_ptr"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint64_t arg) {
19892         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
19893         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
19894         return ret_conv;
19895 }
19896
19897 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone"))) TS_CResult_PongDecodeErrorZ_clone(uint64_t orig) {
19898         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
19899         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
19900         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
19901         return tag_ptr(ret_conv, true);
19902 }
19903
19904 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
19905         LDKUnsignedChannelAnnouncement o_conv;
19906         o_conv.inner = untag_ptr(o);
19907         o_conv.is_owned = ptr_is_owned(o);
19908         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19909         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
19910         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
19911         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
19912         return tag_ptr(ret_conv, true);
19913 }
19914
19915 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
19916         LDKDecodeError e_conv;
19917         e_conv.inner = untag_ptr(e);
19918         e_conv.is_owned = ptr_is_owned(e);
19919         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19920         e_conv = DecodeError_clone(&e_conv);
19921         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
19922         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
19923         return tag_ptr(ret_conv, true);
19924 }
19925
19926 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
19927         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
19928         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
19929         return ret_conv;
19930 }
19931
19932 void  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
19933         if (!ptr_is_owned(_res)) return;
19934         void* _res_ptr = untag_ptr(_res);
19935         CHECK_ACCESS(_res_ptr);
19936         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
19937         FREE(untag_ptr(_res));
19938         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
19939 }
19940
19941 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
19942         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
19943         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
19944         return tag_ptr(ret_conv, true);
19945 }
19946 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
19947         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
19948         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
19949         return ret_conv;
19950 }
19951
19952 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
19953         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
19954         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
19955         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
19956         return tag_ptr(ret_conv, true);
19957 }
19958
19959 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
19960         LDKChannelAnnouncement o_conv;
19961         o_conv.inner = untag_ptr(o);
19962         o_conv.is_owned = ptr_is_owned(o);
19963         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19964         o_conv = ChannelAnnouncement_clone(&o_conv);
19965         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
19966         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
19967         return tag_ptr(ret_conv, true);
19968 }
19969
19970 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
19971         LDKDecodeError e_conv;
19972         e_conv.inner = untag_ptr(e);
19973         e_conv.is_owned = ptr_is_owned(e);
19974         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19975         e_conv = DecodeError_clone(&e_conv);
19976         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
19977         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
19978         return tag_ptr(ret_conv, true);
19979 }
19980
19981 jboolean  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
19982         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
19983         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
19984         return ret_conv;
19985 }
19986
19987 void  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
19988         if (!ptr_is_owned(_res)) return;
19989         void* _res_ptr = untag_ptr(_res);
19990         CHECK_ACCESS(_res_ptr);
19991         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
19992         FREE(untag_ptr(_res));
19993         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
19994 }
19995
19996 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
19997         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
19998         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
19999         return tag_ptr(ret_conv, true);
20000 }
20001 int64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
20002         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
20003         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
20004         return ret_conv;
20005 }
20006
20007 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
20008         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
20009         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
20010         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
20011         return tag_ptr(ret_conv, true);
20012 }
20013
20014 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint64_t o) {
20015         LDKUnsignedChannelUpdate o_conv;
20016         o_conv.inner = untag_ptr(o);
20017         o_conv.is_owned = ptr_is_owned(o);
20018         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20019         o_conv = UnsignedChannelUpdate_clone(&o_conv);
20020         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20021         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
20022         return tag_ptr(ret_conv, true);
20023 }
20024
20025 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint64_t e) {
20026         LDKDecodeError e_conv;
20027         e_conv.inner = untag_ptr(e);
20028         e_conv.is_owned = ptr_is_owned(e);
20029         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20030         e_conv = DecodeError_clone(&e_conv);
20031         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20032         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
20033         return tag_ptr(ret_conv, true);
20034 }
20035
20036 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
20037         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
20038         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
20039         return ret_conv;
20040 }
20041
20042 void  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint64_t _res) {
20043         if (!ptr_is_owned(_res)) return;
20044         void* _res_ptr = untag_ptr(_res);
20045         CHECK_ACCESS(_res_ptr);
20046         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
20047         FREE(untag_ptr(_res));
20048         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
20049 }
20050
20051 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
20052         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20053         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
20054         return tag_ptr(ret_conv, true);
20055 }
20056 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
20057         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
20058         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
20059         return ret_conv;
20060 }
20061
20062 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
20063         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
20064         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
20065         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
20066         return tag_ptr(ret_conv, true);
20067 }
20068
20069 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint64_t o) {
20070         LDKChannelUpdate o_conv;
20071         o_conv.inner = untag_ptr(o);
20072         o_conv.is_owned = ptr_is_owned(o);
20073         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20074         o_conv = ChannelUpdate_clone(&o_conv);
20075         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20076         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
20077         return tag_ptr(ret_conv, true);
20078 }
20079
20080 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint64_t e) {
20081         LDKDecodeError e_conv;
20082         e_conv.inner = untag_ptr(e);
20083         e_conv.is_owned = ptr_is_owned(e);
20084         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20085         e_conv = DecodeError_clone(&e_conv);
20086         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20087         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
20088         return tag_ptr(ret_conv, true);
20089 }
20090
20091 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
20092         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
20093         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
20094         return ret_conv;
20095 }
20096
20097 void  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_free"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint64_t _res) {
20098         if (!ptr_is_owned(_res)) return;
20099         void* _res_ptr = untag_ptr(_res);
20100         CHECK_ACCESS(_res_ptr);
20101         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
20102         FREE(untag_ptr(_res));
20103         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
20104 }
20105
20106 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
20107         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20108         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
20109         return tag_ptr(ret_conv, true);
20110 }
20111 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
20112         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
20113         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
20114         return ret_conv;
20115 }
20116
20117 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
20118         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
20119         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
20120         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
20121         return tag_ptr(ret_conv, true);
20122 }
20123
20124 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint64_t o) {
20125         LDKErrorMessage o_conv;
20126         o_conv.inner = untag_ptr(o);
20127         o_conv.is_owned = ptr_is_owned(o);
20128         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20129         o_conv = ErrorMessage_clone(&o_conv);
20130         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20131         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
20132         return tag_ptr(ret_conv, true);
20133 }
20134
20135 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_err"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint64_t e) {
20136         LDKDecodeError e_conv;
20137         e_conv.inner = untag_ptr(e);
20138         e_conv.is_owned = ptr_is_owned(e);
20139         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20140         e_conv = DecodeError_clone(&e_conv);
20141         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20142         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
20143         return tag_ptr(ret_conv, true);
20144 }
20145
20146 jboolean  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_is_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint64_t o) {
20147         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
20148         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
20149         return ret_conv;
20150 }
20151
20152 void  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_free"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint64_t _res) {
20153         if (!ptr_is_owned(_res)) return;
20154         void* _res_ptr = untag_ptr(_res);
20155         CHECK_ACCESS(_res_ptr);
20156         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
20157         FREE(untag_ptr(_res));
20158         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
20159 }
20160
20161 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
20162         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20163         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
20164         return tag_ptr(ret_conv, true);
20165 }
20166 int64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
20167         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
20168         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
20169         return ret_conv;
20170 }
20171
20172 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint64_t orig) {
20173         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
20174         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
20175         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
20176         return tag_ptr(ret_conv, true);
20177 }
20178
20179 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_ok"))) TS_CResult_WarningMessageDecodeErrorZ_ok(uint64_t o) {
20180         LDKWarningMessage o_conv;
20181         o_conv.inner = untag_ptr(o);
20182         o_conv.is_owned = ptr_is_owned(o);
20183         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20184         o_conv = WarningMessage_clone(&o_conv);
20185         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
20186         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
20187         return tag_ptr(ret_conv, true);
20188 }
20189
20190 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_err"))) TS_CResult_WarningMessageDecodeErrorZ_err(uint64_t e) {
20191         LDKDecodeError e_conv;
20192         e_conv.inner = untag_ptr(e);
20193         e_conv.is_owned = ptr_is_owned(e);
20194         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20195         e_conv = DecodeError_clone(&e_conv);
20196         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
20197         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
20198         return tag_ptr(ret_conv, true);
20199 }
20200
20201 jboolean  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_is_ok"))) TS_CResult_WarningMessageDecodeErrorZ_is_ok(uint64_t o) {
20202         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
20203         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
20204         return ret_conv;
20205 }
20206
20207 void  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_free"))) TS_CResult_WarningMessageDecodeErrorZ_free(uint64_t _res) {
20208         if (!ptr_is_owned(_res)) return;
20209         void* _res_ptr = untag_ptr(_res);
20210         CHECK_ACCESS(_res_ptr);
20211         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
20212         FREE(untag_ptr(_res));
20213         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
20214 }
20215
20216 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
20217         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
20218         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
20219         return tag_ptr(ret_conv, true);
20220 }
20221 int64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone_ptr"))) TS_CResult_WarningMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
20222         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
20223         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
20224         return ret_conv;
20225 }
20226
20227 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone"))) TS_CResult_WarningMessageDecodeErrorZ_clone(uint64_t orig) {
20228         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
20229         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
20230         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
20231         return tag_ptr(ret_conv, true);
20232 }
20233
20234 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
20235         LDKUnsignedNodeAnnouncement o_conv;
20236         o_conv.inner = untag_ptr(o);
20237         o_conv.is_owned = ptr_is_owned(o);
20238         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20239         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
20240         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
20241         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
20242         return tag_ptr(ret_conv, true);
20243 }
20244
20245 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint64_t e) {
20246         LDKDecodeError e_conv;
20247         e_conv.inner = untag_ptr(e);
20248         e_conv.is_owned = ptr_is_owned(e);
20249         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20250         e_conv = DecodeError_clone(&e_conv);
20251         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
20252         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
20253         return tag_ptr(ret_conv, true);
20254 }
20255
20256 jboolean  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
20257         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
20258         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
20259         return ret_conv;
20260 }
20261
20262 void  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
20263         if (!ptr_is_owned(_res)) return;
20264         void* _res_ptr = untag_ptr(_res);
20265         CHECK_ACCESS(_res_ptr);
20266         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
20267         FREE(untag_ptr(_res));
20268         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
20269 }
20270
20271 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
20272         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
20273         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
20274         return tag_ptr(ret_conv, true);
20275 }
20276 int64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
20277         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
20278         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
20279         return ret_conv;
20280 }
20281
20282 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
20283         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
20284         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
20285         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
20286         return tag_ptr(ret_conv, true);
20287 }
20288
20289 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
20290         LDKNodeAnnouncement o_conv;
20291         o_conv.inner = untag_ptr(o);
20292         o_conv.is_owned = ptr_is_owned(o);
20293         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20294         o_conv = NodeAnnouncement_clone(&o_conv);
20295         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
20296         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
20297         return tag_ptr(ret_conv, true);
20298 }
20299
20300 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint64_t e) {
20301         LDKDecodeError e_conv;
20302         e_conv.inner = untag_ptr(e);
20303         e_conv.is_owned = ptr_is_owned(e);
20304         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20305         e_conv = DecodeError_clone(&e_conv);
20306         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
20307         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
20308         return tag_ptr(ret_conv, true);
20309 }
20310
20311 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
20312         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
20313         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
20314         return ret_conv;
20315 }
20316
20317 void  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
20318         if (!ptr_is_owned(_res)) return;
20319         void* _res_ptr = untag_ptr(_res);
20320         CHECK_ACCESS(_res_ptr);
20321         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
20322         FREE(untag_ptr(_res));
20323         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
20324 }
20325
20326 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
20327         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
20328         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
20329         return tag_ptr(ret_conv, true);
20330 }
20331 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
20332         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
20333         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
20334         return ret_conv;
20335 }
20336
20337 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
20338         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
20339         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
20340         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
20341         return tag_ptr(ret_conv, true);
20342 }
20343
20344 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint64_t o) {
20345         LDKQueryShortChannelIds o_conv;
20346         o_conv.inner = untag_ptr(o);
20347         o_conv.is_owned = ptr_is_owned(o);
20348         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20349         o_conv = QueryShortChannelIds_clone(&o_conv);
20350         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
20351         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
20352         return tag_ptr(ret_conv, true);
20353 }
20354
20355 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint64_t e) {
20356         LDKDecodeError e_conv;
20357         e_conv.inner = untag_ptr(e);
20358         e_conv.is_owned = ptr_is_owned(e);
20359         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20360         e_conv = DecodeError_clone(&e_conv);
20361         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
20362         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
20363         return tag_ptr(ret_conv, true);
20364 }
20365
20366 jboolean  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint64_t o) {
20367         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
20368         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
20369         return ret_conv;
20370 }
20371
20372 void  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_free"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint64_t _res) {
20373         if (!ptr_is_owned(_res)) return;
20374         void* _res_ptr = untag_ptr(_res);
20375         CHECK_ACCESS(_res_ptr);
20376         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
20377         FREE(untag_ptr(_res));
20378         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
20379 }
20380
20381 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
20382         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
20383         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
20384         return tag_ptr(ret_conv, true);
20385 }
20386 int64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint64_t arg) {
20387         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
20388         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
20389         return ret_conv;
20390 }
20391
20392 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint64_t orig) {
20393         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
20394         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
20395         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
20396         return tag_ptr(ret_conv, true);
20397 }
20398
20399 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint64_t o) {
20400         LDKReplyShortChannelIdsEnd o_conv;
20401         o_conv.inner = untag_ptr(o);
20402         o_conv.is_owned = ptr_is_owned(o);
20403         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20404         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
20405         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
20406         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
20407         return tag_ptr(ret_conv, true);
20408 }
20409
20410 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint64_t e) {
20411         LDKDecodeError e_conv;
20412         e_conv.inner = untag_ptr(e);
20413         e_conv.is_owned = ptr_is_owned(e);
20414         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20415         e_conv = DecodeError_clone(&e_conv);
20416         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
20417         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
20418         return tag_ptr(ret_conv, true);
20419 }
20420
20421 jboolean  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint64_t o) {
20422         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
20423         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
20424         return ret_conv;
20425 }
20426
20427 void  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint64_t _res) {
20428         if (!ptr_is_owned(_res)) return;
20429         void* _res_ptr = untag_ptr(_res);
20430         CHECK_ACCESS(_res_ptr);
20431         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
20432         FREE(untag_ptr(_res));
20433         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
20434 }
20435
20436 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
20437         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
20438         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
20439         return tag_ptr(ret_conv, true);
20440 }
20441 int64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint64_t arg) {
20442         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
20443         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
20444         return ret_conv;
20445 }
20446
20447 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint64_t orig) {
20448         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
20449         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
20450         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
20451         return tag_ptr(ret_conv, true);
20452 }
20453
20454 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint64_t o) {
20455         LDKQueryChannelRange o_conv;
20456         o_conv.inner = untag_ptr(o);
20457         o_conv.is_owned = ptr_is_owned(o);
20458         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20459         o_conv = QueryChannelRange_clone(&o_conv);
20460         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
20461         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
20462         return tag_ptr(ret_conv, true);
20463 }
20464
20465 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint64_t e) {
20466         LDKDecodeError e_conv;
20467         e_conv.inner = untag_ptr(e);
20468         e_conv.is_owned = ptr_is_owned(e);
20469         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20470         e_conv = DecodeError_clone(&e_conv);
20471         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
20472         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
20473         return tag_ptr(ret_conv, true);
20474 }
20475
20476 jboolean  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
20477         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
20478         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
20479         return ret_conv;
20480 }
20481
20482 void  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_free"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint64_t _res) {
20483         if (!ptr_is_owned(_res)) return;
20484         void* _res_ptr = untag_ptr(_res);
20485         CHECK_ACCESS(_res_ptr);
20486         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
20487         FREE(untag_ptr(_res));
20488         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
20489 }
20490
20491 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
20492         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
20493         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
20494         return tag_ptr(ret_conv, true);
20495 }
20496 int64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
20497         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
20498         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
20499         return ret_conv;
20500 }
20501
20502 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint64_t orig) {
20503         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
20504         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
20505         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
20506         return tag_ptr(ret_conv, true);
20507 }
20508
20509 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint64_t o) {
20510         LDKReplyChannelRange o_conv;
20511         o_conv.inner = untag_ptr(o);
20512         o_conv.is_owned = ptr_is_owned(o);
20513         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20514         o_conv = ReplyChannelRange_clone(&o_conv);
20515         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
20516         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
20517         return tag_ptr(ret_conv, true);
20518 }
20519
20520 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint64_t e) {
20521         LDKDecodeError e_conv;
20522         e_conv.inner = untag_ptr(e);
20523         e_conv.is_owned = ptr_is_owned(e);
20524         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20525         e_conv = DecodeError_clone(&e_conv);
20526         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
20527         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
20528         return tag_ptr(ret_conv, true);
20529 }
20530
20531 jboolean  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
20532         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
20533         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
20534         return ret_conv;
20535 }
20536
20537 void  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_free"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint64_t _res) {
20538         if (!ptr_is_owned(_res)) return;
20539         void* _res_ptr = untag_ptr(_res);
20540         CHECK_ACCESS(_res_ptr);
20541         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
20542         FREE(untag_ptr(_res));
20543         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
20544 }
20545
20546 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
20547         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
20548         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
20549         return tag_ptr(ret_conv, true);
20550 }
20551 int64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
20552         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
20553         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
20554         return ret_conv;
20555 }
20556
20557 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint64_t orig) {
20558         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
20559         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
20560         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
20561         return tag_ptr(ret_conv, true);
20562 }
20563
20564 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint64_t o) {
20565         LDKGossipTimestampFilter o_conv;
20566         o_conv.inner = untag_ptr(o);
20567         o_conv.is_owned = ptr_is_owned(o);
20568         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20569         o_conv = GossipTimestampFilter_clone(&o_conv);
20570         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
20571         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
20572         return tag_ptr(ret_conv, true);
20573 }
20574
20575 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint64_t e) {
20576         LDKDecodeError e_conv;
20577         e_conv.inner = untag_ptr(e);
20578         e_conv.is_owned = ptr_is_owned(e);
20579         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
20580         e_conv = DecodeError_clone(&e_conv);
20581         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
20582         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
20583         return tag_ptr(ret_conv, true);
20584 }
20585
20586 jboolean  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint64_t o) {
20587         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
20588         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
20589         return ret_conv;
20590 }
20591
20592 void  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_free"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint64_t _res) {
20593         if (!ptr_is_owned(_res)) return;
20594         void* _res_ptr = untag_ptr(_res);
20595         CHECK_ACCESS(_res_ptr);
20596         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
20597         FREE(untag_ptr(_res));
20598         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
20599 }
20600
20601 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
20602         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
20603         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
20604         return tag_ptr(ret_conv, true);
20605 }
20606 int64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint64_t arg) {
20607         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
20608         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
20609         return ret_conv;
20610 }
20611
20612 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint64_t orig) {
20613         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
20614         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
20615         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
20616         return tag_ptr(ret_conv, true);
20617 }
20618
20619 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint64_t o) {
20620         LDKInvoice o_conv;
20621         o_conv.inner = untag_ptr(o);
20622         o_conv.is_owned = ptr_is_owned(o);
20623         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20624         o_conv = Invoice_clone(&o_conv);
20625         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
20626         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
20627         return tag_ptr(ret_conv, true);
20628 }
20629
20630 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_err"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint64_t e) {
20631         void* e_ptr = untag_ptr(e);
20632         CHECK_ACCESS(e_ptr);
20633         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
20634         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
20635         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
20636         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
20637         return tag_ptr(ret_conv, true);
20638 }
20639
20640 jboolean  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_is_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_is_ok(uint64_t o) {
20641         LDKCResult_InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(o);
20642         jboolean ret_conv = CResult_InvoiceSignOrCreationErrorZ_is_ok(o_conv);
20643         return ret_conv;
20644 }
20645
20646 void  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_free"))) TS_CResult_InvoiceSignOrCreationErrorZ_free(uint64_t _res) {
20647         if (!ptr_is_owned(_res)) return;
20648         void* _res_ptr = untag_ptr(_res);
20649         CHECK_ACCESS(_res_ptr);
20650         LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(_res_ptr);
20651         FREE(untag_ptr(_res));
20652         CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
20653 }
20654
20655 static inline uint64_t CResult_InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
20656         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
20657         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(arg);
20658         return tag_ptr(ret_conv, true);
20659 }
20660 int64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone_ptr(uint64_t arg) {
20661         LDKCResult_InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
20662         int64_t ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
20663         return ret_conv;
20664 }
20665
20666 uint64_t  __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_clone"))) TS_CResult_InvoiceSignOrCreationErrorZ_clone(uint64_t orig) {
20667         LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
20668         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
20669         *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
20670         return tag_ptr(ret_conv, true);
20671 }
20672
20673 uint64_t  __attribute__((export_name("TS_COption_FilterZ_some"))) TS_COption_FilterZ_some(uint64_t o) {
20674         void* o_ptr = untag_ptr(o);
20675         CHECK_ACCESS(o_ptr);
20676         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
20677         if (o_conv.free == LDKFilter_JCalls_free) {
20678                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
20679                 LDKFilter_JCalls_cloned(&o_conv);
20680         }
20681         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
20682         *ret_copy = COption_FilterZ_some(o_conv);
20683         uint64_t ret_ref = tag_ptr(ret_copy, true);
20684         return ret_ref;
20685 }
20686
20687 uint64_t  __attribute__((export_name("TS_COption_FilterZ_none"))) TS_COption_FilterZ_none() {
20688         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
20689         *ret_copy = COption_FilterZ_none();
20690         uint64_t ret_ref = tag_ptr(ret_copy, true);
20691         return ret_ref;
20692 }
20693
20694 void  __attribute__((export_name("TS_COption_FilterZ_free"))) TS_COption_FilterZ_free(uint64_t _res) {
20695         if (!ptr_is_owned(_res)) return;
20696         void* _res_ptr = untag_ptr(_res);
20697         CHECK_ACCESS(_res_ptr);
20698         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
20699         FREE(untag_ptr(_res));
20700         COption_FilterZ_free(_res_conv);
20701 }
20702
20703 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_ok"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint64_t o) {
20704         LDKLockedChannelMonitor o_conv;
20705         o_conv.inner = untag_ptr(o);
20706         o_conv.is_owned = ptr_is_owned(o);
20707         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20708         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
20709         
20710         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
20711         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
20712         return tag_ptr(ret_conv, true);
20713 }
20714
20715 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_err"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
20716         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
20717         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
20718         return tag_ptr(ret_conv, true);
20719 }
20720
20721 jboolean  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_is_ok"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint64_t o) {
20722         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
20723         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
20724         return ret_conv;
20725 }
20726
20727 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_free"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint64_t _res) {
20728         if (!ptr_is_owned(_res)) return;
20729         void* _res_ptr = untag_ptr(_res);
20730         CHECK_ACCESS(_res_ptr);
20731         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
20732         FREE(untag_ptr(_res));
20733         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
20734 }
20735
20736 void  __attribute__((export_name("TS_CVec_OutPointZ_free"))) TS_CVec_OutPointZ_free(uint64_tArray _res) {
20737         LDKCVec_OutPointZ _res_constr;
20738         _res_constr.datalen = _res->arr_len;
20739         if (_res_constr.datalen > 0)
20740                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
20741         else
20742                 _res_constr.data = NULL;
20743         uint64_t* _res_vals = _res->elems;
20744         for (size_t k = 0; k < _res_constr.datalen; k++) {
20745                 uint64_t _res_conv_10 = _res_vals[k];
20746                 LDKOutPoint _res_conv_10_conv;
20747                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
20748                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
20749                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
20750                 _res_constr.data[k] = _res_conv_10_conv;
20751         }
20752         FREE(_res);
20753         CVec_OutPointZ_free(_res_constr);
20754 }
20755
20756 void  __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint64_t this_ptr) {
20757         if (!ptr_is_owned(this_ptr)) return;
20758         void* this_ptr_ptr = untag_ptr(this_ptr);
20759         CHECK_ACCESS(this_ptr_ptr);
20760         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
20761         FREE(untag_ptr(this_ptr));
20762         PaymentPurpose_free(this_ptr_conv);
20763 }
20764
20765 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
20766         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
20767         *ret_copy = PaymentPurpose_clone(arg);
20768         uint64_t ret_ref = tag_ptr(ret_copy, true);
20769         return ret_ref;
20770 }
20771 int64_t  __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint64_t arg) {
20772         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
20773         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
20774         return ret_conv;
20775 }
20776
20777 uint64_t  __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint64_t orig) {
20778         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
20779         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
20780         *ret_copy = PaymentPurpose_clone(orig_conv);
20781         uint64_t ret_ref = tag_ptr(ret_copy, true);
20782         return ret_ref;
20783 }
20784
20785 uint64_t  __attribute__((export_name("TS_PaymentPurpose_invoice_payment"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret) {
20786         LDKThirtyTwoBytes payment_preimage_ref;
20787         CHECK(payment_preimage->arr_len == 32);
20788         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
20789         LDKThirtyTwoBytes payment_secret_ref;
20790         CHECK(payment_secret->arr_len == 32);
20791         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
20792         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
20793         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
20794         uint64_t ret_ref = tag_ptr(ret_copy, true);
20795         return ret_ref;
20796 }
20797
20798 uint64_t  __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
20799         LDKThirtyTwoBytes a_ref;
20800         CHECK(a->arr_len == 32);
20801         memcpy(a_ref.data, a->elems, 32); FREE(a);
20802         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
20803         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
20804         uint64_t ret_ref = tag_ptr(ret_copy, true);
20805         return ret_ref;
20806 }
20807
20808 int8_tArray  __attribute__((export_name("TS_PaymentPurpose_write"))) TS_PaymentPurpose_write(uint64_t obj) {
20809         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
20810         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
20811         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
20812         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20813         CVec_u8Z_free(ret_var);
20814         return ret_arr;
20815 }
20816
20817 uint64_t  __attribute__((export_name("TS_PaymentPurpose_read"))) TS_PaymentPurpose_read(int8_tArray ser) {
20818         LDKu8slice ser_ref;
20819         ser_ref.datalen = ser->arr_len;
20820         ser_ref.data = ser->elems;
20821         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
20822         *ret_conv = PaymentPurpose_read(ser_ref);
20823         FREE(ser);
20824         return tag_ptr(ret_conv, true);
20825 }
20826
20827 void  __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint64_t this_ptr) {
20828         if (!ptr_is_owned(this_ptr)) return;
20829         void* this_ptr_ptr = untag_ptr(this_ptr);
20830         CHECK_ACCESS(this_ptr_ptr);
20831         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
20832         FREE(untag_ptr(this_ptr));
20833         ClosureReason_free(this_ptr_conv);
20834 }
20835
20836 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
20837         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20838         *ret_copy = ClosureReason_clone(arg);
20839         uint64_t ret_ref = tag_ptr(ret_copy, true);
20840         return ret_ref;
20841 }
20842 int64_t  __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint64_t arg) {
20843         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
20844         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
20845         return ret_conv;
20846 }
20847
20848 uint64_t  __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint64_t orig) {
20849         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
20850         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20851         *ret_copy = ClosureReason_clone(orig_conv);
20852         uint64_t ret_ref = tag_ptr(ret_copy, true);
20853         return ret_ref;
20854 }
20855
20856 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(jstring peer_msg) {
20857         LDKStr peer_msg_conv = str_ref_to_owned_c(peer_msg);
20858         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20859         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
20860         uint64_t ret_ref = tag_ptr(ret_copy, true);
20861         return ret_ref;
20862 }
20863
20864 uint64_t  __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
20865         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20866         *ret_copy = ClosureReason_holder_force_closed();
20867         uint64_t ret_ref = tag_ptr(ret_copy, true);
20868         return ret_ref;
20869 }
20870
20871 uint64_t  __attribute__((export_name("TS_ClosureReason_cooperative_closure"))) TS_ClosureReason_cooperative_closure() {
20872         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20873         *ret_copy = ClosureReason_cooperative_closure();
20874         uint64_t ret_ref = tag_ptr(ret_copy, true);
20875         return ret_ref;
20876 }
20877
20878 uint64_t  __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
20879         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20880         *ret_copy = ClosureReason_commitment_tx_confirmed();
20881         uint64_t ret_ref = tag_ptr(ret_copy, true);
20882         return ret_ref;
20883 }
20884
20885 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
20886         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20887         *ret_copy = ClosureReason_funding_timed_out();
20888         uint64_t ret_ref = tag_ptr(ret_copy, true);
20889         return ret_ref;
20890 }
20891
20892 uint64_t  __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
20893         LDKStr err_conv = str_ref_to_owned_c(err);
20894         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20895         *ret_copy = ClosureReason_processing_error(err_conv);
20896         uint64_t ret_ref = tag_ptr(ret_copy, true);
20897         return ret_ref;
20898 }
20899
20900 uint64_t  __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
20901         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20902         *ret_copy = ClosureReason_disconnected_peer();
20903         uint64_t ret_ref = tag_ptr(ret_copy, true);
20904         return ret_ref;
20905 }
20906
20907 uint64_t  __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
20908         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
20909         *ret_copy = ClosureReason_outdated_channel_manager();
20910         uint64_t ret_ref = tag_ptr(ret_copy, true);
20911         return ret_ref;
20912 }
20913
20914 int8_tArray  __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint64_t obj) {
20915         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
20916         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
20917         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
20918         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20919         CVec_u8Z_free(ret_var);
20920         return ret_arr;
20921 }
20922
20923 uint64_t  __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
20924         LDKu8slice ser_ref;
20925         ser_ref.datalen = ser->arr_len;
20926         ser_ref.data = ser->elems;
20927         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
20928         *ret_conv = ClosureReason_read(ser_ref);
20929         FREE(ser);
20930         return tag_ptr(ret_conv, true);
20931 }
20932
20933 void  __attribute__((export_name("TS_HTLCDestination_free"))) TS_HTLCDestination_free(uint64_t this_ptr) {
20934         if (!ptr_is_owned(this_ptr)) return;
20935         void* this_ptr_ptr = untag_ptr(this_ptr);
20936         CHECK_ACCESS(this_ptr_ptr);
20937         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
20938         FREE(untag_ptr(this_ptr));
20939         HTLCDestination_free(this_ptr_conv);
20940 }
20941
20942 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
20943         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
20944         *ret_copy = HTLCDestination_clone(arg);
20945         uint64_t ret_ref = tag_ptr(ret_copy, true);
20946         return ret_ref;
20947 }
20948 int64_t  __attribute__((export_name("TS_HTLCDestination_clone_ptr"))) TS_HTLCDestination_clone_ptr(uint64_t arg) {
20949         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
20950         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
20951         return ret_conv;
20952 }
20953
20954 uint64_t  __attribute__((export_name("TS_HTLCDestination_clone"))) TS_HTLCDestination_clone(uint64_t orig) {
20955         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
20956         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
20957         *ret_copy = HTLCDestination_clone(orig_conv);
20958         uint64_t ret_ref = tag_ptr(ret_copy, true);
20959         return ret_ref;
20960 }
20961
20962 uint64_t  __attribute__((export_name("TS_HTLCDestination_next_hop_channel"))) TS_HTLCDestination_next_hop_channel(int8_tArray node_id, int8_tArray channel_id) {
20963         LDKPublicKey node_id_ref;
20964         CHECK(node_id->arr_len == 33);
20965         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
20966         LDKThirtyTwoBytes channel_id_ref;
20967         CHECK(channel_id->arr_len == 32);
20968         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
20969         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
20970         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
20971         uint64_t ret_ref = tag_ptr(ret_copy, true);
20972         return ret_ref;
20973 }
20974
20975 uint64_t  __attribute__((export_name("TS_HTLCDestination_unknown_next_hop"))) TS_HTLCDestination_unknown_next_hop(int64_t requested_forward_scid) {
20976         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
20977         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
20978         uint64_t ret_ref = tag_ptr(ret_copy, true);
20979         return ret_ref;
20980 }
20981
20982 uint64_t  __attribute__((export_name("TS_HTLCDestination_failed_payment"))) TS_HTLCDestination_failed_payment(int8_tArray payment_hash) {
20983         LDKThirtyTwoBytes payment_hash_ref;
20984         CHECK(payment_hash->arr_len == 32);
20985         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
20986         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
20987         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
20988         uint64_t ret_ref = tag_ptr(ret_copy, true);
20989         return ret_ref;
20990 }
20991
20992 int8_tArray  __attribute__((export_name("TS_HTLCDestination_write"))) TS_HTLCDestination_write(uint64_t obj) {
20993         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
20994         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
20995         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
20996         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
20997         CVec_u8Z_free(ret_var);
20998         return ret_arr;
20999 }
21000
21001 uint64_t  __attribute__((export_name("TS_HTLCDestination_read"))) TS_HTLCDestination_read(int8_tArray ser) {
21002         LDKu8slice ser_ref;
21003         ser_ref.datalen = ser->arr_len;
21004         ser_ref.data = ser->elems;
21005         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
21006         *ret_conv = HTLCDestination_read(ser_ref);
21007         FREE(ser);
21008         return tag_ptr(ret_conv, true);
21009 }
21010
21011 void  __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint64_t this_ptr) {
21012         if (!ptr_is_owned(this_ptr)) return;
21013         void* this_ptr_ptr = untag_ptr(this_ptr);
21014         CHECK_ACCESS(this_ptr_ptr);
21015         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
21016         FREE(untag_ptr(this_ptr));
21017         Event_free(this_ptr_conv);
21018 }
21019
21020 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
21021         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21022         *ret_copy = Event_clone(arg);
21023         uint64_t ret_ref = tag_ptr(ret_copy, true);
21024         return ret_ref;
21025 }
21026 int64_t  __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint64_t arg) {
21027         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
21028         int64_t ret_conv = Event_clone_ptr(arg_conv);
21029         return ret_conv;
21030 }
21031
21032 uint64_t  __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint64_t orig) {
21033         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
21034         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21035         *ret_copy = Event_clone(orig_conv);
21036         uint64_t ret_ref = tag_ptr(ret_copy, true);
21037         return ret_ref;
21038 }
21039
21040 uint64_t  __attribute__((export_name("TS_Event_funding_generation_ready"))) TS_Event_funding_generation_ready(int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t channel_value_satoshis, int8_tArray output_script, int64_t user_channel_id) {
21041         LDKThirtyTwoBytes temporary_channel_id_ref;
21042         CHECK(temporary_channel_id->arr_len == 32);
21043         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
21044         LDKPublicKey counterparty_node_id_ref;
21045         CHECK(counterparty_node_id->arr_len == 33);
21046         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
21047         LDKCVec_u8Z output_script_ref;
21048         output_script_ref.datalen = output_script->arr_len;
21049         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
21050         memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
21051         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21052         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id);
21053         uint64_t ret_ref = tag_ptr(ret_copy, true);
21054         return ret_ref;
21055 }
21056
21057 uint64_t  __attribute__((export_name("TS_Event_payment_received"))) TS_Event_payment_received(int8_tArray payment_hash, int64_t amount_msat, uint64_t purpose) {
21058         LDKThirtyTwoBytes payment_hash_ref;
21059         CHECK(payment_hash->arr_len == 32);
21060         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21061         void* purpose_ptr = untag_ptr(purpose);
21062         CHECK_ACCESS(purpose_ptr);
21063         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
21064         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
21065         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21066         *ret_copy = Event_payment_received(payment_hash_ref, amount_msat, purpose_conv);
21067         uint64_t ret_ref = tag_ptr(ret_copy, true);
21068         return ret_ref;
21069 }
21070
21071 uint64_t  __attribute__((export_name("TS_Event_payment_claimed"))) TS_Event_payment_claimed(int8_tArray payment_hash, int64_t amount_msat, uint64_t purpose) {
21072         LDKThirtyTwoBytes payment_hash_ref;
21073         CHECK(payment_hash->arr_len == 32);
21074         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21075         void* purpose_ptr = untag_ptr(purpose);
21076         CHECK_ACCESS(purpose_ptr);
21077         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
21078         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
21079         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21080         *ret_copy = Event_payment_claimed(payment_hash_ref, amount_msat, purpose_conv);
21081         uint64_t ret_ref = tag_ptr(ret_copy, true);
21082         return ret_ref;
21083 }
21084
21085 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) {
21086         LDKThirtyTwoBytes payment_id_ref;
21087         CHECK(payment_id->arr_len == 32);
21088         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
21089         LDKThirtyTwoBytes payment_preimage_ref;
21090         CHECK(payment_preimage->arr_len == 32);
21091         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
21092         LDKThirtyTwoBytes payment_hash_ref;
21093         CHECK(payment_hash->arr_len == 32);
21094         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21095         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
21096         CHECK_ACCESS(fee_paid_msat_ptr);
21097         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
21098         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
21099         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21100         *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
21101         uint64_t ret_ref = tag_ptr(ret_copy, true);
21102         return ret_ref;
21103 }
21104
21105 uint64_t  __attribute__((export_name("TS_Event_payment_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash) {
21106         LDKThirtyTwoBytes payment_id_ref;
21107         CHECK(payment_id->arr_len == 32);
21108         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
21109         LDKThirtyTwoBytes payment_hash_ref;
21110         CHECK(payment_hash->arr_len == 32);
21111         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21112         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21113         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref);
21114         uint64_t ret_ref = tag_ptr(ret_copy, true);
21115         return ret_ref;
21116 }
21117
21118 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) {
21119         LDKThirtyTwoBytes payment_id_ref;
21120         CHECK(payment_id->arr_len == 32);
21121         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
21122         LDKThirtyTwoBytes payment_hash_ref;
21123         CHECK(payment_hash->arr_len == 32);
21124         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21125         LDKCVec_RouteHopZ path_constr;
21126         path_constr.datalen = path->arr_len;
21127         if (path_constr.datalen > 0)
21128                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
21129         else
21130                 path_constr.data = NULL;
21131         uint64_t* path_vals = path->elems;
21132         for (size_t k = 0; k < path_constr.datalen; k++) {
21133                 uint64_t path_conv_10 = path_vals[k];
21134                 LDKRouteHop path_conv_10_conv;
21135                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
21136                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
21137                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
21138                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
21139                 path_constr.data[k] = path_conv_10_conv;
21140         }
21141         FREE(path);
21142         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21143         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr);
21144         uint64_t ret_ref = tag_ptr(ret_copy, true);
21145         return ret_ref;
21146 }
21147
21148 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) {
21149         LDKThirtyTwoBytes payment_id_ref;
21150         CHECK(payment_id->arr_len == 32);
21151         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
21152         LDKThirtyTwoBytes payment_hash_ref;
21153         CHECK(payment_hash->arr_len == 32);
21154         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21155         void* network_update_ptr = untag_ptr(network_update);
21156         CHECK_ACCESS(network_update_ptr);
21157         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
21158         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
21159         LDKCVec_RouteHopZ path_constr;
21160         path_constr.datalen = path->arr_len;
21161         if (path_constr.datalen > 0)
21162                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
21163         else
21164                 path_constr.data = NULL;
21165         uint64_t* path_vals = path->elems;
21166         for (size_t k = 0; k < path_constr.datalen; k++) {
21167                 uint64_t path_conv_10 = path_vals[k];
21168                 LDKRouteHop path_conv_10_conv;
21169                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
21170                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
21171                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
21172                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
21173                 path_constr.data[k] = path_conv_10_conv;
21174         }
21175         FREE(path);
21176         void* short_channel_id_ptr = untag_ptr(short_channel_id);
21177         CHECK_ACCESS(short_channel_id_ptr);
21178         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
21179         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
21180         LDKRouteParameters retry_conv;
21181         retry_conv.inner = untag_ptr(retry);
21182         retry_conv.is_owned = ptr_is_owned(retry);
21183         CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv);
21184         retry_conv = RouteParameters_clone(&retry_conv);
21185         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21186         *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);
21187         uint64_t ret_ref = tag_ptr(ret_copy, true);
21188         return ret_ref;
21189 }
21190
21191 uint64_t  __attribute__((export_name("TS_Event_probe_successful"))) TS_Event_probe_successful(int8_tArray payment_id, int8_tArray payment_hash, uint64_tArray path) {
21192         LDKThirtyTwoBytes payment_id_ref;
21193         CHECK(payment_id->arr_len == 32);
21194         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
21195         LDKThirtyTwoBytes payment_hash_ref;
21196         CHECK(payment_hash->arr_len == 32);
21197         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21198         LDKCVec_RouteHopZ path_constr;
21199         path_constr.datalen = path->arr_len;
21200         if (path_constr.datalen > 0)
21201                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
21202         else
21203                 path_constr.data = NULL;
21204         uint64_t* path_vals = path->elems;
21205         for (size_t k = 0; k < path_constr.datalen; k++) {
21206                 uint64_t path_conv_10 = path_vals[k];
21207                 LDKRouteHop path_conv_10_conv;
21208                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
21209                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
21210                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
21211                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
21212                 path_constr.data[k] = path_conv_10_conv;
21213         }
21214         FREE(path);
21215         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21216         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_constr);
21217         uint64_t ret_ref = tag_ptr(ret_copy, true);
21218         return ret_ref;
21219 }
21220
21221 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) {
21222         LDKThirtyTwoBytes payment_id_ref;
21223         CHECK(payment_id->arr_len == 32);
21224         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
21225         LDKThirtyTwoBytes payment_hash_ref;
21226         CHECK(payment_hash->arr_len == 32);
21227         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
21228         LDKCVec_RouteHopZ path_constr;
21229         path_constr.datalen = path->arr_len;
21230         if (path_constr.datalen > 0)
21231                 path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
21232         else
21233                 path_constr.data = NULL;
21234         uint64_t* path_vals = path->elems;
21235         for (size_t k = 0; k < path_constr.datalen; k++) {
21236                 uint64_t path_conv_10 = path_vals[k];
21237                 LDKRouteHop path_conv_10_conv;
21238                 path_conv_10_conv.inner = untag_ptr(path_conv_10);
21239                 path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10);
21240                 CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv);
21241                 path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
21242                 path_constr.data[k] = path_conv_10_conv;
21243         }
21244         FREE(path);
21245         void* short_channel_id_ptr = untag_ptr(short_channel_id);
21246         CHECK_ACCESS(short_channel_id_ptr);
21247         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
21248         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
21249         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21250         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_constr, short_channel_id_conv);
21251         uint64_t ret_ref = tag_ptr(ret_copy, true);
21252         return ret_ref;
21253 }
21254
21255 uint64_t  __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
21256         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21257         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
21258         uint64_t ret_ref = tag_ptr(ret_copy, true);
21259         return ret_ref;
21260 }
21261
21262 uint64_t  __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint64_tArray outputs) {
21263         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
21264         outputs_constr.datalen = outputs->arr_len;
21265         if (outputs_constr.datalen > 0)
21266                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
21267         else
21268                 outputs_constr.data = NULL;
21269         uint64_t* outputs_vals = outputs->elems;
21270         for (size_t b = 0; b < outputs_constr.datalen; b++) {
21271                 uint64_t outputs_conv_27 = outputs_vals[b];
21272                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
21273                 CHECK_ACCESS(outputs_conv_27_ptr);
21274                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
21275                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
21276                 outputs_constr.data[b] = outputs_conv_27_conv;
21277         }
21278         FREE(outputs);
21279         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21280         *ret_copy = Event_spendable_outputs(outputs_constr);
21281         uint64_t ret_ref = tag_ptr(ret_copy, true);
21282         return ret_ref;
21283 }
21284
21285 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) {
21286         LDKThirtyTwoBytes prev_channel_id_ref;
21287         CHECK(prev_channel_id->arr_len == 32);
21288         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
21289         LDKThirtyTwoBytes next_channel_id_ref;
21290         CHECK(next_channel_id->arr_len == 32);
21291         memcpy(next_channel_id_ref.data, next_channel_id->elems, 32); FREE(next_channel_id);
21292         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
21293         CHECK_ACCESS(fee_earned_msat_ptr);
21294         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
21295         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
21296         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21297         *ret_copy = Event_payment_forwarded(prev_channel_id_ref, next_channel_id_ref, fee_earned_msat_conv, claim_from_onchain_tx);
21298         uint64_t ret_ref = tag_ptr(ret_copy, true);
21299         return ret_ref;
21300 }
21301
21302 uint64_t  __attribute__((export_name("TS_Event_channel_closed"))) TS_Event_channel_closed(int8_tArray channel_id, int64_t user_channel_id, uint64_t reason) {
21303         LDKThirtyTwoBytes channel_id_ref;
21304         CHECK(channel_id->arr_len == 32);
21305         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
21306         void* reason_ptr = untag_ptr(reason);
21307         CHECK_ACCESS(reason_ptr);
21308         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
21309         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
21310         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21311         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv);
21312         uint64_t ret_ref = tag_ptr(ret_copy, true);
21313         return ret_ref;
21314 }
21315
21316 uint64_t  __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
21317         LDKThirtyTwoBytes channel_id_ref;
21318         CHECK(channel_id->arr_len == 32);
21319         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
21320         LDKTransaction transaction_ref;
21321         transaction_ref.datalen = transaction->arr_len;
21322         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
21323         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
21324         transaction_ref.data_is_owned = true;
21325         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21326         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
21327         uint64_t ret_ref = tag_ptr(ret_copy, true);
21328         return ret_ref;
21329 }
21330
21331 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) {
21332         LDKThirtyTwoBytes temporary_channel_id_ref;
21333         CHECK(temporary_channel_id->arr_len == 32);
21334         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
21335         LDKPublicKey counterparty_node_id_ref;
21336         CHECK(counterparty_node_id->arr_len == 33);
21337         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
21338         LDKChannelTypeFeatures channel_type_conv;
21339         channel_type_conv.inner = untag_ptr(channel_type);
21340         channel_type_conv.is_owned = ptr_is_owned(channel_type);
21341         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
21342         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
21343         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21344         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
21345         uint64_t ret_ref = tag_ptr(ret_copy, true);
21346         return ret_ref;
21347 }
21348
21349 uint64_t  __attribute__((export_name("TS_Event_htlchandling_failed"))) TS_Event_htlchandling_failed(int8_tArray prev_channel_id, uint64_t failed_next_destination) {
21350         LDKThirtyTwoBytes prev_channel_id_ref;
21351         CHECK(prev_channel_id->arr_len == 32);
21352         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
21353         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
21354         CHECK_ACCESS(failed_next_destination_ptr);
21355         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
21356         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
21357         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
21358         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
21359         uint64_t ret_ref = tag_ptr(ret_copy, true);
21360         return ret_ref;
21361 }
21362
21363 int8_tArray  __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint64_t obj) {
21364         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
21365         LDKCVec_u8Z ret_var = Event_write(obj_conv);
21366         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21367         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21368         CVec_u8Z_free(ret_var);
21369         return ret_arr;
21370 }
21371
21372 uint64_t  __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
21373         LDKu8slice ser_ref;
21374         ser_ref.datalen = ser->arr_len;
21375         ser_ref.data = ser->elems;
21376         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
21377         *ret_conv = Event_read(ser_ref);
21378         FREE(ser);
21379         return tag_ptr(ret_conv, true);
21380 }
21381
21382 void  __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint64_t this_ptr) {
21383         if (!ptr_is_owned(this_ptr)) return;
21384         void* this_ptr_ptr = untag_ptr(this_ptr);
21385         CHECK_ACCESS(this_ptr_ptr);
21386         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
21387         FREE(untag_ptr(this_ptr));
21388         MessageSendEvent_free(this_ptr_conv);
21389 }
21390
21391 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
21392         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21393         *ret_copy = MessageSendEvent_clone(arg);
21394         uint64_t ret_ref = tag_ptr(ret_copy, true);
21395         return ret_ref;
21396 }
21397 int64_t  __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint64_t arg) {
21398         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
21399         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
21400         return ret_conv;
21401 }
21402
21403 uint64_t  __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint64_t orig) {
21404         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
21405         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21406         *ret_copy = MessageSendEvent_clone(orig_conv);
21407         uint64_t ret_ref = tag_ptr(ret_copy, true);
21408         return ret_ref;
21409 }
21410
21411 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint64_t msg) {
21412         LDKPublicKey node_id_ref;
21413         CHECK(node_id->arr_len == 33);
21414         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21415         LDKAcceptChannel msg_conv;
21416         msg_conv.inner = untag_ptr(msg);
21417         msg_conv.is_owned = ptr_is_owned(msg);
21418         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21419         msg_conv = AcceptChannel_clone(&msg_conv);
21420         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21421         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
21422         uint64_t ret_ref = tag_ptr(ret_copy, true);
21423         return ret_ref;
21424 }
21425
21426 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint64_t msg) {
21427         LDKPublicKey node_id_ref;
21428         CHECK(node_id->arr_len == 33);
21429         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21430         LDKOpenChannel msg_conv;
21431         msg_conv.inner = untag_ptr(msg);
21432         msg_conv.is_owned = ptr_is_owned(msg);
21433         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21434         msg_conv = OpenChannel_clone(&msg_conv);
21435         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21436         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
21437         uint64_t ret_ref = tag_ptr(ret_copy, true);
21438         return ret_ref;
21439 }
21440
21441 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_created"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint64_t msg) {
21442         LDKPublicKey node_id_ref;
21443         CHECK(node_id->arr_len == 33);
21444         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21445         LDKFundingCreated msg_conv;
21446         msg_conv.inner = untag_ptr(msg);
21447         msg_conv.is_owned = ptr_is_owned(msg);
21448         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21449         msg_conv = FundingCreated_clone(&msg_conv);
21450         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21451         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
21452         uint64_t ret_ref = tag_ptr(ret_copy, true);
21453         return ret_ref;
21454 }
21455
21456 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_signed"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint64_t msg) {
21457         LDKPublicKey node_id_ref;
21458         CHECK(node_id->arr_len == 33);
21459         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21460         LDKFundingSigned msg_conv;
21461         msg_conv.inner = untag_ptr(msg);
21462         msg_conv.is_owned = ptr_is_owned(msg);
21463         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21464         msg_conv = FundingSigned_clone(&msg_conv);
21465         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21466         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
21467         uint64_t ret_ref = tag_ptr(ret_copy, true);
21468         return ret_ref;
21469 }
21470
21471 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_ready"))) TS_MessageSendEvent_send_channel_ready(int8_tArray node_id, uint64_t msg) {
21472         LDKPublicKey node_id_ref;
21473         CHECK(node_id->arr_len == 33);
21474         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21475         LDKChannelReady msg_conv;
21476         msg_conv.inner = untag_ptr(msg);
21477         msg_conv.is_owned = ptr_is_owned(msg);
21478         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21479         msg_conv = ChannelReady_clone(&msg_conv);
21480         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21481         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
21482         uint64_t ret_ref = tag_ptr(ret_copy, true);
21483         return ret_ref;
21484 }
21485
21486 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_announcement_signatures"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint64_t msg) {
21487         LDKPublicKey node_id_ref;
21488         CHECK(node_id->arr_len == 33);
21489         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21490         LDKAnnouncementSignatures msg_conv;
21491         msg_conv.inner = untag_ptr(msg);
21492         msg_conv.is_owned = ptr_is_owned(msg);
21493         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21494         msg_conv = AnnouncementSignatures_clone(&msg_conv);
21495         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21496         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
21497         uint64_t ret_ref = tag_ptr(ret_copy, true);
21498         return ret_ref;
21499 }
21500
21501 uint64_t  __attribute__((export_name("TS_MessageSendEvent_update_htlcs"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint64_t updates) {
21502         LDKPublicKey node_id_ref;
21503         CHECK(node_id->arr_len == 33);
21504         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21505         LDKCommitmentUpdate updates_conv;
21506         updates_conv.inner = untag_ptr(updates);
21507         updates_conv.is_owned = ptr_is_owned(updates);
21508         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
21509         updates_conv = CommitmentUpdate_clone(&updates_conv);
21510         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21511         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
21512         uint64_t ret_ref = tag_ptr(ret_copy, true);
21513         return ret_ref;
21514 }
21515
21516 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_revoke_and_ack"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint64_t msg) {
21517         LDKPublicKey node_id_ref;
21518         CHECK(node_id->arr_len == 33);
21519         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21520         LDKRevokeAndACK msg_conv;
21521         msg_conv.inner = untag_ptr(msg);
21522         msg_conv.is_owned = ptr_is_owned(msg);
21523         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21524         msg_conv = RevokeAndACK_clone(&msg_conv);
21525         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21526         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
21527         uint64_t ret_ref = tag_ptr(ret_copy, true);
21528         return ret_ref;
21529 }
21530
21531 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_closing_signed"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint64_t msg) {
21532         LDKPublicKey node_id_ref;
21533         CHECK(node_id->arr_len == 33);
21534         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21535         LDKClosingSigned msg_conv;
21536         msg_conv.inner = untag_ptr(msg);
21537         msg_conv.is_owned = ptr_is_owned(msg);
21538         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21539         msg_conv = ClosingSigned_clone(&msg_conv);
21540         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21541         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
21542         uint64_t ret_ref = tag_ptr(ret_copy, true);
21543         return ret_ref;
21544 }
21545
21546 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_shutdown"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint64_t msg) {
21547         LDKPublicKey node_id_ref;
21548         CHECK(node_id->arr_len == 33);
21549         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21550         LDKShutdown msg_conv;
21551         msg_conv.inner = untag_ptr(msg);
21552         msg_conv.is_owned = ptr_is_owned(msg);
21553         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21554         msg_conv = Shutdown_clone(&msg_conv);
21555         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21556         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
21557         uint64_t ret_ref = tag_ptr(ret_copy, true);
21558         return ret_ref;
21559 }
21560
21561 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_reestablish"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint64_t msg) {
21562         LDKPublicKey node_id_ref;
21563         CHECK(node_id->arr_len == 33);
21564         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21565         LDKChannelReestablish msg_conv;
21566         msg_conv.inner = untag_ptr(msg);
21567         msg_conv.is_owned = ptr_is_owned(msg);
21568         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21569         msg_conv = ChannelReestablish_clone(&msg_conv);
21570         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21571         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
21572         uint64_t ret_ref = tag_ptr(ret_copy, true);
21573         return ret_ref;
21574 }
21575
21576 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) {
21577         LDKPublicKey node_id_ref;
21578         CHECK(node_id->arr_len == 33);
21579         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21580         LDKChannelAnnouncement msg_conv;
21581         msg_conv.inner = untag_ptr(msg);
21582         msg_conv.is_owned = ptr_is_owned(msg);
21583         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21584         msg_conv = ChannelAnnouncement_clone(&msg_conv);
21585         LDKChannelUpdate update_msg_conv;
21586         update_msg_conv.inner = untag_ptr(update_msg);
21587         update_msg_conv.is_owned = ptr_is_owned(update_msg);
21588         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
21589         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
21590         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21591         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
21592         uint64_t ret_ref = tag_ptr(ret_copy, true);
21593         return ret_ref;
21594 }
21595
21596 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_announcement"))) TS_MessageSendEvent_broadcast_channel_announcement(uint64_t msg, uint64_t update_msg) {
21597         LDKChannelAnnouncement msg_conv;
21598         msg_conv.inner = untag_ptr(msg);
21599         msg_conv.is_owned = ptr_is_owned(msg);
21600         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21601         msg_conv = ChannelAnnouncement_clone(&msg_conv);
21602         LDKChannelUpdate update_msg_conv;
21603         update_msg_conv.inner = untag_ptr(update_msg);
21604         update_msg_conv.is_owned = ptr_is_owned(update_msg);
21605         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
21606         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
21607         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21608         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
21609         uint64_t ret_ref = tag_ptr(ret_copy, true);
21610         return ret_ref;
21611 }
21612
21613 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_update"))) TS_MessageSendEvent_broadcast_channel_update(uint64_t msg) {
21614         LDKChannelUpdate msg_conv;
21615         msg_conv.inner = untag_ptr(msg);
21616         msg_conv.is_owned = ptr_is_owned(msg);
21617         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21618         msg_conv = ChannelUpdate_clone(&msg_conv);
21619         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21620         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
21621         uint64_t ret_ref = tag_ptr(ret_copy, true);
21622         return ret_ref;
21623 }
21624
21625 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint64_t msg) {
21626         LDKPublicKey node_id_ref;
21627         CHECK(node_id->arr_len == 33);
21628         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21629         LDKChannelUpdate msg_conv;
21630         msg_conv.inner = untag_ptr(msg);
21631         msg_conv.is_owned = ptr_is_owned(msg);
21632         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21633         msg_conv = ChannelUpdate_clone(&msg_conv);
21634         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21635         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
21636         uint64_t ret_ref = tag_ptr(ret_copy, true);
21637         return ret_ref;
21638 }
21639
21640 uint64_t  __attribute__((export_name("TS_MessageSendEvent_handle_error"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint64_t action) {
21641         LDKPublicKey node_id_ref;
21642         CHECK(node_id->arr_len == 33);
21643         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21644         void* action_ptr = untag_ptr(action);
21645         CHECK_ACCESS(action_ptr);
21646         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
21647         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
21648         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21649         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
21650         uint64_t ret_ref = tag_ptr(ret_copy, true);
21651         return ret_ref;
21652 }
21653
21654 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_range_query"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint64_t msg) {
21655         LDKPublicKey node_id_ref;
21656         CHECK(node_id->arr_len == 33);
21657         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21658         LDKQueryChannelRange msg_conv;
21659         msg_conv.inner = untag_ptr(msg);
21660         msg_conv.is_owned = ptr_is_owned(msg);
21661         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21662         msg_conv = QueryChannelRange_clone(&msg_conv);
21663         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21664         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
21665         uint64_t ret_ref = tag_ptr(ret_copy, true);
21666         return ret_ref;
21667 }
21668
21669 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_short_ids_query"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint64_t msg) {
21670         LDKPublicKey node_id_ref;
21671         CHECK(node_id->arr_len == 33);
21672         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21673         LDKQueryShortChannelIds msg_conv;
21674         msg_conv.inner = untag_ptr(msg);
21675         msg_conv.is_owned = ptr_is_owned(msg);
21676         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21677         msg_conv = QueryShortChannelIds_clone(&msg_conv);
21678         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21679         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
21680         uint64_t ret_ref = tag_ptr(ret_copy, true);
21681         return ret_ref;
21682 }
21683
21684 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_reply_channel_range"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint64_t msg) {
21685         LDKPublicKey node_id_ref;
21686         CHECK(node_id->arr_len == 33);
21687         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21688         LDKReplyChannelRange msg_conv;
21689         msg_conv.inner = untag_ptr(msg);
21690         msg_conv.is_owned = ptr_is_owned(msg);
21691         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21692         msg_conv = ReplyChannelRange_clone(&msg_conv);
21693         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21694         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
21695         uint64_t ret_ref = tag_ptr(ret_copy, true);
21696         return ret_ref;
21697 }
21698
21699 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_gossip_timestamp_filter"))) TS_MessageSendEvent_send_gossip_timestamp_filter(int8_tArray node_id, uint64_t msg) {
21700         LDKPublicKey node_id_ref;
21701         CHECK(node_id->arr_len == 33);
21702         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
21703         LDKGossipTimestampFilter msg_conv;
21704         msg_conv.inner = untag_ptr(msg);
21705         msg_conv.is_owned = ptr_is_owned(msg);
21706         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21707         msg_conv = GossipTimestampFilter_clone(&msg_conv);
21708         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
21709         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
21710         uint64_t ret_ref = tag_ptr(ret_copy, true);
21711         return ret_ref;
21712 }
21713
21714 void  __attribute__((export_name("TS_MessageSendEventsProvider_free"))) TS_MessageSendEventsProvider_free(uint64_t this_ptr) {
21715         if (!ptr_is_owned(this_ptr)) return;
21716         void* this_ptr_ptr = untag_ptr(this_ptr);
21717         CHECK_ACCESS(this_ptr_ptr);
21718         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
21719         FREE(untag_ptr(this_ptr));
21720         MessageSendEventsProvider_free(this_ptr_conv);
21721 }
21722
21723 void  __attribute__((export_name("TS_OnionMessageProvider_free"))) TS_OnionMessageProvider_free(uint64_t this_ptr) {
21724         if (!ptr_is_owned(this_ptr)) return;
21725         void* this_ptr_ptr = untag_ptr(this_ptr);
21726         CHECK_ACCESS(this_ptr_ptr);
21727         LDKOnionMessageProvider this_ptr_conv = *(LDKOnionMessageProvider*)(this_ptr_ptr);
21728         FREE(untag_ptr(this_ptr));
21729         OnionMessageProvider_free(this_ptr_conv);
21730 }
21731
21732 void  __attribute__((export_name("TS_EventsProvider_free"))) TS_EventsProvider_free(uint64_t this_ptr) {
21733         if (!ptr_is_owned(this_ptr)) return;
21734         void* this_ptr_ptr = untag_ptr(this_ptr);
21735         CHECK_ACCESS(this_ptr_ptr);
21736         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
21737         FREE(untag_ptr(this_ptr));
21738         EventsProvider_free(this_ptr_conv);
21739 }
21740
21741 void  __attribute__((export_name("TS_EventHandler_free"))) TS_EventHandler_free(uint64_t this_ptr) {
21742         if (!ptr_is_owned(this_ptr)) return;
21743         void* this_ptr_ptr = untag_ptr(this_ptr);
21744         CHECK_ACCESS(this_ptr_ptr);
21745         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
21746         FREE(untag_ptr(this_ptr));
21747         EventHandler_free(this_ptr_conv);
21748 }
21749
21750 void  __attribute__((export_name("TS_APIError_free"))) TS_APIError_free(uint64_t this_ptr) {
21751         if (!ptr_is_owned(this_ptr)) return;
21752         void* this_ptr_ptr = untag_ptr(this_ptr);
21753         CHECK_ACCESS(this_ptr_ptr);
21754         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
21755         FREE(untag_ptr(this_ptr));
21756         APIError_free(this_ptr_conv);
21757 }
21758
21759 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
21760         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21761         *ret_copy = APIError_clone(arg);
21762         uint64_t ret_ref = tag_ptr(ret_copy, true);
21763         return ret_ref;
21764 }
21765 int64_t  __attribute__((export_name("TS_APIError_clone_ptr"))) TS_APIError_clone_ptr(uint64_t arg) {
21766         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
21767         int64_t ret_conv = APIError_clone_ptr(arg_conv);
21768         return ret_conv;
21769 }
21770
21771 uint64_t  __attribute__((export_name("TS_APIError_clone"))) TS_APIError_clone(uint64_t orig) {
21772         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
21773         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21774         *ret_copy = APIError_clone(orig_conv);
21775         uint64_t ret_ref = tag_ptr(ret_copy, true);
21776         return ret_ref;
21777 }
21778
21779 uint64_t  __attribute__((export_name("TS_APIError_apimisuse_error"))) TS_APIError_apimisuse_error(jstring err) {
21780         LDKStr err_conv = str_ref_to_owned_c(err);
21781         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21782         *ret_copy = APIError_apimisuse_error(err_conv);
21783         uint64_t ret_ref = tag_ptr(ret_copy, true);
21784         return ret_ref;
21785 }
21786
21787 uint64_t  __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
21788         LDKStr err_conv = str_ref_to_owned_c(err);
21789         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21790         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
21791         uint64_t ret_ref = tag_ptr(ret_copy, true);
21792         return ret_ref;
21793 }
21794
21795 uint64_t  __attribute__((export_name("TS_APIError_route_error"))) TS_APIError_route_error(jstring err) {
21796         LDKStr err_conv = str_ref_to_owned_c(err);
21797         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21798         *ret_copy = APIError_route_error(err_conv);
21799         uint64_t ret_ref = tag_ptr(ret_copy, true);
21800         return ret_ref;
21801 }
21802
21803 uint64_t  __attribute__((export_name("TS_APIError_channel_unavailable"))) TS_APIError_channel_unavailable(jstring err) {
21804         LDKStr err_conv = str_ref_to_owned_c(err);
21805         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21806         *ret_copy = APIError_channel_unavailable(err_conv);
21807         uint64_t ret_ref = tag_ptr(ret_copy, true);
21808         return ret_ref;
21809 }
21810
21811 uint64_t  __attribute__((export_name("TS_APIError_monitor_update_failed"))) TS_APIError_monitor_update_failed() {
21812         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21813         *ret_copy = APIError_monitor_update_failed();
21814         uint64_t ret_ref = tag_ptr(ret_copy, true);
21815         return ret_ref;
21816 }
21817
21818 uint64_t  __attribute__((export_name("TS_APIError_incompatible_shutdown_script"))) TS_APIError_incompatible_shutdown_script(uint64_t script) {
21819         LDKShutdownScript script_conv;
21820         script_conv.inner = untag_ptr(script);
21821         script_conv.is_owned = ptr_is_owned(script);
21822         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
21823         script_conv = ShutdownScript_clone(&script_conv);
21824         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
21825         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
21826         uint64_t ret_ref = tag_ptr(ret_copy, true);
21827         return ret_ref;
21828 }
21829
21830 void  __attribute__((export_name("TS_BigSize_free"))) TS_BigSize_free(uint64_t this_obj) {
21831         LDKBigSize this_obj_conv;
21832         this_obj_conv.inner = untag_ptr(this_obj);
21833         this_obj_conv.is_owned = ptr_is_owned(this_obj);
21834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21835         BigSize_free(this_obj_conv);
21836 }
21837
21838 int64_t  __attribute__((export_name("TS_BigSize_get_a"))) TS_BigSize_get_a(uint64_t this_ptr) {
21839         LDKBigSize this_ptr_conv;
21840         this_ptr_conv.inner = untag_ptr(this_ptr);
21841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21843         this_ptr_conv.is_owned = false;
21844         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
21845         return ret_conv;
21846 }
21847
21848 void  __attribute__((export_name("TS_BigSize_set_a"))) TS_BigSize_set_a(uint64_t this_ptr, int64_t val) {
21849         LDKBigSize this_ptr_conv;
21850         this_ptr_conv.inner = untag_ptr(this_ptr);
21851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
21852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
21853         this_ptr_conv.is_owned = false;
21854         BigSize_set_a(&this_ptr_conv, val);
21855 }
21856
21857 uint64_t  __attribute__((export_name("TS_BigSize_new"))) TS_BigSize_new(int64_t a_arg) {
21858         LDKBigSize ret_var = BigSize_new(a_arg);
21859         uint64_t ret_ref = 0;
21860         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21861         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21862         return ret_ref;
21863 }
21864
21865 void  __attribute__((export_name("TS_Hostname_free"))) TS_Hostname_free(uint64_t this_obj) {
21866         LDKHostname this_obj_conv;
21867         this_obj_conv.inner = untag_ptr(this_obj);
21868         this_obj_conv.is_owned = ptr_is_owned(this_obj);
21869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21870         Hostname_free(this_obj_conv);
21871 }
21872
21873 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
21874         LDKHostname ret_var = Hostname_clone(arg);
21875         uint64_t ret_ref = 0;
21876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21878         return ret_ref;
21879 }
21880 int64_t  __attribute__((export_name("TS_Hostname_clone_ptr"))) TS_Hostname_clone_ptr(uint64_t arg) {
21881         LDKHostname arg_conv;
21882         arg_conv.inner = untag_ptr(arg);
21883         arg_conv.is_owned = ptr_is_owned(arg);
21884         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
21885         arg_conv.is_owned = false;
21886         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
21887         return ret_conv;
21888 }
21889
21890 uint64_t  __attribute__((export_name("TS_Hostname_clone"))) TS_Hostname_clone(uint64_t orig) {
21891         LDKHostname orig_conv;
21892         orig_conv.inner = untag_ptr(orig);
21893         orig_conv.is_owned = ptr_is_owned(orig);
21894         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
21895         orig_conv.is_owned = false;
21896         LDKHostname ret_var = Hostname_clone(&orig_conv);
21897         uint64_t ret_ref = 0;
21898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21900         return ret_ref;
21901 }
21902
21903 int8_t  __attribute__((export_name("TS_Hostname_len"))) TS_Hostname_len(uint64_t this_arg) {
21904         LDKHostname this_arg_conv;
21905         this_arg_conv.inner = untag_ptr(this_arg);
21906         this_arg_conv.is_owned = ptr_is_owned(this_arg);
21907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
21908         this_arg_conv.is_owned = false;
21909         int8_t ret_conv = Hostname_len(&this_arg_conv);
21910         return ret_conv;
21911 }
21912
21913 uint64_t  __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_tArray sk) {
21914         LDKu8slice msg_ref;
21915         msg_ref.datalen = msg->arr_len;
21916         msg_ref.data = msg->elems;
21917         unsigned char sk_arr[32];
21918         CHECK(sk->arr_len == 32);
21919         memcpy(sk_arr, sk->elems, 32); FREE(sk);
21920         unsigned char (*sk_ref)[32] = &sk_arr;
21921         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
21922         *ret_conv = sign(msg_ref, sk_ref);
21923         FREE(msg);
21924         return tag_ptr(ret_conv, true);
21925 }
21926
21927 uint64_t  __attribute__((export_name("TS_recover_pk"))) TS_recover_pk(int8_tArray msg, jstring sig) {
21928         LDKu8slice msg_ref;
21929         msg_ref.datalen = msg->arr_len;
21930         msg_ref.data = msg->elems;
21931         LDKStr sig_conv = str_ref_to_owned_c(sig);
21932         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
21933         *ret_conv = recover_pk(msg_ref, sig_conv);
21934         FREE(msg);
21935         return tag_ptr(ret_conv, true);
21936 }
21937
21938 jboolean  __attribute__((export_name("TS_verify"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
21939         LDKu8slice msg_ref;
21940         msg_ref.datalen = msg->arr_len;
21941         msg_ref.data = msg->elems;
21942         LDKStr sig_conv = str_ref_to_owned_c(sig);
21943         LDKPublicKey pk_ref;
21944         CHECK(pk->arr_len == 33);
21945         memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
21946         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
21947         FREE(msg);
21948         return ret_conv;
21949 }
21950
21951 int8_tArray  __attribute__((export_name("TS_construct_invoice_preimage"))) TS_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
21952         LDKu8slice hrp_bytes_ref;
21953         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
21954         hrp_bytes_ref.data = hrp_bytes->elems;
21955         LDKCVec_u5Z data_without_signature_constr;
21956         data_without_signature_constr.datalen = data_without_signature->arr_len;
21957         if (data_without_signature_constr.datalen > 0)
21958                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements");
21959         else
21960                 data_without_signature_constr.data = NULL;
21961         int8_t* data_without_signature_vals = (void*) data_without_signature->elems;
21962         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
21963                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
21964                 
21965                 data_without_signature_constr.data[h] = (LDKu5){ ._0 = data_without_signature_conv_7 };
21966         }
21967         FREE(data_without_signature);
21968         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
21969         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
21970         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
21971         CVec_u8Z_free(ret_var);
21972         FREE(hrp_bytes);
21973         return ret_arr;
21974 }
21975
21976 void  __attribute__((export_name("TS_Persister_free"))) TS_Persister_free(uint64_t this_ptr) {
21977         if (!ptr_is_owned(this_ptr)) return;
21978         void* this_ptr_ptr = untag_ptr(this_ptr);
21979         CHECK_ACCESS(this_ptr_ptr);
21980         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
21981         FREE(untag_ptr(this_ptr));
21982         Persister_free(this_ptr_conv);
21983 }
21984
21985 void  __attribute__((export_name("TS_FutureCallback_free"))) TS_FutureCallback_free(uint64_t this_ptr) {
21986         if (!ptr_is_owned(this_ptr)) return;
21987         void* this_ptr_ptr = untag_ptr(this_ptr);
21988         CHECK_ACCESS(this_ptr_ptr);
21989         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
21990         FREE(untag_ptr(this_ptr));
21991         FutureCallback_free(this_ptr_conv);
21992 }
21993
21994 void  __attribute__((export_name("TS_Future_free"))) TS_Future_free(uint64_t this_obj) {
21995         LDKFuture this_obj_conv;
21996         this_obj_conv.inner = untag_ptr(this_obj);
21997         this_obj_conv.is_owned = ptr_is_owned(this_obj);
21998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
21999         Future_free(this_obj_conv);
22000 }
22001
22002 void  __attribute__((export_name("TS_Future_register_callback_fn"))) TS_Future_register_callback_fn(uint64_t this_arg, uint64_t callback) {
22003         LDKFuture this_arg_conv;
22004         this_arg_conv.inner = untag_ptr(this_arg);
22005         this_arg_conv.is_owned = ptr_is_owned(this_arg);
22006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
22007         this_arg_conv.is_owned = false;
22008         void* callback_ptr = untag_ptr(callback);
22009         CHECK_ACCESS(callback_ptr);
22010         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
22011         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
22012                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22013                 LDKFutureCallback_JCalls_cloned(&callback_conv);
22014         }
22015         Future_register_callback_fn(&this_arg_conv, callback_conv);
22016 }
22017
22018 uint32_t  __attribute__((export_name("TS_Level_clone"))) TS_Level_clone(uint64_t orig) {
22019         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
22020         uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
22021         return ret_conv;
22022 }
22023
22024 uint32_t  __attribute__((export_name("TS_Level_gossip"))) TS_Level_gossip() {
22025         uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
22026         return ret_conv;
22027 }
22028
22029 uint32_t  __attribute__((export_name("TS_Level_trace"))) TS_Level_trace() {
22030         uint32_t ret_conv = LDKLevel_to_js(Level_trace());
22031         return ret_conv;
22032 }
22033
22034 uint32_t  __attribute__((export_name("TS_Level_debug"))) TS_Level_debug() {
22035         uint32_t ret_conv = LDKLevel_to_js(Level_debug());
22036         return ret_conv;
22037 }
22038
22039 uint32_t  __attribute__((export_name("TS_Level_info"))) TS_Level_info() {
22040         uint32_t ret_conv = LDKLevel_to_js(Level_info());
22041         return ret_conv;
22042 }
22043
22044 uint32_t  __attribute__((export_name("TS_Level_warn"))) TS_Level_warn() {
22045         uint32_t ret_conv = LDKLevel_to_js(Level_warn());
22046         return ret_conv;
22047 }
22048
22049 uint32_t  __attribute__((export_name("TS_Level_error"))) TS_Level_error() {
22050         uint32_t ret_conv = LDKLevel_to_js(Level_error());
22051         return ret_conv;
22052 }
22053
22054 jboolean  __attribute__((export_name("TS_Level_eq"))) TS_Level_eq(uint64_t a, uint64_t b) {
22055         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
22056         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
22057         jboolean ret_conv = Level_eq(a_conv, b_conv);
22058         return ret_conv;
22059 }
22060
22061 int64_t  __attribute__((export_name("TS_Level_hash"))) TS_Level_hash(uint64_t o) {
22062         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
22063         int64_t ret_conv = Level_hash(o_conv);
22064         return ret_conv;
22065 }
22066
22067 uint32_t  __attribute__((export_name("TS_Level_max"))) TS_Level_max() {
22068         uint32_t ret_conv = LDKLevel_to_js(Level_max());
22069         return ret_conv;
22070 }
22071
22072 void  __attribute__((export_name("TS_Record_free"))) TS_Record_free(uint64_t this_obj) {
22073         LDKRecord this_obj_conv;
22074         this_obj_conv.inner = untag_ptr(this_obj);
22075         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22077         Record_free(this_obj_conv);
22078 }
22079
22080 uint32_t  __attribute__((export_name("TS_Record_get_level"))) TS_Record_get_level(uint64_t this_ptr) {
22081         LDKRecord this_ptr_conv;
22082         this_ptr_conv.inner = untag_ptr(this_ptr);
22083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22085         this_ptr_conv.is_owned = false;
22086         uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
22087         return ret_conv;
22088 }
22089
22090 void  __attribute__((export_name("TS_Record_set_level"))) TS_Record_set_level(uint64_t this_ptr, uint32_t val) {
22091         LDKRecord this_ptr_conv;
22092         this_ptr_conv.inner = untag_ptr(this_ptr);
22093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22095         this_ptr_conv.is_owned = false;
22096         LDKLevel val_conv = LDKLevel_from_js(val);
22097         Record_set_level(&this_ptr_conv, val_conv);
22098 }
22099
22100 jstring  __attribute__((export_name("TS_Record_get_args"))) TS_Record_get_args(uint64_t this_ptr) {
22101         LDKRecord this_ptr_conv;
22102         this_ptr_conv.inner = untag_ptr(this_ptr);
22103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22105         this_ptr_conv.is_owned = false;
22106         LDKStr ret_str = Record_get_args(&this_ptr_conv);
22107         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
22108         Str_free(ret_str);
22109         return ret_conv;
22110 }
22111
22112 void  __attribute__((export_name("TS_Record_set_args"))) TS_Record_set_args(uint64_t this_ptr, jstring val) {
22113         LDKRecord this_ptr_conv;
22114         this_ptr_conv.inner = untag_ptr(this_ptr);
22115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22117         this_ptr_conv.is_owned = false;
22118         LDKStr val_conv = str_ref_to_owned_c(val);
22119         Record_set_args(&this_ptr_conv, val_conv);
22120 }
22121
22122 jstring  __attribute__((export_name("TS_Record_get_module_path"))) TS_Record_get_module_path(uint64_t this_ptr) {
22123         LDKRecord this_ptr_conv;
22124         this_ptr_conv.inner = untag_ptr(this_ptr);
22125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22127         this_ptr_conv.is_owned = false;
22128         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
22129         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
22130         Str_free(ret_str);
22131         return ret_conv;
22132 }
22133
22134 void  __attribute__((export_name("TS_Record_set_module_path"))) TS_Record_set_module_path(uint64_t this_ptr, jstring val) {
22135         LDKRecord this_ptr_conv;
22136         this_ptr_conv.inner = untag_ptr(this_ptr);
22137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22139         this_ptr_conv.is_owned = false;
22140         LDKStr val_conv = str_ref_to_owned_c(val);
22141         Record_set_module_path(&this_ptr_conv, val_conv);
22142 }
22143
22144 jstring  __attribute__((export_name("TS_Record_get_file"))) TS_Record_get_file(uint64_t this_ptr) {
22145         LDKRecord this_ptr_conv;
22146         this_ptr_conv.inner = untag_ptr(this_ptr);
22147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22149         this_ptr_conv.is_owned = false;
22150         LDKStr ret_str = Record_get_file(&this_ptr_conv);
22151         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
22152         Str_free(ret_str);
22153         return ret_conv;
22154 }
22155
22156 void  __attribute__((export_name("TS_Record_set_file"))) TS_Record_set_file(uint64_t this_ptr, jstring val) {
22157         LDKRecord this_ptr_conv;
22158         this_ptr_conv.inner = untag_ptr(this_ptr);
22159         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22161         this_ptr_conv.is_owned = false;
22162         LDKStr val_conv = str_ref_to_owned_c(val);
22163         Record_set_file(&this_ptr_conv, val_conv);
22164 }
22165
22166 int32_t  __attribute__((export_name("TS_Record_get_line"))) TS_Record_get_line(uint64_t this_ptr) {
22167         LDKRecord this_ptr_conv;
22168         this_ptr_conv.inner = untag_ptr(this_ptr);
22169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22171         this_ptr_conv.is_owned = false;
22172         int32_t ret_conv = Record_get_line(&this_ptr_conv);
22173         return ret_conv;
22174 }
22175
22176 void  __attribute__((export_name("TS_Record_set_line"))) TS_Record_set_line(uint64_t this_ptr, int32_t val) {
22177         LDKRecord this_ptr_conv;
22178         this_ptr_conv.inner = untag_ptr(this_ptr);
22179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22181         this_ptr_conv.is_owned = false;
22182         Record_set_line(&this_ptr_conv, val);
22183 }
22184
22185 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
22186         LDKRecord ret_var = Record_clone(arg);
22187         uint64_t ret_ref = 0;
22188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22190         return ret_ref;
22191 }
22192 int64_t  __attribute__((export_name("TS_Record_clone_ptr"))) TS_Record_clone_ptr(uint64_t arg) {
22193         LDKRecord arg_conv;
22194         arg_conv.inner = untag_ptr(arg);
22195         arg_conv.is_owned = ptr_is_owned(arg);
22196         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22197         arg_conv.is_owned = false;
22198         int64_t ret_conv = Record_clone_ptr(&arg_conv);
22199         return ret_conv;
22200 }
22201
22202 uint64_t  __attribute__((export_name("TS_Record_clone"))) TS_Record_clone(uint64_t orig) {
22203         LDKRecord orig_conv;
22204         orig_conv.inner = untag_ptr(orig);
22205         orig_conv.is_owned = ptr_is_owned(orig);
22206         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22207         orig_conv.is_owned = false;
22208         LDKRecord ret_var = Record_clone(&orig_conv);
22209         uint64_t ret_ref = 0;
22210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22211         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22212         return ret_ref;
22213 }
22214
22215 void  __attribute__((export_name("TS_Logger_free"))) TS_Logger_free(uint64_t this_ptr) {
22216         if (!ptr_is_owned(this_ptr)) return;
22217         void* this_ptr_ptr = untag_ptr(this_ptr);
22218         CHECK_ACCESS(this_ptr_ptr);
22219         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
22220         FREE(untag_ptr(this_ptr));
22221         Logger_free(this_ptr_conv);
22222 }
22223
22224 void  __attribute__((export_name("TS_ChannelHandshakeConfig_free"))) TS_ChannelHandshakeConfig_free(uint64_t this_obj) {
22225         LDKChannelHandshakeConfig this_obj_conv;
22226         this_obj_conv.inner = untag_ptr(this_obj);
22227         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22229         ChannelHandshakeConfig_free(this_obj_conv);
22230 }
22231
22232 int32_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_minimum_depth"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint64_t this_ptr) {
22233         LDKChannelHandshakeConfig this_ptr_conv;
22234         this_ptr_conv.inner = untag_ptr(this_ptr);
22235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22237         this_ptr_conv.is_owned = false;
22238         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
22239         return ret_conv;
22240 }
22241
22242 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_minimum_depth"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint64_t this_ptr, int32_t val) {
22243         LDKChannelHandshakeConfig this_ptr_conv;
22244         this_ptr_conv.inner = untag_ptr(this_ptr);
22245         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22247         this_ptr_conv.is_owned = false;
22248         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
22249 }
22250
22251 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_to_self_delay"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint64_t this_ptr) {
22252         LDKChannelHandshakeConfig this_ptr_conv;
22253         this_ptr_conv.inner = untag_ptr(this_ptr);
22254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22256         this_ptr_conv.is_owned = false;
22257         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
22258         return ret_conv;
22259 }
22260
22261 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) {
22262         LDKChannelHandshakeConfig this_ptr_conv;
22263         this_ptr_conv.inner = untag_ptr(this_ptr);
22264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22266         this_ptr_conv.is_owned = false;
22267         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
22268 }
22269
22270 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint64_t this_ptr) {
22271         LDKChannelHandshakeConfig this_ptr_conv;
22272         this_ptr_conv.inner = untag_ptr(this_ptr);
22273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22275         this_ptr_conv.is_owned = false;
22276         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
22277         return ret_conv;
22278 }
22279
22280 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) {
22281         LDKChannelHandshakeConfig this_ptr_conv;
22282         this_ptr_conv.inner = untag_ptr(this_ptr);
22283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22285         this_ptr_conv.is_owned = false;
22286         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
22287 }
22288
22289 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) {
22290         LDKChannelHandshakeConfig this_ptr_conv;
22291         this_ptr_conv.inner = untag_ptr(this_ptr);
22292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22294         this_ptr_conv.is_owned = false;
22295         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
22296         return ret_conv;
22297 }
22298
22299 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) {
22300         LDKChannelHandshakeConfig this_ptr_conv;
22301         this_ptr_conv.inner = untag_ptr(this_ptr);
22302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22304         this_ptr_conv.is_owned = false;
22305         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
22306 }
22307
22308 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_get_negotiate_scid_privacy(uint64_t this_ptr) {
22309         LDKChannelHandshakeConfig this_ptr_conv;
22310         this_ptr_conv.inner = untag_ptr(this_ptr);
22311         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22313         this_ptr_conv.is_owned = false;
22314         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
22315         return ret_conv;
22316 }
22317
22318 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_set_negotiate_scid_privacy(uint64_t this_ptr, jboolean val) {
22319         LDKChannelHandshakeConfig this_ptr_conv;
22320         this_ptr_conv.inner = untag_ptr(this_ptr);
22321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22323         this_ptr_conv.is_owned = false;
22324         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
22325 }
22326
22327 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_announced_channel"))) TS_ChannelHandshakeConfig_get_announced_channel(uint64_t this_ptr) {
22328         LDKChannelHandshakeConfig this_ptr_conv;
22329         this_ptr_conv.inner = untag_ptr(this_ptr);
22330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22332         this_ptr_conv.is_owned = false;
22333         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
22334         return ret_conv;
22335 }
22336
22337 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_announced_channel"))) TS_ChannelHandshakeConfig_set_announced_channel(uint64_t this_ptr, jboolean val) {
22338         LDKChannelHandshakeConfig this_ptr_conv;
22339         this_ptr_conv.inner = untag_ptr(this_ptr);
22340         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22342         this_ptr_conv.is_owned = false;
22343         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
22344 }
22345
22346 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(uint64_t this_ptr) {
22347         LDKChannelHandshakeConfig this_ptr_conv;
22348         this_ptr_conv.inner = untag_ptr(this_ptr);
22349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22351         this_ptr_conv.is_owned = false;
22352         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
22353         return ret_conv;
22354 }
22355
22356 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(uint64_t this_ptr, jboolean val) {
22357         LDKChannelHandshakeConfig this_ptr_conv;
22358         this_ptr_conv.inner = untag_ptr(this_ptr);
22359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22361         this_ptr_conv.is_owned = false;
22362         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
22363 }
22364
22365 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) {
22366         LDKChannelHandshakeConfig this_ptr_conv;
22367         this_ptr_conv.inner = untag_ptr(this_ptr);
22368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22370         this_ptr_conv.is_owned = false;
22371         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
22372         return ret_conv;
22373 }
22374
22375 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) {
22376         LDKChannelHandshakeConfig this_ptr_conv;
22377         this_ptr_conv.inner = untag_ptr(this_ptr);
22378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22380         this_ptr_conv.is_owned = false;
22381         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
22382 }
22383
22384 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) {
22385         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);
22386         uint64_t ret_ref = 0;
22387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22389         return ret_ref;
22390 }
22391
22392 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
22393         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
22394         uint64_t ret_ref = 0;
22395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22397         return ret_ref;
22398 }
22399 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone_ptr"))) TS_ChannelHandshakeConfig_clone_ptr(uint64_t arg) {
22400         LDKChannelHandshakeConfig arg_conv;
22401         arg_conv.inner = untag_ptr(arg);
22402         arg_conv.is_owned = ptr_is_owned(arg);
22403         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22404         arg_conv.is_owned = false;
22405         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
22406         return ret_conv;
22407 }
22408
22409 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone"))) TS_ChannelHandshakeConfig_clone(uint64_t orig) {
22410         LDKChannelHandshakeConfig orig_conv;
22411         orig_conv.inner = untag_ptr(orig);
22412         orig_conv.is_owned = ptr_is_owned(orig);
22413         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22414         orig_conv.is_owned = false;
22415         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
22416         uint64_t ret_ref = 0;
22417         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22418         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22419         return ret_ref;
22420 }
22421
22422 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_default"))) TS_ChannelHandshakeConfig_default() {
22423         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
22424         uint64_t ret_ref = 0;
22425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22427         return ret_ref;
22428 }
22429
22430 void  __attribute__((export_name("TS_ChannelHandshakeLimits_free"))) TS_ChannelHandshakeLimits_free(uint64_t this_obj) {
22431         LDKChannelHandshakeLimits this_obj_conv;
22432         this_obj_conv.inner = untag_ptr(this_obj);
22433         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22435         ChannelHandshakeLimits_free(this_obj_conv);
22436 }
22437
22438 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_funding_satoshis"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint64_t this_ptr) {
22439         LDKChannelHandshakeLimits this_ptr_conv;
22440         this_ptr_conv.inner = untag_ptr(this_ptr);
22441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22443         this_ptr_conv.is_owned = false;
22444         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
22445         return ret_conv;
22446 }
22447
22448 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_funding_satoshis"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint64_t this_ptr, int64_t val) {
22449         LDKChannelHandshakeLimits this_ptr_conv;
22450         this_ptr_conv.inner = untag_ptr(this_ptr);
22451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22453         this_ptr_conv.is_owned = false;
22454         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
22455 }
22456
22457 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_funding_satoshis"))) TS_ChannelHandshakeLimits_get_max_funding_satoshis(uint64_t this_ptr) {
22458         LDKChannelHandshakeLimits this_ptr_conv;
22459         this_ptr_conv.inner = untag_ptr(this_ptr);
22460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22462         this_ptr_conv.is_owned = false;
22463         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
22464         return ret_conv;
22465 }
22466
22467 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_funding_satoshis"))) TS_ChannelHandshakeLimits_set_max_funding_satoshis(uint64_t this_ptr, int64_t val) {
22468         LDKChannelHandshakeLimits this_ptr_conv;
22469         this_ptr_conv.inner = untag_ptr(this_ptr);
22470         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22472         this_ptr_conv.is_owned = false;
22473         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
22474 }
22475
22476 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint64_t this_ptr) {
22477         LDKChannelHandshakeLimits this_ptr_conv;
22478         this_ptr_conv.inner = untag_ptr(this_ptr);
22479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22481         this_ptr_conv.is_owned = false;
22482         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
22483         return ret_conv;
22484 }
22485
22486 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) {
22487         LDKChannelHandshakeLimits this_ptr_conv;
22488         this_ptr_conv.inner = untag_ptr(this_ptr);
22489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22491         this_ptr_conv.is_owned = false;
22492         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
22493 }
22494
22495 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) {
22496         LDKChannelHandshakeLimits this_ptr_conv;
22497         this_ptr_conv.inner = untag_ptr(this_ptr);
22498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22500         this_ptr_conv.is_owned = false;
22501         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
22502         return ret_conv;
22503 }
22504
22505 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) {
22506         LDKChannelHandshakeLimits this_ptr_conv;
22507         this_ptr_conv.inner = untag_ptr(this_ptr);
22508         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22510         this_ptr_conv.is_owned = false;
22511         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
22512 }
22513
22514 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint64_t this_ptr) {
22515         LDKChannelHandshakeLimits this_ptr_conv;
22516         this_ptr_conv.inner = untag_ptr(this_ptr);
22517         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22519         this_ptr_conv.is_owned = false;
22520         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
22521         return ret_conv;
22522 }
22523
22524 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) {
22525         LDKChannelHandshakeLimits this_ptr_conv;
22526         this_ptr_conv.inner = untag_ptr(this_ptr);
22527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22529         this_ptr_conv.is_owned = false;
22530         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
22531 }
22532
22533 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint64_t this_ptr) {
22534         LDKChannelHandshakeLimits this_ptr_conv;
22535         this_ptr_conv.inner = untag_ptr(this_ptr);
22536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22538         this_ptr_conv.is_owned = false;
22539         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
22540         return ret_conv;
22541 }
22542
22543 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) {
22544         LDKChannelHandshakeLimits this_ptr_conv;
22545         this_ptr_conv.inner = untag_ptr(this_ptr);
22546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22548         this_ptr_conv.is_owned = false;
22549         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
22550 }
22551
22552 int32_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_minimum_depth"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint64_t this_ptr) {
22553         LDKChannelHandshakeLimits this_ptr_conv;
22554         this_ptr_conv.inner = untag_ptr(this_ptr);
22555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22557         this_ptr_conv.is_owned = false;
22558         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
22559         return ret_conv;
22560 }
22561
22562 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_minimum_depth"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint64_t this_ptr, int32_t val) {
22563         LDKChannelHandshakeLimits this_ptr_conv;
22564         this_ptr_conv.inner = untag_ptr(this_ptr);
22565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22567         this_ptr_conv.is_owned = false;
22568         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
22569 }
22570
22571 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_get_trust_own_funding_0conf(uint64_t this_ptr) {
22572         LDKChannelHandshakeLimits this_ptr_conv;
22573         this_ptr_conv.inner = untag_ptr(this_ptr);
22574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22576         this_ptr_conv.is_owned = false;
22577         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
22578         return ret_conv;
22579 }
22580
22581 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_set_trust_own_funding_0conf(uint64_t this_ptr, jboolean val) {
22582         LDKChannelHandshakeLimits this_ptr_conv;
22583         this_ptr_conv.inner = untag_ptr(this_ptr);
22584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22586         this_ptr_conv.is_owned = false;
22587         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
22588 }
22589
22590 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint64_t this_ptr) {
22591         LDKChannelHandshakeLimits this_ptr_conv;
22592         this_ptr_conv.inner = untag_ptr(this_ptr);
22593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22595         this_ptr_conv.is_owned = false;
22596         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
22597         return ret_conv;
22598 }
22599
22600 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint64_t this_ptr, jboolean val) {
22601         LDKChannelHandshakeLimits this_ptr_conv;
22602         this_ptr_conv.inner = untag_ptr(this_ptr);
22603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22605         this_ptr_conv.is_owned = false;
22606         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
22607 }
22608
22609 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_their_to_self_delay"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint64_t this_ptr) {
22610         LDKChannelHandshakeLimits this_ptr_conv;
22611         this_ptr_conv.inner = untag_ptr(this_ptr);
22612         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22614         this_ptr_conv.is_owned = false;
22615         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
22616         return ret_conv;
22617 }
22618
22619 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) {
22620         LDKChannelHandshakeLimits this_ptr_conv;
22621         this_ptr_conv.inner = untag_ptr(this_ptr);
22622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22624         this_ptr_conv.is_owned = false;
22625         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
22626 }
22627
22628 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) {
22629         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);
22630         uint64_t ret_ref = 0;
22631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22633         return ret_ref;
22634 }
22635
22636 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
22637         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
22638         uint64_t ret_ref = 0;
22639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22641         return ret_ref;
22642 }
22643 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone_ptr"))) TS_ChannelHandshakeLimits_clone_ptr(uint64_t arg) {
22644         LDKChannelHandshakeLimits arg_conv;
22645         arg_conv.inner = untag_ptr(arg);
22646         arg_conv.is_owned = ptr_is_owned(arg);
22647         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22648         arg_conv.is_owned = false;
22649         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
22650         return ret_conv;
22651 }
22652
22653 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone"))) TS_ChannelHandshakeLimits_clone(uint64_t orig) {
22654         LDKChannelHandshakeLimits orig_conv;
22655         orig_conv.inner = untag_ptr(orig);
22656         orig_conv.is_owned = ptr_is_owned(orig);
22657         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22658         orig_conv.is_owned = false;
22659         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
22660         uint64_t ret_ref = 0;
22661         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22662         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22663         return ret_ref;
22664 }
22665
22666 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_default"))) TS_ChannelHandshakeLimits_default() {
22667         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
22668         uint64_t ret_ref = 0;
22669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22671         return ret_ref;
22672 }
22673
22674 void  __attribute__((export_name("TS_ChannelConfig_free"))) TS_ChannelConfig_free(uint64_t this_obj) {
22675         LDKChannelConfig this_obj_conv;
22676         this_obj_conv.inner = untag_ptr(this_obj);
22677         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22679         ChannelConfig_free(this_obj_conv);
22680 }
22681
22682 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
22683         LDKChannelConfig this_ptr_conv;
22684         this_ptr_conv.inner = untag_ptr(this_ptr);
22685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22687         this_ptr_conv.is_owned = false;
22688         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
22689         return ret_conv;
22690 }
22691
22692 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) {
22693         LDKChannelConfig this_ptr_conv;
22694         this_ptr_conv.inner = untag_ptr(this_ptr);
22695         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22697         this_ptr_conv.is_owned = false;
22698         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
22699 }
22700
22701 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_base_msat"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint64_t this_ptr) {
22702         LDKChannelConfig this_ptr_conv;
22703         this_ptr_conv.inner = untag_ptr(this_ptr);
22704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22706         this_ptr_conv.is_owned = false;
22707         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
22708         return ret_conv;
22709 }
22710
22711 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) {
22712         LDKChannelConfig this_ptr_conv;
22713         this_ptr_conv.inner = untag_ptr(this_ptr);
22714         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22716         this_ptr_conv.is_owned = false;
22717         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
22718 }
22719
22720 int16_t  __attribute__((export_name("TS_ChannelConfig_get_cltv_expiry_delta"))) TS_ChannelConfig_get_cltv_expiry_delta(uint64_t this_ptr) {
22721         LDKChannelConfig this_ptr_conv;
22722         this_ptr_conv.inner = untag_ptr(this_ptr);
22723         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22725         this_ptr_conv.is_owned = false;
22726         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
22727         return ret_conv;
22728 }
22729
22730 void  __attribute__((export_name("TS_ChannelConfig_set_cltv_expiry_delta"))) TS_ChannelConfig_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
22731         LDKChannelConfig this_ptr_conv;
22732         this_ptr_conv.inner = untag_ptr(this_ptr);
22733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22735         this_ptr_conv.is_owned = false;
22736         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
22737 }
22738
22739 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) {
22740         LDKChannelConfig this_ptr_conv;
22741         this_ptr_conv.inner = untag_ptr(this_ptr);
22742         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22744         this_ptr_conv.is_owned = false;
22745         int64_t ret_conv = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
22746         return ret_conv;
22747 }
22748
22749 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) {
22750         LDKChannelConfig this_ptr_conv;
22751         this_ptr_conv.inner = untag_ptr(this_ptr);
22752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22754         this_ptr_conv.is_owned = false;
22755         ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
22756 }
22757
22758 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) {
22759         LDKChannelConfig this_ptr_conv;
22760         this_ptr_conv.inner = untag_ptr(this_ptr);
22761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22763         this_ptr_conv.is_owned = false;
22764         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
22765         return ret_conv;
22766 }
22767
22768 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) {
22769         LDKChannelConfig this_ptr_conv;
22770         this_ptr_conv.inner = untag_ptr(this_ptr);
22771         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22773         this_ptr_conv.is_owned = false;
22774         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
22775 }
22776
22777 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) {
22778         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);
22779         uint64_t ret_ref = 0;
22780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22782         return ret_ref;
22783 }
22784
22785 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
22786         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
22787         uint64_t ret_ref = 0;
22788         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22789         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22790         return ret_ref;
22791 }
22792 int64_t  __attribute__((export_name("TS_ChannelConfig_clone_ptr"))) TS_ChannelConfig_clone_ptr(uint64_t arg) {
22793         LDKChannelConfig arg_conv;
22794         arg_conv.inner = untag_ptr(arg);
22795         arg_conv.is_owned = ptr_is_owned(arg);
22796         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
22797         arg_conv.is_owned = false;
22798         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
22799         return ret_conv;
22800 }
22801
22802 uint64_t  __attribute__((export_name("TS_ChannelConfig_clone"))) TS_ChannelConfig_clone(uint64_t orig) {
22803         LDKChannelConfig orig_conv;
22804         orig_conv.inner = untag_ptr(orig);
22805         orig_conv.is_owned = ptr_is_owned(orig);
22806         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
22807         orig_conv.is_owned = false;
22808         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
22809         uint64_t ret_ref = 0;
22810         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22811         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22812         return ret_ref;
22813 }
22814
22815 uint64_t  __attribute__((export_name("TS_ChannelConfig_default"))) TS_ChannelConfig_default() {
22816         LDKChannelConfig ret_var = ChannelConfig_default();
22817         uint64_t ret_ref = 0;
22818         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22819         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22820         return ret_ref;
22821 }
22822
22823 int8_tArray  __attribute__((export_name("TS_ChannelConfig_write"))) TS_ChannelConfig_write(uint64_t obj) {
22824         LDKChannelConfig obj_conv;
22825         obj_conv.inner = untag_ptr(obj);
22826         obj_conv.is_owned = ptr_is_owned(obj);
22827         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
22828         obj_conv.is_owned = false;
22829         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
22830         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
22831         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
22832         CVec_u8Z_free(ret_var);
22833         return ret_arr;
22834 }
22835
22836 uint64_t  __attribute__((export_name("TS_ChannelConfig_read"))) TS_ChannelConfig_read(int8_tArray ser) {
22837         LDKu8slice ser_ref;
22838         ser_ref.datalen = ser->arr_len;
22839         ser_ref.data = ser->elems;
22840         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
22841         *ret_conv = ChannelConfig_read(ser_ref);
22842         FREE(ser);
22843         return tag_ptr(ret_conv, true);
22844 }
22845
22846 void  __attribute__((export_name("TS_UserConfig_free"))) TS_UserConfig_free(uint64_t this_obj) {
22847         LDKUserConfig this_obj_conv;
22848         this_obj_conv.inner = untag_ptr(this_obj);
22849         this_obj_conv.is_owned = ptr_is_owned(this_obj);
22850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
22851         UserConfig_free(this_obj_conv);
22852 }
22853
22854 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_config"))) TS_UserConfig_get_channel_handshake_config(uint64_t this_ptr) {
22855         LDKUserConfig this_ptr_conv;
22856         this_ptr_conv.inner = untag_ptr(this_ptr);
22857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22859         this_ptr_conv.is_owned = false;
22860         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
22861         uint64_t ret_ref = 0;
22862         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22863         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22864         return ret_ref;
22865 }
22866
22867 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_config"))) TS_UserConfig_set_channel_handshake_config(uint64_t this_ptr, uint64_t val) {
22868         LDKUserConfig this_ptr_conv;
22869         this_ptr_conv.inner = untag_ptr(this_ptr);
22870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22872         this_ptr_conv.is_owned = false;
22873         LDKChannelHandshakeConfig val_conv;
22874         val_conv.inner = untag_ptr(val);
22875         val_conv.is_owned = ptr_is_owned(val);
22876         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
22877         val_conv = ChannelHandshakeConfig_clone(&val_conv);
22878         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
22879 }
22880
22881 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_limits"))) TS_UserConfig_get_channel_handshake_limits(uint64_t this_ptr) {
22882         LDKUserConfig this_ptr_conv;
22883         this_ptr_conv.inner = untag_ptr(this_ptr);
22884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22886         this_ptr_conv.is_owned = false;
22887         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
22888         uint64_t ret_ref = 0;
22889         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22890         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22891         return ret_ref;
22892 }
22893
22894 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_limits"))) TS_UserConfig_set_channel_handshake_limits(uint64_t this_ptr, uint64_t val) {
22895         LDKUserConfig this_ptr_conv;
22896         this_ptr_conv.inner = untag_ptr(this_ptr);
22897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22899         this_ptr_conv.is_owned = false;
22900         LDKChannelHandshakeLimits val_conv;
22901         val_conv.inner = untag_ptr(val);
22902         val_conv.is_owned = ptr_is_owned(val);
22903         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
22904         val_conv = ChannelHandshakeLimits_clone(&val_conv);
22905         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
22906 }
22907
22908 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_config"))) TS_UserConfig_get_channel_config(uint64_t this_ptr) {
22909         LDKUserConfig this_ptr_conv;
22910         this_ptr_conv.inner = untag_ptr(this_ptr);
22911         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22913         this_ptr_conv.is_owned = false;
22914         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
22915         uint64_t ret_ref = 0;
22916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22918         return ret_ref;
22919 }
22920
22921 void  __attribute__((export_name("TS_UserConfig_set_channel_config"))) TS_UserConfig_set_channel_config(uint64_t this_ptr, uint64_t val) {
22922         LDKUserConfig this_ptr_conv;
22923         this_ptr_conv.inner = untag_ptr(this_ptr);
22924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22926         this_ptr_conv.is_owned = false;
22927         LDKChannelConfig val_conv;
22928         val_conv.inner = untag_ptr(val);
22929         val_conv.is_owned = ptr_is_owned(val);
22930         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
22931         val_conv = ChannelConfig_clone(&val_conv);
22932         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
22933 }
22934
22935 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_forwards_to_priv_channels"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint64_t this_ptr) {
22936         LDKUserConfig this_ptr_conv;
22937         this_ptr_conv.inner = untag_ptr(this_ptr);
22938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22940         this_ptr_conv.is_owned = false;
22941         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
22942         return ret_conv;
22943 }
22944
22945 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) {
22946         LDKUserConfig 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         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
22952 }
22953
22954 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_inbound_channels"))) TS_UserConfig_get_accept_inbound_channels(uint64_t this_ptr) {
22955         LDKUserConfig this_ptr_conv;
22956         this_ptr_conv.inner = untag_ptr(this_ptr);
22957         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22959         this_ptr_conv.is_owned = false;
22960         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
22961         return ret_conv;
22962 }
22963
22964 void  __attribute__((export_name("TS_UserConfig_set_accept_inbound_channels"))) TS_UserConfig_set_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
22965         LDKUserConfig this_ptr_conv;
22966         this_ptr_conv.inner = untag_ptr(this_ptr);
22967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22969         this_ptr_conv.is_owned = false;
22970         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
22971 }
22972
22973 jboolean  __attribute__((export_name("TS_UserConfig_get_manually_accept_inbound_channels"))) TS_UserConfig_get_manually_accept_inbound_channels(uint64_t this_ptr) {
22974         LDKUserConfig this_ptr_conv;
22975         this_ptr_conv.inner = untag_ptr(this_ptr);
22976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22978         this_ptr_conv.is_owned = false;
22979         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
22980         return ret_conv;
22981 }
22982
22983 void  __attribute__((export_name("TS_UserConfig_set_manually_accept_inbound_channels"))) TS_UserConfig_set_manually_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
22984         LDKUserConfig this_ptr_conv;
22985         this_ptr_conv.inner = untag_ptr(this_ptr);
22986         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
22987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
22988         this_ptr_conv.is_owned = false;
22989         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
22990 }
22991
22992 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) {
22993         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
22994         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
22995         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
22996         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
22997         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
22998         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
22999         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
23000         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
23001         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
23002         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
23003         LDKChannelConfig channel_config_arg_conv;
23004         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
23005         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
23006         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
23007         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
23008         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);
23009         uint64_t ret_ref = 0;
23010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23012         return ret_ref;
23013 }
23014
23015 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
23016         LDKUserConfig ret_var = UserConfig_clone(arg);
23017         uint64_t ret_ref = 0;
23018         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23019         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23020         return ret_ref;
23021 }
23022 int64_t  __attribute__((export_name("TS_UserConfig_clone_ptr"))) TS_UserConfig_clone_ptr(uint64_t arg) {
23023         LDKUserConfig arg_conv;
23024         arg_conv.inner = untag_ptr(arg);
23025         arg_conv.is_owned = ptr_is_owned(arg);
23026         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23027         arg_conv.is_owned = false;
23028         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
23029         return ret_conv;
23030 }
23031
23032 uint64_t  __attribute__((export_name("TS_UserConfig_clone"))) TS_UserConfig_clone(uint64_t orig) {
23033         LDKUserConfig orig_conv;
23034         orig_conv.inner = untag_ptr(orig);
23035         orig_conv.is_owned = ptr_is_owned(orig);
23036         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23037         orig_conv.is_owned = false;
23038         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
23039         uint64_t ret_ref = 0;
23040         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23041         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23042         return ret_ref;
23043 }
23044
23045 uint64_t  __attribute__((export_name("TS_UserConfig_default"))) TS_UserConfig_default() {
23046         LDKUserConfig ret_var = UserConfig_default();
23047         uint64_t ret_ref = 0;
23048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23050         return ret_ref;
23051 }
23052
23053 void  __attribute__((export_name("TS_BestBlock_free"))) TS_BestBlock_free(uint64_t this_obj) {
23054         LDKBestBlock this_obj_conv;
23055         this_obj_conv.inner = untag_ptr(this_obj);
23056         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23058         BestBlock_free(this_obj_conv);
23059 }
23060
23061 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
23062         LDKBestBlock ret_var = BestBlock_clone(arg);
23063         uint64_t ret_ref = 0;
23064         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23065         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23066         return ret_ref;
23067 }
23068 int64_t  __attribute__((export_name("TS_BestBlock_clone_ptr"))) TS_BestBlock_clone_ptr(uint64_t arg) {
23069         LDKBestBlock arg_conv;
23070         arg_conv.inner = untag_ptr(arg);
23071         arg_conv.is_owned = ptr_is_owned(arg);
23072         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23073         arg_conv.is_owned = false;
23074         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
23075         return ret_conv;
23076 }
23077
23078 uint64_t  __attribute__((export_name("TS_BestBlock_clone"))) TS_BestBlock_clone(uint64_t orig) {
23079         LDKBestBlock orig_conv;
23080         orig_conv.inner = untag_ptr(orig);
23081         orig_conv.is_owned = ptr_is_owned(orig);
23082         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23083         orig_conv.is_owned = false;
23084         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
23085         uint64_t ret_ref = 0;
23086         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23087         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23088         return ret_ref;
23089 }
23090
23091 uint64_t  __attribute__((export_name("TS_BestBlock_from_genesis"))) TS_BestBlock_from_genesis(uint32_t network) {
23092         LDKNetwork network_conv = LDKNetwork_from_js(network);
23093         LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
23094         uint64_t ret_ref = 0;
23095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23097         return ret_ref;
23098 }
23099
23100 uint64_t  __attribute__((export_name("TS_BestBlock_new"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
23101         LDKThirtyTwoBytes block_hash_ref;
23102         CHECK(block_hash->arr_len == 32);
23103         memcpy(block_hash_ref.data, block_hash->elems, 32); FREE(block_hash);
23104         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
23105         uint64_t ret_ref = 0;
23106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23108         return ret_ref;
23109 }
23110
23111 int8_tArray  __attribute__((export_name("TS_BestBlock_block_hash"))) TS_BestBlock_block_hash(uint64_t this_arg) {
23112         LDKBestBlock this_arg_conv;
23113         this_arg_conv.inner = untag_ptr(this_arg);
23114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23116         this_arg_conv.is_owned = false;
23117         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23118         memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
23119         return ret_arr;
23120 }
23121
23122 int32_t  __attribute__((export_name("TS_BestBlock_height"))) TS_BestBlock_height(uint64_t this_arg) {
23123         LDKBestBlock this_arg_conv;
23124         this_arg_conv.inner = untag_ptr(this_arg);
23125         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23127         this_arg_conv.is_owned = false;
23128         int32_t ret_conv = BestBlock_height(&this_arg_conv);
23129         return ret_conv;
23130 }
23131
23132 uint32_t  __attribute__((export_name("TS_AccessError_clone"))) TS_AccessError_clone(uint64_t orig) {
23133         LDKAccessError* orig_conv = (LDKAccessError*)untag_ptr(orig);
23134         uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv));
23135         return ret_conv;
23136 }
23137
23138 uint32_t  __attribute__((export_name("TS_AccessError_unknown_chain"))) TS_AccessError_unknown_chain() {
23139         uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_chain());
23140         return ret_conv;
23141 }
23142
23143 uint32_t  __attribute__((export_name("TS_AccessError_unknown_tx"))) TS_AccessError_unknown_tx() {
23144         uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_tx());
23145         return ret_conv;
23146 }
23147
23148 void  __attribute__((export_name("TS_Access_free"))) TS_Access_free(uint64_t this_ptr) {
23149         if (!ptr_is_owned(this_ptr)) return;
23150         void* this_ptr_ptr = untag_ptr(this_ptr);
23151         CHECK_ACCESS(this_ptr_ptr);
23152         LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr);
23153         FREE(untag_ptr(this_ptr));
23154         Access_free(this_ptr_conv);
23155 }
23156
23157 void  __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint64_t this_ptr) {
23158         if (!ptr_is_owned(this_ptr)) return;
23159         void* this_ptr_ptr = untag_ptr(this_ptr);
23160         CHECK_ACCESS(this_ptr_ptr);
23161         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
23162         FREE(untag_ptr(this_ptr));
23163         Listen_free(this_ptr_conv);
23164 }
23165
23166 void  __attribute__((export_name("TS_Confirm_free"))) TS_Confirm_free(uint64_t this_ptr) {
23167         if (!ptr_is_owned(this_ptr)) return;
23168         void* this_ptr_ptr = untag_ptr(this_ptr);
23169         CHECK_ACCESS(this_ptr_ptr);
23170         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
23171         FREE(untag_ptr(this_ptr));
23172         Confirm_free(this_ptr_conv);
23173 }
23174
23175 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateErr_clone"))) TS_ChannelMonitorUpdateErr_clone(uint64_t orig) {
23176         LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)untag_ptr(orig);
23177         uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv));
23178         return ret_conv;
23179 }
23180
23181 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateErr_temporary_failure"))) TS_ChannelMonitorUpdateErr_temporary_failure() {
23182         uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_temporary_failure());
23183         return ret_conv;
23184 }
23185
23186 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateErr_permanent_failure"))) TS_ChannelMonitorUpdateErr_permanent_failure() {
23187         uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_permanent_failure());
23188         return ret_conv;
23189 }
23190
23191 void  __attribute__((export_name("TS_Watch_free"))) TS_Watch_free(uint64_t this_ptr) {
23192         if (!ptr_is_owned(this_ptr)) return;
23193         void* this_ptr_ptr = untag_ptr(this_ptr);
23194         CHECK_ACCESS(this_ptr_ptr);
23195         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
23196         FREE(untag_ptr(this_ptr));
23197         Watch_free(this_ptr_conv);
23198 }
23199
23200 void  __attribute__((export_name("TS_Filter_free"))) TS_Filter_free(uint64_t this_ptr) {
23201         if (!ptr_is_owned(this_ptr)) return;
23202         void* this_ptr_ptr = untag_ptr(this_ptr);
23203         CHECK_ACCESS(this_ptr_ptr);
23204         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
23205         FREE(untag_ptr(this_ptr));
23206         Filter_free(this_ptr_conv);
23207 }
23208
23209 void  __attribute__((export_name("TS_WatchedOutput_free"))) TS_WatchedOutput_free(uint64_t this_obj) {
23210         LDKWatchedOutput this_obj_conv;
23211         this_obj_conv.inner = untag_ptr(this_obj);
23212         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23214         WatchedOutput_free(this_obj_conv);
23215 }
23216
23217 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_block_hash"))) TS_WatchedOutput_get_block_hash(uint64_t this_ptr) {
23218         LDKWatchedOutput this_ptr_conv;
23219         this_ptr_conv.inner = untag_ptr(this_ptr);
23220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23222         this_ptr_conv.is_owned = false;
23223         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
23224         memcpy(ret_arr->elems, WatchedOutput_get_block_hash(&this_ptr_conv).data, 32);
23225         return ret_arr;
23226 }
23227
23228 void  __attribute__((export_name("TS_WatchedOutput_set_block_hash"))) TS_WatchedOutput_set_block_hash(uint64_t this_ptr, int8_tArray val) {
23229         LDKWatchedOutput this_ptr_conv;
23230         this_ptr_conv.inner = untag_ptr(this_ptr);
23231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23233         this_ptr_conv.is_owned = false;
23234         LDKThirtyTwoBytes val_ref;
23235         CHECK(val->arr_len == 32);
23236         memcpy(val_ref.data, val->elems, 32); FREE(val);
23237         WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
23238 }
23239
23240 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_outpoint"))) TS_WatchedOutput_get_outpoint(uint64_t this_ptr) {
23241         LDKWatchedOutput this_ptr_conv;
23242         this_ptr_conv.inner = untag_ptr(this_ptr);
23243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23245         this_ptr_conv.is_owned = false;
23246         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
23247         uint64_t ret_ref = 0;
23248         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23249         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23250         return ret_ref;
23251 }
23252
23253 void  __attribute__((export_name("TS_WatchedOutput_set_outpoint"))) TS_WatchedOutput_set_outpoint(uint64_t this_ptr, uint64_t val) {
23254         LDKWatchedOutput this_ptr_conv;
23255         this_ptr_conv.inner = untag_ptr(this_ptr);
23256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23258         this_ptr_conv.is_owned = false;
23259         LDKOutPoint val_conv;
23260         val_conv.inner = untag_ptr(val);
23261         val_conv.is_owned = ptr_is_owned(val);
23262         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
23263         val_conv = OutPoint_clone(&val_conv);
23264         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
23265 }
23266
23267 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_script_pubkey"))) TS_WatchedOutput_get_script_pubkey(uint64_t this_ptr) {
23268         LDKWatchedOutput this_ptr_conv;
23269         this_ptr_conv.inner = untag_ptr(this_ptr);
23270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23272         this_ptr_conv.is_owned = false;
23273         LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
23274         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23275         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23276         return ret_arr;
23277 }
23278
23279 void  __attribute__((export_name("TS_WatchedOutput_set_script_pubkey"))) TS_WatchedOutput_set_script_pubkey(uint64_t this_ptr, int8_tArray val) {
23280         LDKWatchedOutput this_ptr_conv;
23281         this_ptr_conv.inner = untag_ptr(this_ptr);
23282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23284         this_ptr_conv.is_owned = false;
23285         LDKCVec_u8Z val_ref;
23286         val_ref.datalen = val->arr_len;
23287         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
23288         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
23289         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
23290 }
23291
23292 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) {
23293         LDKThirtyTwoBytes block_hash_arg_ref;
23294         CHECK(block_hash_arg->arr_len == 32);
23295         memcpy(block_hash_arg_ref.data, block_hash_arg->elems, 32); FREE(block_hash_arg);
23296         LDKOutPoint outpoint_arg_conv;
23297         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
23298         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
23299         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
23300         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
23301         LDKCVec_u8Z script_pubkey_arg_ref;
23302         script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
23303         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
23304         memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
23305         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
23306         uint64_t ret_ref = 0;
23307         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23308         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23309         return ret_ref;
23310 }
23311
23312 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
23313         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
23314         uint64_t ret_ref = 0;
23315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23317         return ret_ref;
23318 }
23319 int64_t  __attribute__((export_name("TS_WatchedOutput_clone_ptr"))) TS_WatchedOutput_clone_ptr(uint64_t arg) {
23320         LDKWatchedOutput arg_conv;
23321         arg_conv.inner = untag_ptr(arg);
23322         arg_conv.is_owned = ptr_is_owned(arg);
23323         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23324         arg_conv.is_owned = false;
23325         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
23326         return ret_conv;
23327 }
23328
23329 uint64_t  __attribute__((export_name("TS_WatchedOutput_clone"))) TS_WatchedOutput_clone(uint64_t orig) {
23330         LDKWatchedOutput orig_conv;
23331         orig_conv.inner = untag_ptr(orig);
23332         orig_conv.is_owned = ptr_is_owned(orig);
23333         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23334         orig_conv.is_owned = false;
23335         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
23336         uint64_t ret_ref = 0;
23337         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23338         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23339         return ret_ref;
23340 }
23341
23342 int64_t  __attribute__((export_name("TS_WatchedOutput_hash"))) TS_WatchedOutput_hash(uint64_t o) {
23343         LDKWatchedOutput o_conv;
23344         o_conv.inner = untag_ptr(o);
23345         o_conv.is_owned = ptr_is_owned(o);
23346         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23347         o_conv.is_owned = false;
23348         int64_t ret_conv = WatchedOutput_hash(&o_conv);
23349         return ret_conv;
23350 }
23351
23352 void  __attribute__((export_name("TS_BroadcasterInterface_free"))) TS_BroadcasterInterface_free(uint64_t this_ptr) {
23353         if (!ptr_is_owned(this_ptr)) return;
23354         void* this_ptr_ptr = untag_ptr(this_ptr);
23355         CHECK_ACCESS(this_ptr_ptr);
23356         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
23357         FREE(untag_ptr(this_ptr));
23358         BroadcasterInterface_free(this_ptr_conv);
23359 }
23360
23361 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_clone"))) TS_ConfirmationTarget_clone(uint64_t orig) {
23362         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
23363         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
23364         return ret_conv;
23365 }
23366
23367 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_background"))) TS_ConfirmationTarget_background() {
23368         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
23369         return ret_conv;
23370 }
23371
23372 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_normal"))) TS_ConfirmationTarget_normal() {
23373         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
23374         return ret_conv;
23375 }
23376
23377 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_high_priority"))) TS_ConfirmationTarget_high_priority() {
23378         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
23379         return ret_conv;
23380 }
23381
23382 jboolean  __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint64_t a, uint64_t b) {
23383         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
23384         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
23385         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
23386         return ret_conv;
23387 }
23388
23389 void  __attribute__((export_name("TS_FeeEstimator_free"))) TS_FeeEstimator_free(uint64_t this_ptr) {
23390         if (!ptr_is_owned(this_ptr)) return;
23391         void* this_ptr_ptr = untag_ptr(this_ptr);
23392         CHECK_ACCESS(this_ptr_ptr);
23393         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
23394         FREE(untag_ptr(this_ptr));
23395         FeeEstimator_free(this_ptr_conv);
23396 }
23397
23398 void  __attribute__((export_name("TS_MonitorUpdateId_free"))) TS_MonitorUpdateId_free(uint64_t this_obj) {
23399         LDKMonitorUpdateId this_obj_conv;
23400         this_obj_conv.inner = untag_ptr(this_obj);
23401         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23403         MonitorUpdateId_free(this_obj_conv);
23404 }
23405
23406 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
23407         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
23408         uint64_t ret_ref = 0;
23409         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23410         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23411         return ret_ref;
23412 }
23413 int64_t  __attribute__((export_name("TS_MonitorUpdateId_clone_ptr"))) TS_MonitorUpdateId_clone_ptr(uint64_t arg) {
23414         LDKMonitorUpdateId arg_conv;
23415         arg_conv.inner = untag_ptr(arg);
23416         arg_conv.is_owned = ptr_is_owned(arg);
23417         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23418         arg_conv.is_owned = false;
23419         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
23420         return ret_conv;
23421 }
23422
23423 uint64_t  __attribute__((export_name("TS_MonitorUpdateId_clone"))) TS_MonitorUpdateId_clone(uint64_t orig) {
23424         LDKMonitorUpdateId orig_conv;
23425         orig_conv.inner = untag_ptr(orig);
23426         orig_conv.is_owned = ptr_is_owned(orig);
23427         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23428         orig_conv.is_owned = false;
23429         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
23430         uint64_t ret_ref = 0;
23431         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23432         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23433         return ret_ref;
23434 }
23435
23436 int64_t  __attribute__((export_name("TS_MonitorUpdateId_hash"))) TS_MonitorUpdateId_hash(uint64_t o) {
23437         LDKMonitorUpdateId o_conv;
23438         o_conv.inner = untag_ptr(o);
23439         o_conv.is_owned = ptr_is_owned(o);
23440         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23441         o_conv.is_owned = false;
23442         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
23443         return ret_conv;
23444 }
23445
23446 jboolean  __attribute__((export_name("TS_MonitorUpdateId_eq"))) TS_MonitorUpdateId_eq(uint64_t a, uint64_t b) {
23447         LDKMonitorUpdateId a_conv;
23448         a_conv.inner = untag_ptr(a);
23449         a_conv.is_owned = ptr_is_owned(a);
23450         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23451         a_conv.is_owned = false;
23452         LDKMonitorUpdateId b_conv;
23453         b_conv.inner = untag_ptr(b);
23454         b_conv.is_owned = ptr_is_owned(b);
23455         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
23456         b_conv.is_owned = false;
23457         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
23458         return ret_conv;
23459 }
23460
23461 void  __attribute__((export_name("TS_Persist_free"))) TS_Persist_free(uint64_t this_ptr) {
23462         if (!ptr_is_owned(this_ptr)) return;
23463         void* this_ptr_ptr = untag_ptr(this_ptr);
23464         CHECK_ACCESS(this_ptr_ptr);
23465         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
23466         FREE(untag_ptr(this_ptr));
23467         Persist_free(this_ptr_conv);
23468 }
23469
23470 void  __attribute__((export_name("TS_LockedChannelMonitor_free"))) TS_LockedChannelMonitor_free(uint64_t this_obj) {
23471         LDKLockedChannelMonitor this_obj_conv;
23472         this_obj_conv.inner = untag_ptr(this_obj);
23473         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23475         LockedChannelMonitor_free(this_obj_conv);
23476 }
23477
23478 void  __attribute__((export_name("TS_ChainMonitor_free"))) TS_ChainMonitor_free(uint64_t this_obj) {
23479         LDKChainMonitor this_obj_conv;
23480         this_obj_conv.inner = untag_ptr(this_obj);
23481         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23483         ChainMonitor_free(this_obj_conv);
23484 }
23485
23486 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) {
23487         void* chain_source_ptr = untag_ptr(chain_source);
23488         CHECK_ACCESS(chain_source_ptr);
23489         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
23490         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
23491         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
23492                 // Manually implement clone for Java trait instances
23493                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
23494                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23495                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
23496                 }
23497         }
23498         void* broadcaster_ptr = untag_ptr(broadcaster);
23499         CHECK_ACCESS(broadcaster_ptr);
23500         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
23501         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
23502                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23503                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
23504         }
23505         void* logger_ptr = untag_ptr(logger);
23506         CHECK_ACCESS(logger_ptr);
23507         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
23508         if (logger_conv.free == LDKLogger_JCalls_free) {
23509                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23510                 LDKLogger_JCalls_cloned(&logger_conv);
23511         }
23512         void* feeest_ptr = untag_ptr(feeest);
23513         CHECK_ACCESS(feeest_ptr);
23514         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
23515         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
23516                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23517                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
23518         }
23519         void* persister_ptr = untag_ptr(persister);
23520         CHECK_ACCESS(persister_ptr);
23521         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
23522         if (persister_conv.free == LDKPersist_JCalls_free) {
23523                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23524                 LDKPersist_JCalls_cloned(&persister_conv);
23525         }
23526         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
23527         uint64_t ret_ref = 0;
23528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23530         return ret_ref;
23531 }
23532
23533 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_get_claimable_balances"))) TS_ChainMonitor_get_claimable_balances(uint64_t this_arg, uint64_tArray ignored_channels) {
23534         LDKChainMonitor this_arg_conv;
23535         this_arg_conv.inner = untag_ptr(this_arg);
23536         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23538         this_arg_conv.is_owned = false;
23539         LDKCVec_ChannelDetailsZ ignored_channels_constr;
23540         ignored_channels_constr.datalen = ignored_channels->arr_len;
23541         if (ignored_channels_constr.datalen > 0)
23542                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
23543         else
23544                 ignored_channels_constr.data = NULL;
23545         uint64_t* ignored_channels_vals = ignored_channels->elems;
23546         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
23547                 uint64_t ignored_channels_conv_16 = ignored_channels_vals[q];
23548                 LDKChannelDetails ignored_channels_conv_16_conv;
23549                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
23550                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
23551                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
23552                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
23553                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
23554         }
23555         FREE(ignored_channels);
23556         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
23557         uint64_tArray ret_arr = NULL;
23558         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
23559         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
23560         for (size_t j = 0; j < ret_var.datalen; j++) {
23561                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23562                 *ret_conv_9_copy = ret_var.data[j];
23563                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
23564                 ret_arr_ptr[j] = ret_conv_9_ref;
23565         }
23566         
23567         FREE(ret_var.data);
23568         return ret_arr;
23569 }
23570
23571 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_monitor"))) TS_ChainMonitor_get_monitor(uint64_t this_arg, uint64_t funding_txo) {
23572         LDKChainMonitor this_arg_conv;
23573         this_arg_conv.inner = untag_ptr(this_arg);
23574         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23576         this_arg_conv.is_owned = false;
23577         LDKOutPoint funding_txo_conv;
23578         funding_txo_conv.inner = untag_ptr(funding_txo);
23579         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
23580         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
23581         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
23582         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
23583         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
23584         return tag_ptr(ret_conv, true);
23585 }
23586
23587 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ChainMonitor_list_monitors(uint64_t this_arg) {
23588         LDKChainMonitor this_arg_conv;
23589         this_arg_conv.inner = untag_ptr(this_arg);
23590         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23592         this_arg_conv.is_owned = false;
23593         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
23594         uint64_tArray ret_arr = NULL;
23595         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
23596         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
23597         for (size_t k = 0; k < ret_var.datalen; k++) {
23598                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
23599                 uint64_t ret_conv_10_ref = 0;
23600                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
23601                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
23602                 ret_arr_ptr[k] = ret_conv_10_ref;
23603         }
23604         
23605         FREE(ret_var.data);
23606         return ret_arr;
23607 }
23608
23609 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) {
23610         LDKChainMonitor this_arg_conv;
23611         this_arg_conv.inner = untag_ptr(this_arg);
23612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23614         this_arg_conv.is_owned = false;
23615         LDKOutPoint funding_txo_conv;
23616         funding_txo_conv.inner = untag_ptr(funding_txo);
23617         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
23618         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
23619         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
23620         LDKMonitorUpdateId completed_update_id_conv;
23621         completed_update_id_conv.inner = untag_ptr(completed_update_id);
23622         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
23623         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
23624         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
23625         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
23626         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
23627         return tag_ptr(ret_conv, true);
23628 }
23629
23630 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Listen"))) TS_ChainMonitor_as_Listen(uint64_t this_arg) {
23631         LDKChainMonitor this_arg_conv;
23632         this_arg_conv.inner = untag_ptr(this_arg);
23633         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23635         this_arg_conv.is_owned = false;
23636         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
23637         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
23638         return tag_ptr(ret_ret, true);
23639 }
23640
23641 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Confirm"))) TS_ChainMonitor_as_Confirm(uint64_t this_arg) {
23642         LDKChainMonitor this_arg_conv;
23643         this_arg_conv.inner = untag_ptr(this_arg);
23644         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23646         this_arg_conv.is_owned = false;
23647         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
23648         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
23649         return tag_ptr(ret_ret, true);
23650 }
23651
23652 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Watch"))) TS_ChainMonitor_as_Watch(uint64_t this_arg) {
23653         LDKChainMonitor this_arg_conv;
23654         this_arg_conv.inner = untag_ptr(this_arg);
23655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23657         this_arg_conv.is_owned = false;
23658         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
23659         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
23660         return tag_ptr(ret_ret, true);
23661 }
23662
23663 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_EventsProvider"))) TS_ChainMonitor_as_EventsProvider(uint64_t this_arg) {
23664         LDKChainMonitor this_arg_conv;
23665         this_arg_conv.inner = untag_ptr(this_arg);
23666         this_arg_conv.is_owned = ptr_is_owned(this_arg);
23667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
23668         this_arg_conv.is_owned = false;
23669         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
23670         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
23671         return tag_ptr(ret_ret, true);
23672 }
23673
23674 void  __attribute__((export_name("TS_ChannelMonitorUpdate_free"))) TS_ChannelMonitorUpdate_free(uint64_t this_obj) {
23675         LDKChannelMonitorUpdate this_obj_conv;
23676         this_obj_conv.inner = untag_ptr(this_obj);
23677         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23679         ChannelMonitorUpdate_free(this_obj_conv);
23680 }
23681
23682 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_get_update_id"))) TS_ChannelMonitorUpdate_get_update_id(uint64_t this_ptr) {
23683         LDKChannelMonitorUpdate this_ptr_conv;
23684         this_ptr_conv.inner = untag_ptr(this_ptr);
23685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
23686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
23687         this_ptr_conv.is_owned = false;
23688         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
23689         return ret_conv;
23690 }
23691
23692 void  __attribute__((export_name("TS_ChannelMonitorUpdate_set_update_id"))) TS_ChannelMonitorUpdate_set_update_id(uint64_t this_ptr, int64_t val) {
23693         LDKChannelMonitorUpdate 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         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
23699 }
23700
23701 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
23702         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
23703         uint64_t ret_ref = 0;
23704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23706         return ret_ref;
23707 }
23708 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone_ptr"))) TS_ChannelMonitorUpdate_clone_ptr(uint64_t arg) {
23709         LDKChannelMonitorUpdate arg_conv;
23710         arg_conv.inner = untag_ptr(arg);
23711         arg_conv.is_owned = ptr_is_owned(arg);
23712         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23713         arg_conv.is_owned = false;
23714         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
23715         return ret_conv;
23716 }
23717
23718 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone"))) TS_ChannelMonitorUpdate_clone(uint64_t orig) {
23719         LDKChannelMonitorUpdate orig_conv;
23720         orig_conv.inner = untag_ptr(orig);
23721         orig_conv.is_owned = ptr_is_owned(orig);
23722         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23723         orig_conv.is_owned = false;
23724         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
23725         uint64_t ret_ref = 0;
23726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23728         return ret_ref;
23729 }
23730
23731 int8_tArray  __attribute__((export_name("TS_ChannelMonitorUpdate_write"))) TS_ChannelMonitorUpdate_write(uint64_t obj) {
23732         LDKChannelMonitorUpdate obj_conv;
23733         obj_conv.inner = untag_ptr(obj);
23734         obj_conv.is_owned = ptr_is_owned(obj);
23735         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23736         obj_conv.is_owned = false;
23737         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
23738         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23739         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23740         CVec_u8Z_free(ret_var);
23741         return ret_arr;
23742 }
23743
23744 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_read"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
23745         LDKu8slice ser_ref;
23746         ser_ref.datalen = ser->arr_len;
23747         ser_ref.data = ser->elems;
23748         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
23749         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
23750         FREE(ser);
23751         return tag_ptr(ret_conv, true);
23752 }
23753
23754 void  __attribute__((export_name("TS_MonitorEvent_free"))) TS_MonitorEvent_free(uint64_t this_ptr) {
23755         if (!ptr_is_owned(this_ptr)) return;
23756         void* this_ptr_ptr = untag_ptr(this_ptr);
23757         CHECK_ACCESS(this_ptr_ptr);
23758         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
23759         FREE(untag_ptr(this_ptr));
23760         MonitorEvent_free(this_ptr_conv);
23761 }
23762
23763 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
23764         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
23765         *ret_copy = MonitorEvent_clone(arg);
23766         uint64_t ret_ref = tag_ptr(ret_copy, true);
23767         return ret_ref;
23768 }
23769 int64_t  __attribute__((export_name("TS_MonitorEvent_clone_ptr"))) TS_MonitorEvent_clone_ptr(uint64_t arg) {
23770         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
23771         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
23772         return ret_conv;
23773 }
23774
23775 uint64_t  __attribute__((export_name("TS_MonitorEvent_clone"))) TS_MonitorEvent_clone(uint64_t orig) {
23776         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
23777         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
23778         *ret_copy = MonitorEvent_clone(orig_conv);
23779         uint64_t ret_ref = tag_ptr(ret_copy, true);
23780         return ret_ref;
23781 }
23782
23783 uint64_t  __attribute__((export_name("TS_MonitorEvent_htlcevent"))) TS_MonitorEvent_htlcevent(uint64_t a) {
23784         LDKHTLCUpdate a_conv;
23785         a_conv.inner = untag_ptr(a);
23786         a_conv.is_owned = ptr_is_owned(a);
23787         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23788         a_conv = HTLCUpdate_clone(&a_conv);
23789         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
23790         *ret_copy = MonitorEvent_htlcevent(a_conv);
23791         uint64_t ret_ref = tag_ptr(ret_copy, true);
23792         return ret_ref;
23793 }
23794
23795 uint64_t  __attribute__((export_name("TS_MonitorEvent_commitment_tx_confirmed"))) TS_MonitorEvent_commitment_tx_confirmed(uint64_t a) {
23796         LDKOutPoint a_conv;
23797         a_conv.inner = untag_ptr(a);
23798         a_conv.is_owned = ptr_is_owned(a);
23799         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23800         a_conv = OutPoint_clone(&a_conv);
23801         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
23802         *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
23803         uint64_t ret_ref = tag_ptr(ret_copy, true);
23804         return ret_ref;
23805 }
23806
23807 uint64_t  __attribute__((export_name("TS_MonitorEvent_update_completed"))) TS_MonitorEvent_update_completed(uint64_t funding_txo, int64_t monitor_update_id) {
23808         LDKOutPoint funding_txo_conv;
23809         funding_txo_conv.inner = untag_ptr(funding_txo);
23810         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
23811         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
23812         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
23813         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
23814         *ret_copy = MonitorEvent_update_completed(funding_txo_conv, monitor_update_id);
23815         uint64_t ret_ref = tag_ptr(ret_copy, true);
23816         return ret_ref;
23817 }
23818
23819 uint64_t  __attribute__((export_name("TS_MonitorEvent_update_failed"))) TS_MonitorEvent_update_failed(uint64_t a) {
23820         LDKOutPoint a_conv;
23821         a_conv.inner = untag_ptr(a);
23822         a_conv.is_owned = ptr_is_owned(a);
23823         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
23824         a_conv = OutPoint_clone(&a_conv);
23825         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
23826         *ret_copy = MonitorEvent_update_failed(a_conv);
23827         uint64_t ret_ref = tag_ptr(ret_copy, true);
23828         return ret_ref;
23829 }
23830
23831 int8_tArray  __attribute__((export_name("TS_MonitorEvent_write"))) TS_MonitorEvent_write(uint64_t obj) {
23832         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
23833         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
23834         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23835         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23836         CVec_u8Z_free(ret_var);
23837         return ret_arr;
23838 }
23839
23840 uint64_t  __attribute__((export_name("TS_MonitorEvent_read"))) TS_MonitorEvent_read(int8_tArray ser) {
23841         LDKu8slice ser_ref;
23842         ser_ref.datalen = ser->arr_len;
23843         ser_ref.data = ser->elems;
23844         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
23845         *ret_conv = MonitorEvent_read(ser_ref);
23846         FREE(ser);
23847         return tag_ptr(ret_conv, true);
23848 }
23849
23850 void  __attribute__((export_name("TS_HTLCUpdate_free"))) TS_HTLCUpdate_free(uint64_t this_obj) {
23851         LDKHTLCUpdate this_obj_conv;
23852         this_obj_conv.inner = untag_ptr(this_obj);
23853         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23855         HTLCUpdate_free(this_obj_conv);
23856 }
23857
23858 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
23859         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
23860         uint64_t ret_ref = 0;
23861         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23862         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23863         return ret_ref;
23864 }
23865 int64_t  __attribute__((export_name("TS_HTLCUpdate_clone_ptr"))) TS_HTLCUpdate_clone_ptr(uint64_t arg) {
23866         LDKHTLCUpdate arg_conv;
23867         arg_conv.inner = untag_ptr(arg);
23868         arg_conv.is_owned = ptr_is_owned(arg);
23869         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
23870         arg_conv.is_owned = false;
23871         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
23872         return ret_conv;
23873 }
23874
23875 uint64_t  __attribute__((export_name("TS_HTLCUpdate_clone"))) TS_HTLCUpdate_clone(uint64_t orig) {
23876         LDKHTLCUpdate orig_conv;
23877         orig_conv.inner = untag_ptr(orig);
23878         orig_conv.is_owned = ptr_is_owned(orig);
23879         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
23880         orig_conv.is_owned = false;
23881         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
23882         uint64_t ret_ref = 0;
23883         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
23884         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
23885         return ret_ref;
23886 }
23887
23888 int8_tArray  __attribute__((export_name("TS_HTLCUpdate_write"))) TS_HTLCUpdate_write(uint64_t obj) {
23889         LDKHTLCUpdate obj_conv;
23890         obj_conv.inner = untag_ptr(obj);
23891         obj_conv.is_owned = ptr_is_owned(obj);
23892         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
23893         obj_conv.is_owned = false;
23894         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
23895         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
23896         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
23897         CVec_u8Z_free(ret_var);
23898         return ret_arr;
23899 }
23900
23901 uint64_t  __attribute__((export_name("TS_HTLCUpdate_read"))) TS_HTLCUpdate_read(int8_tArray ser) {
23902         LDKu8slice ser_ref;
23903         ser_ref.datalen = ser->arr_len;
23904         ser_ref.data = ser->elems;
23905         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
23906         *ret_conv = HTLCUpdate_read(ser_ref);
23907         FREE(ser);
23908         return tag_ptr(ret_conv, true);
23909 }
23910
23911 void  __attribute__((export_name("TS_Balance_free"))) TS_Balance_free(uint64_t this_ptr) {
23912         if (!ptr_is_owned(this_ptr)) return;
23913         void* this_ptr_ptr = untag_ptr(this_ptr);
23914         CHECK_ACCESS(this_ptr_ptr);
23915         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
23916         FREE(untag_ptr(this_ptr));
23917         Balance_free(this_ptr_conv);
23918 }
23919
23920 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
23921         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23922         *ret_copy = Balance_clone(arg);
23923         uint64_t ret_ref = tag_ptr(ret_copy, true);
23924         return ret_ref;
23925 }
23926 int64_t  __attribute__((export_name("TS_Balance_clone_ptr"))) TS_Balance_clone_ptr(uint64_t arg) {
23927         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
23928         int64_t ret_conv = Balance_clone_ptr(arg_conv);
23929         return ret_conv;
23930 }
23931
23932 uint64_t  __attribute__((export_name("TS_Balance_clone"))) TS_Balance_clone(uint64_t orig) {
23933         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
23934         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23935         *ret_copy = Balance_clone(orig_conv);
23936         uint64_t ret_ref = tag_ptr(ret_copy, true);
23937         return ret_ref;
23938 }
23939
23940 uint64_t  __attribute__((export_name("TS_Balance_claimable_on_channel_close"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
23941         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23942         *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
23943         uint64_t ret_ref = tag_ptr(ret_copy, true);
23944         return ret_ref;
23945 }
23946
23947 uint64_t  __attribute__((export_name("TS_Balance_claimable_awaiting_confirmations"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
23948         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23949         *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
23950         uint64_t ret_ref = tag_ptr(ret_copy, true);
23951         return ret_ref;
23952 }
23953
23954 uint64_t  __attribute__((export_name("TS_Balance_contentious_claimable"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
23955         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23956         *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
23957         uint64_t ret_ref = tag_ptr(ret_copy, true);
23958         return ret_ref;
23959 }
23960
23961 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) {
23962         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23963         *ret_copy = Balance_maybe_timeout_claimable_htlc(claimable_amount_satoshis, claimable_height);
23964         uint64_t ret_ref = tag_ptr(ret_copy, true);
23965         return ret_ref;
23966 }
23967
23968 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) {
23969         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23970         *ret_copy = Balance_maybe_preimage_claimable_htlc(claimable_amount_satoshis, expiry_height);
23971         uint64_t ret_ref = tag_ptr(ret_copy, true);
23972         return ret_ref;
23973 }
23974
23975 uint64_t  __attribute__((export_name("TS_Balance_counterparty_revoked_output_claimable"))) TS_Balance_counterparty_revoked_output_claimable(int64_t claimable_amount_satoshis) {
23976         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
23977         *ret_copy = Balance_counterparty_revoked_output_claimable(claimable_amount_satoshis);
23978         uint64_t ret_ref = tag_ptr(ret_copy, true);
23979         return ret_ref;
23980 }
23981
23982 jboolean  __attribute__((export_name("TS_Balance_eq"))) TS_Balance_eq(uint64_t a, uint64_t b) {
23983         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
23984         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
23985         jboolean ret_conv = Balance_eq(a_conv, b_conv);
23986         return ret_conv;
23987 }
23988
23989 void  __attribute__((export_name("TS_ChannelMonitor_free"))) TS_ChannelMonitor_free(uint64_t this_obj) {
23990         LDKChannelMonitor this_obj_conv;
23991         this_obj_conv.inner = untag_ptr(this_obj);
23992         this_obj_conv.is_owned = ptr_is_owned(this_obj);
23993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
23994         ChannelMonitor_free(this_obj_conv);
23995 }
23996
23997 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
23998         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
23999         uint64_t ret_ref = 0;
24000         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24001         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24002         return ret_ref;
24003 }
24004 int64_t  __attribute__((export_name("TS_ChannelMonitor_clone_ptr"))) TS_ChannelMonitor_clone_ptr(uint64_t arg) {
24005         LDKChannelMonitor arg_conv;
24006         arg_conv.inner = untag_ptr(arg);
24007         arg_conv.is_owned = ptr_is_owned(arg);
24008         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24009         arg_conv.is_owned = false;
24010         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
24011         return ret_conv;
24012 }
24013
24014 uint64_t  __attribute__((export_name("TS_ChannelMonitor_clone"))) TS_ChannelMonitor_clone(uint64_t orig) {
24015         LDKChannelMonitor orig_conv;
24016         orig_conv.inner = untag_ptr(orig);
24017         orig_conv.is_owned = ptr_is_owned(orig);
24018         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24019         orig_conv.is_owned = false;
24020         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
24021         uint64_t ret_ref = 0;
24022         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24023         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24024         return ret_ref;
24025 }
24026
24027 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_write"))) TS_ChannelMonitor_write(uint64_t obj) {
24028         LDKChannelMonitor obj_conv;
24029         obj_conv.inner = untag_ptr(obj);
24030         obj_conv.is_owned = ptr_is_owned(obj);
24031         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24032         obj_conv.is_owned = false;
24033         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
24034         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24035         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24036         CVec_u8Z_free(ret_var);
24037         return ret_arr;
24038 }
24039
24040 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) {
24041         LDKChannelMonitor this_arg_conv;
24042         this_arg_conv.inner = untag_ptr(this_arg);
24043         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24045         this_arg_conv.is_owned = false;
24046         LDKChannelMonitorUpdate updates_conv;
24047         updates_conv.inner = untag_ptr(updates);
24048         updates_conv.is_owned = ptr_is_owned(updates);
24049         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
24050         updates_conv.is_owned = false;
24051         void* broadcaster_ptr = untag_ptr(broadcaster);
24052         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
24053         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
24054         void* fee_estimator_ptr = untag_ptr(fee_estimator);
24055         CHECK_ACCESS(fee_estimator_ptr);
24056         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24057         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24058                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24059                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24060         }
24061         void* logger_ptr = untag_ptr(logger);
24062         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
24063         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
24064         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
24065         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
24066         return tag_ptr(ret_conv, true);
24067 }
24068
24069 int64_t  __attribute__((export_name("TS_ChannelMonitor_get_latest_update_id"))) TS_ChannelMonitor_get_latest_update_id(uint64_t this_arg) {
24070         LDKChannelMonitor this_arg_conv;
24071         this_arg_conv.inner = untag_ptr(this_arg);
24072         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24074         this_arg_conv.is_owned = false;
24075         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
24076         return ret_conv;
24077 }
24078
24079 uint64_t  __attribute__((export_name("TS_ChannelMonitor_get_funding_txo"))) TS_ChannelMonitor_get_funding_txo(uint64_t this_arg) {
24080         LDKChannelMonitor this_arg_conv;
24081         this_arg_conv.inner = untag_ptr(this_arg);
24082         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24084         this_arg_conv.is_owned = false;
24085         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
24086         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
24087         return tag_ptr(ret_conv, true);
24088 }
24089
24090 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_outputs_to_watch"))) TS_ChannelMonitor_get_outputs_to_watch(uint64_t this_arg) {
24091         LDKChannelMonitor this_arg_conv;
24092         this_arg_conv.inner = untag_ptr(this_arg);
24093         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24095         this_arg_conv.is_owned = false;
24096         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
24097         uint64_tArray ret_arr = NULL;
24098         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24099         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24100         for (size_t o = 0; o < ret_var.datalen; o++) {
24101                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
24102                 *ret_conv_40_conv = ret_var.data[o];
24103                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
24104         }
24105         
24106         FREE(ret_var.data);
24107         return ret_arr;
24108 }
24109
24110 void  __attribute__((export_name("TS_ChannelMonitor_load_outputs_to_watch"))) TS_ChannelMonitor_load_outputs_to_watch(uint64_t this_arg, uint64_t filter) {
24111         LDKChannelMonitor this_arg_conv;
24112         this_arg_conv.inner = untag_ptr(this_arg);
24113         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24115         this_arg_conv.is_owned = false;
24116         void* filter_ptr = untag_ptr(filter);
24117         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
24118         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
24119         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
24120 }
24121
24122 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) {
24123         LDKChannelMonitor this_arg_conv;
24124         this_arg_conv.inner = untag_ptr(this_arg);
24125         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24127         this_arg_conv.is_owned = false;
24128         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
24129         uint64_tArray ret_arr = NULL;
24130         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24131         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24132         for (size_t o = 0; o < ret_var.datalen; o++) {
24133                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
24134                 *ret_conv_14_copy = ret_var.data[o];
24135                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
24136                 ret_arr_ptr[o] = ret_conv_14_ref;
24137         }
24138         
24139         FREE(ret_var.data);
24140         return ret_arr;
24141 }
24142
24143 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_and_clear_pending_events"))) TS_ChannelMonitor_get_and_clear_pending_events(uint64_t this_arg) {
24144         LDKChannelMonitor this_arg_conv;
24145         this_arg_conv.inner = untag_ptr(this_arg);
24146         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24148         this_arg_conv.is_owned = false;
24149         LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
24150         uint64_tArray ret_arr = NULL;
24151         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24152         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24153         for (size_t h = 0; h < ret_var.datalen; h++) {
24154                 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
24155                 *ret_conv_7_copy = ret_var.data[h];
24156                 uint64_t ret_conv_7_ref = tag_ptr(ret_conv_7_copy, true);
24157                 ret_arr_ptr[h] = ret_conv_7_ref;
24158         }
24159         
24160         FREE(ret_var.data);
24161         return ret_arr;
24162 }
24163
24164 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_get_counterparty_node_id"))) TS_ChannelMonitor_get_counterparty_node_id(uint64_t this_arg) {
24165         LDKChannelMonitor this_arg_conv;
24166         this_arg_conv.inner = untag_ptr(this_arg);
24167         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24169         this_arg_conv.is_owned = false;
24170         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
24171         memcpy(ret_arr->elems, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form, 33);
24172         return ret_arr;
24173 }
24174
24175 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) {
24176         LDKChannelMonitor this_arg_conv;
24177         this_arg_conv.inner = untag_ptr(this_arg);
24178         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24180         this_arg_conv.is_owned = false;
24181         void* logger_ptr = untag_ptr(logger);
24182         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
24183         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
24184         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
24185         ptrArray ret_arr = NULL;
24186         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
24187         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
24188         for (size_t m = 0; m < ret_var.datalen; m++) {
24189                 LDKTransaction ret_conv_12_var = ret_var.data[m];
24190                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
24191                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
24192                 Transaction_free(ret_conv_12_var);
24193                 ret_arr_ptr[m] = ret_conv_12_arr;
24194         }
24195         
24196         FREE(ret_var.data);
24197         return ret_arr;
24198 }
24199
24200 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) {
24201         LDKChannelMonitor this_arg_conv;
24202         this_arg_conv.inner = untag_ptr(this_arg);
24203         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24205         this_arg_conv.is_owned = false;
24206         unsigned char header_arr[80];
24207         CHECK(header->arr_len == 80);
24208         memcpy(header_arr, header->elems, 80); FREE(header);
24209         unsigned char (*header_ref)[80] = &header_arr;
24210         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
24211         txdata_constr.datalen = txdata->arr_len;
24212         if (txdata_constr.datalen > 0)
24213                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
24214         else
24215                 txdata_constr.data = NULL;
24216         uint64_t* txdata_vals = txdata->elems;
24217         for (size_t c = 0; c < txdata_constr.datalen; c++) {
24218                 uint64_t txdata_conv_28 = txdata_vals[c];
24219                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
24220                 CHECK_ACCESS(txdata_conv_28_ptr);
24221                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
24222                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
24223                 txdata_constr.data[c] = txdata_conv_28_conv;
24224         }
24225         FREE(txdata);
24226         void* broadcaster_ptr = untag_ptr(broadcaster);
24227         CHECK_ACCESS(broadcaster_ptr);
24228         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24229         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24230                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24231                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24232         }
24233         void* fee_estimator_ptr = untag_ptr(fee_estimator);
24234         CHECK_ACCESS(fee_estimator_ptr);
24235         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24236         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24237                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24238                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24239         }
24240         void* logger_ptr = untag_ptr(logger);
24241         CHECK_ACCESS(logger_ptr);
24242         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24243         if (logger_conv.free == LDKLogger_JCalls_free) {
24244                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24245                 LDKLogger_JCalls_cloned(&logger_conv);
24246         }
24247         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);
24248         uint64_tArray ret_arr = NULL;
24249         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24250         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24251         for (size_t n = 0; n < ret_var.datalen; n++) {
24252                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
24253                 *ret_conv_39_conv = ret_var.data[n];
24254                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
24255         }
24256         
24257         FREE(ret_var.data);
24258         return ret_arr;
24259 }
24260
24261 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) {
24262         LDKChannelMonitor this_arg_conv;
24263         this_arg_conv.inner = untag_ptr(this_arg);
24264         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24266         this_arg_conv.is_owned = false;
24267         unsigned char header_arr[80];
24268         CHECK(header->arr_len == 80);
24269         memcpy(header_arr, header->elems, 80); FREE(header);
24270         unsigned char (*header_ref)[80] = &header_arr;
24271         void* broadcaster_ptr = untag_ptr(broadcaster);
24272         CHECK_ACCESS(broadcaster_ptr);
24273         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24274         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24275                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24276                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24277         }
24278         void* fee_estimator_ptr = untag_ptr(fee_estimator);
24279         CHECK_ACCESS(fee_estimator_ptr);
24280         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24281         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24282                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24283                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24284         }
24285         void* logger_ptr = untag_ptr(logger);
24286         CHECK_ACCESS(logger_ptr);
24287         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24288         if (logger_conv.free == LDKLogger_JCalls_free) {
24289                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24290                 LDKLogger_JCalls_cloned(&logger_conv);
24291         }
24292         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
24293 }
24294
24295 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) {
24296         LDKChannelMonitor this_arg_conv;
24297         this_arg_conv.inner = untag_ptr(this_arg);
24298         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24300         this_arg_conv.is_owned = false;
24301         unsigned char header_arr[80];
24302         CHECK(header->arr_len == 80);
24303         memcpy(header_arr, header->elems, 80); FREE(header);
24304         unsigned char (*header_ref)[80] = &header_arr;
24305         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
24306         txdata_constr.datalen = txdata->arr_len;
24307         if (txdata_constr.datalen > 0)
24308                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
24309         else
24310                 txdata_constr.data = NULL;
24311         uint64_t* txdata_vals = txdata->elems;
24312         for (size_t c = 0; c < txdata_constr.datalen; c++) {
24313                 uint64_t txdata_conv_28 = txdata_vals[c];
24314                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
24315                 CHECK_ACCESS(txdata_conv_28_ptr);
24316                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
24317                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
24318                 txdata_constr.data[c] = txdata_conv_28_conv;
24319         }
24320         FREE(txdata);
24321         void* broadcaster_ptr = untag_ptr(broadcaster);
24322         CHECK_ACCESS(broadcaster_ptr);
24323         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24324         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24325                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24326                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24327         }
24328         void* fee_estimator_ptr = untag_ptr(fee_estimator);
24329         CHECK_ACCESS(fee_estimator_ptr);
24330         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24331         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24332                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24333                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24334         }
24335         void* logger_ptr = untag_ptr(logger);
24336         CHECK_ACCESS(logger_ptr);
24337         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24338         if (logger_conv.free == LDKLogger_JCalls_free) {
24339                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24340                 LDKLogger_JCalls_cloned(&logger_conv);
24341         }
24342         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);
24343         uint64_tArray ret_arr = NULL;
24344         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24345         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24346         for (size_t n = 0; n < ret_var.datalen; n++) {
24347                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
24348                 *ret_conv_39_conv = ret_var.data[n];
24349                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
24350         }
24351         
24352         FREE(ret_var.data);
24353         return ret_arr;
24354 }
24355
24356 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) {
24357         LDKChannelMonitor this_arg_conv;
24358         this_arg_conv.inner = untag_ptr(this_arg);
24359         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24361         this_arg_conv.is_owned = false;
24362         unsigned char txid_arr[32];
24363         CHECK(txid->arr_len == 32);
24364         memcpy(txid_arr, txid->elems, 32); FREE(txid);
24365         unsigned char (*txid_ref)[32] = &txid_arr;
24366         void* broadcaster_ptr = untag_ptr(broadcaster);
24367         CHECK_ACCESS(broadcaster_ptr);
24368         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24369         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24370                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24371                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24372         }
24373         void* fee_estimator_ptr = untag_ptr(fee_estimator);
24374         CHECK_ACCESS(fee_estimator_ptr);
24375         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24376         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24377                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24378                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24379         }
24380         void* logger_ptr = untag_ptr(logger);
24381         CHECK_ACCESS(logger_ptr);
24382         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24383         if (logger_conv.free == LDKLogger_JCalls_free) {
24384                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24385                 LDKLogger_JCalls_cloned(&logger_conv);
24386         }
24387         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
24388 }
24389
24390 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) {
24391         LDKChannelMonitor this_arg_conv;
24392         this_arg_conv.inner = untag_ptr(this_arg);
24393         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24395         this_arg_conv.is_owned = false;
24396         unsigned char header_arr[80];
24397         CHECK(header->arr_len == 80);
24398         memcpy(header_arr, header->elems, 80); FREE(header);
24399         unsigned char (*header_ref)[80] = &header_arr;
24400         void* broadcaster_ptr = untag_ptr(broadcaster);
24401         CHECK_ACCESS(broadcaster_ptr);
24402         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
24403         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
24404                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24405                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
24406         }
24407         void* fee_estimator_ptr = untag_ptr(fee_estimator);
24408         CHECK_ACCESS(fee_estimator_ptr);
24409         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
24410         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
24411                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24412                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
24413         }
24414         void* logger_ptr = untag_ptr(logger);
24415         CHECK_ACCESS(logger_ptr);
24416         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
24417         if (logger_conv.free == LDKLogger_JCalls_free) {
24418                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24419                 LDKLogger_JCalls_cloned(&logger_conv);
24420         }
24421         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
24422         uint64_tArray ret_arr = NULL;
24423         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24424         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24425         for (size_t n = 0; n < ret_var.datalen; n++) {
24426                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
24427                 *ret_conv_39_conv = ret_var.data[n];
24428                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
24429         }
24430         
24431         FREE(ret_var.data);
24432         return ret_arr;
24433 }
24434
24435 ptrArray  __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint64_t this_arg) {
24436         LDKChannelMonitor this_arg_conv;
24437         this_arg_conv.inner = untag_ptr(this_arg);
24438         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24440         this_arg_conv.is_owned = false;
24441         LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
24442         ptrArray ret_arr = NULL;
24443         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
24444         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
24445         for (size_t m = 0; m < ret_var.datalen; m++) {
24446                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
24447                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
24448                 ret_arr_ptr[m] = ret_conv_12_arr;
24449         }
24450         
24451         FREE(ret_var.data);
24452         return ret_arr;
24453 }
24454
24455 uint64_t  __attribute__((export_name("TS_ChannelMonitor_current_best_block"))) TS_ChannelMonitor_current_best_block(uint64_t this_arg) {
24456         LDKChannelMonitor this_arg_conv;
24457         this_arg_conv.inner = untag_ptr(this_arg);
24458         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24460         this_arg_conv.is_owned = false;
24461         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
24462         uint64_t ret_ref = 0;
24463         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24464         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24465         return ret_ref;
24466 }
24467
24468 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_claimable_balances"))) TS_ChannelMonitor_get_claimable_balances(uint64_t this_arg) {
24469         LDKChannelMonitor this_arg_conv;
24470         this_arg_conv.inner = untag_ptr(this_arg);
24471         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24473         this_arg_conv.is_owned = false;
24474         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
24475         uint64_tArray ret_arr = NULL;
24476         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
24477         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
24478         for (size_t j = 0; j < ret_var.datalen; j++) {
24479                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
24480                 *ret_conv_9_copy = ret_var.data[j];
24481                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
24482                 ret_arr_ptr[j] = ret_conv_9_ref;
24483         }
24484         
24485         FREE(ret_var.data);
24486         return ret_arr;
24487 }
24488
24489 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_read"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint64_t arg) {
24490         LDKu8slice ser_ref;
24491         ser_ref.datalen = ser->arr_len;
24492         ser_ref.data = ser->elems;
24493         void* arg_ptr = untag_ptr(arg);
24494         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
24495         LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr;
24496         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
24497         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
24498         FREE(ser);
24499         return tag_ptr(ret_conv, true);
24500 }
24501
24502 void  __attribute__((export_name("TS_OutPoint_free"))) TS_OutPoint_free(uint64_t this_obj) {
24503         LDKOutPoint this_obj_conv;
24504         this_obj_conv.inner = untag_ptr(this_obj);
24505         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24507         OutPoint_free(this_obj_conv);
24508 }
24509
24510 int8_tArray  __attribute__((export_name("TS_OutPoint_get_txid"))) TS_OutPoint_get_txid(uint64_t this_ptr) {
24511         LDKOutPoint this_ptr_conv;
24512         this_ptr_conv.inner = untag_ptr(this_ptr);
24513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24515         this_ptr_conv.is_owned = false;
24516         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24517         memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
24518         return ret_arr;
24519 }
24520
24521 void  __attribute__((export_name("TS_OutPoint_set_txid"))) TS_OutPoint_set_txid(uint64_t this_ptr, int8_tArray val) {
24522         LDKOutPoint this_ptr_conv;
24523         this_ptr_conv.inner = untag_ptr(this_ptr);
24524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24526         this_ptr_conv.is_owned = false;
24527         LDKThirtyTwoBytes val_ref;
24528         CHECK(val->arr_len == 32);
24529         memcpy(val_ref.data, val->elems, 32); FREE(val);
24530         OutPoint_set_txid(&this_ptr_conv, val_ref);
24531 }
24532
24533 int16_t  __attribute__((export_name("TS_OutPoint_get_index"))) TS_OutPoint_get_index(uint64_t this_ptr) {
24534         LDKOutPoint this_ptr_conv;
24535         this_ptr_conv.inner = untag_ptr(this_ptr);
24536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24538         this_ptr_conv.is_owned = false;
24539         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
24540         return ret_conv;
24541 }
24542
24543 void  __attribute__((export_name("TS_OutPoint_set_index"))) TS_OutPoint_set_index(uint64_t this_ptr, int16_t val) {
24544         LDKOutPoint this_ptr_conv;
24545         this_ptr_conv.inner = untag_ptr(this_ptr);
24546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24548         this_ptr_conv.is_owned = false;
24549         OutPoint_set_index(&this_ptr_conv, val);
24550 }
24551
24552 uint64_t  __attribute__((export_name("TS_OutPoint_new"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
24553         LDKThirtyTwoBytes txid_arg_ref;
24554         CHECK(txid_arg->arr_len == 32);
24555         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
24556         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
24557         uint64_t ret_ref = 0;
24558         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24559         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24560         return ret_ref;
24561 }
24562
24563 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
24564         LDKOutPoint ret_var = OutPoint_clone(arg);
24565         uint64_t ret_ref = 0;
24566         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24567         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24568         return ret_ref;
24569 }
24570 int64_t  __attribute__((export_name("TS_OutPoint_clone_ptr"))) TS_OutPoint_clone_ptr(uint64_t arg) {
24571         LDKOutPoint arg_conv;
24572         arg_conv.inner = untag_ptr(arg);
24573         arg_conv.is_owned = ptr_is_owned(arg);
24574         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24575         arg_conv.is_owned = false;
24576         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
24577         return ret_conv;
24578 }
24579
24580 uint64_t  __attribute__((export_name("TS_OutPoint_clone"))) TS_OutPoint_clone(uint64_t orig) {
24581         LDKOutPoint orig_conv;
24582         orig_conv.inner = untag_ptr(orig);
24583         orig_conv.is_owned = ptr_is_owned(orig);
24584         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24585         orig_conv.is_owned = false;
24586         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
24587         uint64_t ret_ref = 0;
24588         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24589         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24590         return ret_ref;
24591 }
24592
24593 jboolean  __attribute__((export_name("TS_OutPoint_eq"))) TS_OutPoint_eq(uint64_t a, uint64_t b) {
24594         LDKOutPoint a_conv;
24595         a_conv.inner = untag_ptr(a);
24596         a_conv.is_owned = ptr_is_owned(a);
24597         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
24598         a_conv.is_owned = false;
24599         LDKOutPoint b_conv;
24600         b_conv.inner = untag_ptr(b);
24601         b_conv.is_owned = ptr_is_owned(b);
24602         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
24603         b_conv.is_owned = false;
24604         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
24605         return ret_conv;
24606 }
24607
24608 int64_t  __attribute__((export_name("TS_OutPoint_hash"))) TS_OutPoint_hash(uint64_t o) {
24609         LDKOutPoint o_conv;
24610         o_conv.inner = untag_ptr(o);
24611         o_conv.is_owned = ptr_is_owned(o);
24612         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24613         o_conv.is_owned = false;
24614         int64_t ret_conv = OutPoint_hash(&o_conv);
24615         return ret_conv;
24616 }
24617
24618 int8_tArray  __attribute__((export_name("TS_OutPoint_to_channel_id"))) TS_OutPoint_to_channel_id(uint64_t this_arg) {
24619         LDKOutPoint this_arg_conv;
24620         this_arg_conv.inner = untag_ptr(this_arg);
24621         this_arg_conv.is_owned = ptr_is_owned(this_arg);
24622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
24623         this_arg_conv.is_owned = false;
24624         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24625         memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
24626         return ret_arr;
24627 }
24628
24629 int8_tArray  __attribute__((export_name("TS_OutPoint_write"))) TS_OutPoint_write(uint64_t obj) {
24630         LDKOutPoint obj_conv;
24631         obj_conv.inner = untag_ptr(obj);
24632         obj_conv.is_owned = ptr_is_owned(obj);
24633         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24634         obj_conv.is_owned = false;
24635         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
24636         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24637         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24638         CVec_u8Z_free(ret_var);
24639         return ret_arr;
24640 }
24641
24642 uint64_t  __attribute__((export_name("TS_OutPoint_read"))) TS_OutPoint_read(int8_tArray ser) {
24643         LDKu8slice ser_ref;
24644         ser_ref.datalen = ser->arr_len;
24645         ser_ref.data = ser->elems;
24646         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
24647         *ret_conv = OutPoint_read(ser_ref);
24648         FREE(ser);
24649         return tag_ptr(ret_conv, true);
24650 }
24651
24652 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_free"))) TS_DelayedPaymentOutputDescriptor_free(uint64_t this_obj) {
24653         LDKDelayedPaymentOutputDescriptor this_obj_conv;
24654         this_obj_conv.inner = untag_ptr(this_obj);
24655         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24657         DelayedPaymentOutputDescriptor_free(this_obj_conv);
24658 }
24659
24660 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_outpoint"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
24661         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24662         this_ptr_conv.inner = untag_ptr(this_ptr);
24663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24665         this_ptr_conv.is_owned = false;
24666         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
24667         uint64_t ret_ref = 0;
24668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24670         return ret_ref;
24671 }
24672
24673 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_outpoint"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
24674         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24675         this_ptr_conv.inner = untag_ptr(this_ptr);
24676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24678         this_ptr_conv.is_owned = false;
24679         LDKOutPoint val_conv;
24680         val_conv.inner = untag_ptr(val);
24681         val_conv.is_owned = ptr_is_owned(val);
24682         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24683         val_conv = OutPoint_clone(&val_conv);
24684         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
24685 }
24686
24687 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint64_t this_ptr) {
24688         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24689         this_ptr_conv.inner = untag_ptr(this_ptr);
24690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24692         this_ptr_conv.is_owned = false;
24693         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
24694         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
24695         return ret_arr;
24696 }
24697
24698 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
24699         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24700         this_ptr_conv.inner = untag_ptr(this_ptr);
24701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24703         this_ptr_conv.is_owned = false;
24704         LDKPublicKey val_ref;
24705         CHECK(val->arr_len == 33);
24706         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
24707         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
24708 }
24709
24710 int16_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint64_t this_ptr) {
24711         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24712         this_ptr_conv.inner = untag_ptr(this_ptr);
24713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24715         this_ptr_conv.is_owned = false;
24716         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
24717         return ret_conv;
24718 }
24719
24720 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint64_t this_ptr, int16_t val) {
24721         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24722         this_ptr_conv.inner = untag_ptr(this_ptr);
24723         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24725         this_ptr_conv.is_owned = false;
24726         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
24727 }
24728
24729 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_output"))) TS_DelayedPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
24730         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24731         this_ptr_conv.inner = untag_ptr(this_ptr);
24732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24734         this_ptr_conv.is_owned = false;
24735         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
24736         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
24737         return tag_ptr(ret_ref, true);
24738 }
24739
24740 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_output"))) TS_DelayedPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
24741         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24742         this_ptr_conv.inner = untag_ptr(this_ptr);
24743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24745         this_ptr_conv.is_owned = false;
24746         void* val_ptr = untag_ptr(val);
24747         CHECK_ACCESS(val_ptr);
24748         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
24749         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
24750         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
24751 }
24752
24753 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint64_t this_ptr) {
24754         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24755         this_ptr_conv.inner = untag_ptr(this_ptr);
24756         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24758         this_ptr_conv.is_owned = false;
24759         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
24760         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
24761         return ret_arr;
24762 }
24763
24764 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint64_t this_ptr, int8_tArray val) {
24765         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24766         this_ptr_conv.inner = untag_ptr(this_ptr);
24767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24769         this_ptr_conv.is_owned = false;
24770         LDKPublicKey val_ref;
24771         CHECK(val->arr_len == 33);
24772         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
24773         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
24774 }
24775
24776 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
24777         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24778         this_ptr_conv.inner = untag_ptr(this_ptr);
24779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24781         this_ptr_conv.is_owned = false;
24782         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24783         memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
24784         return ret_arr;
24785 }
24786
24787 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
24788         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24789         this_ptr_conv.inner = untag_ptr(this_ptr);
24790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24792         this_ptr_conv.is_owned = false;
24793         LDKThirtyTwoBytes val_ref;
24794         CHECK(val->arr_len == 32);
24795         memcpy(val_ref.data, val->elems, 32); FREE(val);
24796         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
24797 }
24798
24799 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
24800         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24801         this_ptr_conv.inner = untag_ptr(this_ptr);
24802         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24804         this_ptr_conv.is_owned = false;
24805         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
24806         return ret_conv;
24807 }
24808
24809 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
24810         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
24811         this_ptr_conv.inner = untag_ptr(this_ptr);
24812         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24814         this_ptr_conv.is_owned = false;
24815         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
24816 }
24817
24818 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) {
24819         LDKOutPoint outpoint_arg_conv;
24820         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
24821         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
24822         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
24823         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
24824         LDKPublicKey per_commitment_point_arg_ref;
24825         CHECK(per_commitment_point_arg->arr_len == 33);
24826         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
24827         void* output_arg_ptr = untag_ptr(output_arg);
24828         CHECK_ACCESS(output_arg_ptr);
24829         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
24830         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
24831         LDKPublicKey revocation_pubkey_arg_ref;
24832         CHECK(revocation_pubkey_arg->arr_len == 33);
24833         memcpy(revocation_pubkey_arg_ref.compressed_form, revocation_pubkey_arg->elems, 33); FREE(revocation_pubkey_arg);
24834         LDKThirtyTwoBytes channel_keys_id_arg_ref;
24835         CHECK(channel_keys_id_arg->arr_len == 32);
24836         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
24837         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);
24838         uint64_t ret_ref = 0;
24839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24841         return ret_ref;
24842 }
24843
24844 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
24845         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
24846         uint64_t ret_ref = 0;
24847         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24848         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24849         return ret_ref;
24850 }
24851 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone_ptr"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
24852         LDKDelayedPaymentOutputDescriptor arg_conv;
24853         arg_conv.inner = untag_ptr(arg);
24854         arg_conv.is_owned = ptr_is_owned(arg);
24855         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
24856         arg_conv.is_owned = false;
24857         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
24858         return ret_conv;
24859 }
24860
24861 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone"))) TS_DelayedPaymentOutputDescriptor_clone(uint64_t orig) {
24862         LDKDelayedPaymentOutputDescriptor orig_conv;
24863         orig_conv.inner = untag_ptr(orig);
24864         orig_conv.is_owned = ptr_is_owned(orig);
24865         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
24866         orig_conv.is_owned = false;
24867         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
24868         uint64_t ret_ref = 0;
24869         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24870         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24871         return ret_ref;
24872 }
24873
24874 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_write"))) TS_DelayedPaymentOutputDescriptor_write(uint64_t obj) {
24875         LDKDelayedPaymentOutputDescriptor obj_conv;
24876         obj_conv.inner = untag_ptr(obj);
24877         obj_conv.is_owned = ptr_is_owned(obj);
24878         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
24879         obj_conv.is_owned = false;
24880         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
24881         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
24882         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
24883         CVec_u8Z_free(ret_var);
24884         return ret_arr;
24885 }
24886
24887 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_read"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
24888         LDKu8slice ser_ref;
24889         ser_ref.datalen = ser->arr_len;
24890         ser_ref.data = ser->elems;
24891         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
24892         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
24893         FREE(ser);
24894         return tag_ptr(ret_conv, true);
24895 }
24896
24897 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_free"))) TS_StaticPaymentOutputDescriptor_free(uint64_t this_obj) {
24898         LDKStaticPaymentOutputDescriptor this_obj_conv;
24899         this_obj_conv.inner = untag_ptr(this_obj);
24900         this_obj_conv.is_owned = ptr_is_owned(this_obj);
24901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
24902         StaticPaymentOutputDescriptor_free(this_obj_conv);
24903 }
24904
24905 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_outpoint"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
24906         LDKStaticPaymentOutputDescriptor this_ptr_conv;
24907         this_ptr_conv.inner = untag_ptr(this_ptr);
24908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24910         this_ptr_conv.is_owned = false;
24911         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
24912         uint64_t ret_ref = 0;
24913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
24914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
24915         return ret_ref;
24916 }
24917
24918 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_outpoint"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
24919         LDKStaticPaymentOutputDescriptor this_ptr_conv;
24920         this_ptr_conv.inner = untag_ptr(this_ptr);
24921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24923         this_ptr_conv.is_owned = false;
24924         LDKOutPoint val_conv;
24925         val_conv.inner = untag_ptr(val);
24926         val_conv.is_owned = ptr_is_owned(val);
24927         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
24928         val_conv = OutPoint_clone(&val_conv);
24929         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
24930 }
24931
24932 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_output"))) TS_StaticPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
24933         LDKStaticPaymentOutputDescriptor this_ptr_conv;
24934         this_ptr_conv.inner = untag_ptr(this_ptr);
24935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24937         this_ptr_conv.is_owned = false;
24938         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
24939         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
24940         return tag_ptr(ret_ref, true);
24941 }
24942
24943 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_output"))) TS_StaticPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
24944         LDKStaticPaymentOutputDescriptor this_ptr_conv;
24945         this_ptr_conv.inner = untag_ptr(this_ptr);
24946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24948         this_ptr_conv.is_owned = false;
24949         void* val_ptr = untag_ptr(val);
24950         CHECK_ACCESS(val_ptr);
24951         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
24952         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
24953         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
24954 }
24955
24956 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
24957         LDKStaticPaymentOutputDescriptor this_ptr_conv;
24958         this_ptr_conv.inner = untag_ptr(this_ptr);
24959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24961         this_ptr_conv.is_owned = false;
24962         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
24963         memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
24964         return ret_arr;
24965 }
24966
24967 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
24968         LDKStaticPaymentOutputDescriptor this_ptr_conv;
24969         this_ptr_conv.inner = untag_ptr(this_ptr);
24970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24972         this_ptr_conv.is_owned = false;
24973         LDKThirtyTwoBytes val_ref;
24974         CHECK(val->arr_len == 32);
24975         memcpy(val_ref.data, val->elems, 32); FREE(val);
24976         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
24977 }
24978
24979 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
24980         LDKStaticPaymentOutputDescriptor this_ptr_conv;
24981         this_ptr_conv.inner = untag_ptr(this_ptr);
24982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24984         this_ptr_conv.is_owned = false;
24985         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
24986         return ret_conv;
24987 }
24988
24989 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
24990         LDKStaticPaymentOutputDescriptor this_ptr_conv;
24991         this_ptr_conv.inner = untag_ptr(this_ptr);
24992         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
24993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
24994         this_ptr_conv.is_owned = false;
24995         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
24996 }
24997
24998 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) {
24999         LDKOutPoint outpoint_arg_conv;
25000         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
25001         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
25002         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
25003         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
25004         void* output_arg_ptr = untag_ptr(output_arg);
25005         CHECK_ACCESS(output_arg_ptr);
25006         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
25007         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
25008         LDKThirtyTwoBytes channel_keys_id_arg_ref;
25009         CHECK(channel_keys_id_arg->arr_len == 32);
25010         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
25011         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
25012         uint64_t ret_ref = 0;
25013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25015         return ret_ref;
25016 }
25017
25018 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
25019         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
25020         uint64_t ret_ref = 0;
25021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25023         return ret_ref;
25024 }
25025 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone_ptr"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
25026         LDKStaticPaymentOutputDescriptor arg_conv;
25027         arg_conv.inner = untag_ptr(arg);
25028         arg_conv.is_owned = ptr_is_owned(arg);
25029         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25030         arg_conv.is_owned = false;
25031         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
25032         return ret_conv;
25033 }
25034
25035 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone"))) TS_StaticPaymentOutputDescriptor_clone(uint64_t orig) {
25036         LDKStaticPaymentOutputDescriptor orig_conv;
25037         orig_conv.inner = untag_ptr(orig);
25038         orig_conv.is_owned = ptr_is_owned(orig);
25039         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25040         orig_conv.is_owned = false;
25041         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
25042         uint64_t ret_ref = 0;
25043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25045         return ret_ref;
25046 }
25047
25048 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_write"))) TS_StaticPaymentOutputDescriptor_write(uint64_t obj) {
25049         LDKStaticPaymentOutputDescriptor obj_conv;
25050         obj_conv.inner = untag_ptr(obj);
25051         obj_conv.is_owned = ptr_is_owned(obj);
25052         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25053         obj_conv.is_owned = false;
25054         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
25055         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25056         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25057         CVec_u8Z_free(ret_var);
25058         return ret_arr;
25059 }
25060
25061 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_read"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
25062         LDKu8slice ser_ref;
25063         ser_ref.datalen = ser->arr_len;
25064         ser_ref.data = ser->elems;
25065         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
25066         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
25067         FREE(ser);
25068         return tag_ptr(ret_conv, true);
25069 }
25070
25071 void  __attribute__((export_name("TS_SpendableOutputDescriptor_free"))) TS_SpendableOutputDescriptor_free(uint64_t this_ptr) {
25072         if (!ptr_is_owned(this_ptr)) return;
25073         void* this_ptr_ptr = untag_ptr(this_ptr);
25074         CHECK_ACCESS(this_ptr_ptr);
25075         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
25076         FREE(untag_ptr(this_ptr));
25077         SpendableOutputDescriptor_free(this_ptr_conv);
25078 }
25079
25080 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
25081         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
25082         *ret_copy = SpendableOutputDescriptor_clone(arg);
25083         uint64_t ret_ref = tag_ptr(ret_copy, true);
25084         return ret_ref;
25085 }
25086 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone_ptr"))) TS_SpendableOutputDescriptor_clone_ptr(uint64_t arg) {
25087         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
25088         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
25089         return ret_conv;
25090 }
25091
25092 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone"))) TS_SpendableOutputDescriptor_clone(uint64_t orig) {
25093         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
25094         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
25095         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
25096         uint64_t ret_ref = tag_ptr(ret_copy, true);
25097         return ret_ref;
25098 }
25099
25100 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_output"))) TS_SpendableOutputDescriptor_static_output(uint64_t outpoint, uint64_t output) {
25101         LDKOutPoint outpoint_conv;
25102         outpoint_conv.inner = untag_ptr(outpoint);
25103         outpoint_conv.is_owned = ptr_is_owned(outpoint);
25104         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
25105         outpoint_conv = OutPoint_clone(&outpoint_conv);
25106         void* output_ptr = untag_ptr(output);
25107         CHECK_ACCESS(output_ptr);
25108         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
25109         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
25110         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
25111         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
25112         uint64_t ret_ref = tag_ptr(ret_copy, true);
25113         return ret_ref;
25114 }
25115
25116 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_delayed_payment_output"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint64_t a) {
25117         LDKDelayedPaymentOutputDescriptor a_conv;
25118         a_conv.inner = untag_ptr(a);
25119         a_conv.is_owned = ptr_is_owned(a);
25120         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25121         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
25122         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
25123         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
25124         uint64_t ret_ref = tag_ptr(ret_copy, true);
25125         return ret_ref;
25126 }
25127
25128 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_payment_output"))) TS_SpendableOutputDescriptor_static_payment_output(uint64_t a) {
25129         LDKStaticPaymentOutputDescriptor a_conv;
25130         a_conv.inner = untag_ptr(a);
25131         a_conv.is_owned = ptr_is_owned(a);
25132         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
25133         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
25134         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
25135         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
25136         uint64_t ret_ref = tag_ptr(ret_copy, true);
25137         return ret_ref;
25138 }
25139
25140 int8_tArray  __attribute__((export_name("TS_SpendableOutputDescriptor_write"))) TS_SpendableOutputDescriptor_write(uint64_t obj) {
25141         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
25142         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
25143         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25144         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25145         CVec_u8Z_free(ret_var);
25146         return ret_arr;
25147 }
25148
25149 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
25150         LDKu8slice ser_ref;
25151         ser_ref.datalen = ser->arr_len;
25152         ser_ref.data = ser->elems;
25153         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
25154         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
25155         FREE(ser);
25156         return tag_ptr(ret_conv, true);
25157 }
25158
25159 void  __attribute__((export_name("TS_BaseSign_free"))) TS_BaseSign_free(uint64_t this_ptr) {
25160         if (!ptr_is_owned(this_ptr)) return;
25161         void* this_ptr_ptr = untag_ptr(this_ptr);
25162         CHECK_ACCESS(this_ptr_ptr);
25163         LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr);
25164         FREE(untag_ptr(this_ptr));
25165         BaseSign_free(this_ptr_conv);
25166 }
25167
25168 static inline uint64_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) {
25169         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
25170         *ret_ret = Sign_clone(arg);
25171         return tag_ptr(ret_ret, true);
25172 }
25173 int64_t  __attribute__((export_name("TS_Sign_clone_ptr"))) TS_Sign_clone_ptr(uint64_t arg) {
25174         void* arg_ptr = untag_ptr(arg);
25175         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
25176         LDKSign* arg_conv = (LDKSign*)arg_ptr;
25177         int64_t ret_conv = Sign_clone_ptr(arg_conv);
25178         return ret_conv;
25179 }
25180
25181 uint64_t  __attribute__((export_name("TS_Sign_clone"))) TS_Sign_clone(uint64_t orig) {
25182         void* orig_ptr = untag_ptr(orig);
25183         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
25184         LDKSign* orig_conv = (LDKSign*)orig_ptr;
25185         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
25186         *ret_ret = Sign_clone(orig_conv);
25187         return tag_ptr(ret_ret, true);
25188 }
25189
25190 void  __attribute__((export_name("TS_Sign_free"))) TS_Sign_free(uint64_t this_ptr) {
25191         if (!ptr_is_owned(this_ptr)) return;
25192         void* this_ptr_ptr = untag_ptr(this_ptr);
25193         CHECK_ACCESS(this_ptr_ptr);
25194         LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr);
25195         FREE(untag_ptr(this_ptr));
25196         Sign_free(this_ptr_conv);
25197 }
25198
25199 uint32_t  __attribute__((export_name("TS_Recipient_clone"))) TS_Recipient_clone(uint64_t orig) {
25200         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
25201         uint32_t ret_conv = LDKRecipient_to_js(Recipient_clone(orig_conv));
25202         return ret_conv;
25203 }
25204
25205 uint32_t  __attribute__((export_name("TS_Recipient_node"))) TS_Recipient_node() {
25206         uint32_t ret_conv = LDKRecipient_to_js(Recipient_node());
25207         return ret_conv;
25208 }
25209
25210 uint32_t  __attribute__((export_name("TS_Recipient_phantom_node"))) TS_Recipient_phantom_node() {
25211         uint32_t ret_conv = LDKRecipient_to_js(Recipient_phantom_node());
25212         return ret_conv;
25213 }
25214
25215 void  __attribute__((export_name("TS_KeysInterface_free"))) TS_KeysInterface_free(uint64_t this_ptr) {
25216         if (!ptr_is_owned(this_ptr)) return;
25217         void* this_ptr_ptr = untag_ptr(this_ptr);
25218         CHECK_ACCESS(this_ptr_ptr);
25219         LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr);
25220         FREE(untag_ptr(this_ptr));
25221         KeysInterface_free(this_ptr_conv);
25222 }
25223
25224 void  __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint64_t this_obj) {
25225         LDKInMemorySigner this_obj_conv;
25226         this_obj_conv.inner = untag_ptr(this_obj);
25227         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25229         InMemorySigner_free(this_obj_conv);
25230 }
25231
25232 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_funding_key"))) TS_InMemorySigner_get_funding_key(uint64_t this_ptr) {
25233         LDKInMemorySigner this_ptr_conv;
25234         this_ptr_conv.inner = untag_ptr(this_ptr);
25235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25237         this_ptr_conv.is_owned = false;
25238         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25239         memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
25240         return ret_arr;
25241 }
25242
25243 void  __attribute__((export_name("TS_InMemorySigner_set_funding_key"))) TS_InMemorySigner_set_funding_key(uint64_t this_ptr, int8_tArray val) {
25244         LDKInMemorySigner this_ptr_conv;
25245         this_ptr_conv.inner = untag_ptr(this_ptr);
25246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25248         this_ptr_conv.is_owned = false;
25249         LDKSecretKey val_ref;
25250         CHECK(val->arr_len == 32);
25251         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
25252         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
25253 }
25254
25255 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_revocation_base_key"))) TS_InMemorySigner_get_revocation_base_key(uint64_t this_ptr) {
25256         LDKInMemorySigner this_ptr_conv;
25257         this_ptr_conv.inner = untag_ptr(this_ptr);
25258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25260         this_ptr_conv.is_owned = false;
25261         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25262         memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
25263         return ret_arr;
25264 }
25265
25266 void  __attribute__((export_name("TS_InMemorySigner_set_revocation_base_key"))) TS_InMemorySigner_set_revocation_base_key(uint64_t this_ptr, int8_tArray val) {
25267         LDKInMemorySigner this_ptr_conv;
25268         this_ptr_conv.inner = untag_ptr(this_ptr);
25269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25271         this_ptr_conv.is_owned = false;
25272         LDKSecretKey val_ref;
25273         CHECK(val->arr_len == 32);
25274         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
25275         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
25276 }
25277
25278 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_payment_key"))) TS_InMemorySigner_get_payment_key(uint64_t this_ptr) {
25279         LDKInMemorySigner this_ptr_conv;
25280         this_ptr_conv.inner = untag_ptr(this_ptr);
25281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25283         this_ptr_conv.is_owned = false;
25284         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25285         memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
25286         return ret_arr;
25287 }
25288
25289 void  __attribute__((export_name("TS_InMemorySigner_set_payment_key"))) TS_InMemorySigner_set_payment_key(uint64_t this_ptr, int8_tArray val) {
25290         LDKInMemorySigner this_ptr_conv;
25291         this_ptr_conv.inner = untag_ptr(this_ptr);
25292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25294         this_ptr_conv.is_owned = false;
25295         LDKSecretKey val_ref;
25296         CHECK(val->arr_len == 32);
25297         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
25298         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
25299 }
25300
25301 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_delayed_payment_base_key"))) TS_InMemorySigner_get_delayed_payment_base_key(uint64_t this_ptr) {
25302         LDKInMemorySigner this_ptr_conv;
25303         this_ptr_conv.inner = untag_ptr(this_ptr);
25304         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25306         this_ptr_conv.is_owned = false;
25307         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25308         memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
25309         return ret_arr;
25310 }
25311
25312 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) {
25313         LDKInMemorySigner this_ptr_conv;
25314         this_ptr_conv.inner = untag_ptr(this_ptr);
25315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25317         this_ptr_conv.is_owned = false;
25318         LDKSecretKey val_ref;
25319         CHECK(val->arr_len == 32);
25320         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
25321         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
25322 }
25323
25324 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_htlc_base_key"))) TS_InMemorySigner_get_htlc_base_key(uint64_t this_ptr) {
25325         LDKInMemorySigner this_ptr_conv;
25326         this_ptr_conv.inner = untag_ptr(this_ptr);
25327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25329         this_ptr_conv.is_owned = false;
25330         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25331         memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
25332         return ret_arr;
25333 }
25334
25335 void  __attribute__((export_name("TS_InMemorySigner_set_htlc_base_key"))) TS_InMemorySigner_set_htlc_base_key(uint64_t this_ptr, int8_tArray val) {
25336         LDKInMemorySigner this_ptr_conv;
25337         this_ptr_conv.inner = untag_ptr(this_ptr);
25338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25340         this_ptr_conv.is_owned = false;
25341         LDKSecretKey val_ref;
25342         CHECK(val->arr_len == 32);
25343         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
25344         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
25345 }
25346
25347 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_commitment_seed"))) TS_InMemorySigner_get_commitment_seed(uint64_t this_ptr) {
25348         LDKInMemorySigner this_ptr_conv;
25349         this_ptr_conv.inner = untag_ptr(this_ptr);
25350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25352         this_ptr_conv.is_owned = false;
25353         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
25354         memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
25355         return ret_arr;
25356 }
25357
25358 void  __attribute__((export_name("TS_InMemorySigner_set_commitment_seed"))) TS_InMemorySigner_set_commitment_seed(uint64_t this_ptr, int8_tArray val) {
25359         LDKInMemorySigner this_ptr_conv;
25360         this_ptr_conv.inner = untag_ptr(this_ptr);
25361         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25363         this_ptr_conv.is_owned = false;
25364         LDKThirtyTwoBytes val_ref;
25365         CHECK(val->arr_len == 32);
25366         memcpy(val_ref.data, val->elems, 32); FREE(val);
25367         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
25368 }
25369
25370 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
25371         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
25372         uint64_t ret_ref = 0;
25373         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25374         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25375         return ret_ref;
25376 }
25377 int64_t  __attribute__((export_name("TS_InMemorySigner_clone_ptr"))) TS_InMemorySigner_clone_ptr(uint64_t arg) {
25378         LDKInMemorySigner arg_conv;
25379         arg_conv.inner = untag_ptr(arg);
25380         arg_conv.is_owned = ptr_is_owned(arg);
25381         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25382         arg_conv.is_owned = false;
25383         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
25384         return ret_conv;
25385 }
25386
25387 uint64_t  __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySigner_clone(uint64_t orig) {
25388         LDKInMemorySigner orig_conv;
25389         orig_conv.inner = untag_ptr(orig);
25390         orig_conv.is_owned = ptr_is_owned(orig);
25391         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25392         orig_conv.is_owned = false;
25393         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
25394         uint64_t ret_ref = 0;
25395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25397         return ret_ref;
25398 }
25399
25400 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) {
25401         LDKSecretKey node_secret_ref;
25402         CHECK(node_secret->arr_len == 32);
25403         memcpy(node_secret_ref.bytes, node_secret->elems, 32); FREE(node_secret);
25404         LDKSecretKey funding_key_ref;
25405         CHECK(funding_key->arr_len == 32);
25406         memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
25407         LDKSecretKey revocation_base_key_ref;
25408         CHECK(revocation_base_key->arr_len == 32);
25409         memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
25410         LDKSecretKey payment_key_ref;
25411         CHECK(payment_key->arr_len == 32);
25412         memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
25413         LDKSecretKey delayed_payment_base_key_ref;
25414         CHECK(delayed_payment_base_key->arr_len == 32);
25415         memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
25416         LDKSecretKey htlc_base_key_ref;
25417         CHECK(htlc_base_key->arr_len == 32);
25418         memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
25419         LDKThirtyTwoBytes commitment_seed_ref;
25420         CHECK(commitment_seed->arr_len == 32);
25421         memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
25422         LDKThirtyTwoBytes channel_keys_id_ref;
25423         CHECK(channel_keys_id->arr_len == 32);
25424         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
25425         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);
25426         uint64_t ret_ref = 0;
25427         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25428         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25429         return ret_ref;
25430 }
25431
25432 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_pubkeys"))) TS_InMemorySigner_counterparty_pubkeys(uint64_t this_arg) {
25433         LDKInMemorySigner this_arg_conv;
25434         this_arg_conv.inner = untag_ptr(this_arg);
25435         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25437         this_arg_conv.is_owned = false;
25438         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
25439         uint64_t ret_ref = 0;
25440         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25441         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25442         return ret_ref;
25443 }
25444
25445 int16_t  __attribute__((export_name("TS_InMemorySigner_counterparty_selected_contest_delay"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint64_t this_arg) {
25446         LDKInMemorySigner this_arg_conv;
25447         this_arg_conv.inner = untag_ptr(this_arg);
25448         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25450         this_arg_conv.is_owned = false;
25451         int16_t ret_conv = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
25452         return ret_conv;
25453 }
25454
25455 int16_t  __attribute__((export_name("TS_InMemorySigner_holder_selected_contest_delay"))) TS_InMemorySigner_holder_selected_contest_delay(uint64_t this_arg) {
25456         LDKInMemorySigner this_arg_conv;
25457         this_arg_conv.inner = untag_ptr(this_arg);
25458         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25460         this_arg_conv.is_owned = false;
25461         int16_t ret_conv = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
25462         return ret_conv;
25463 }
25464
25465 jboolean  __attribute__((export_name("TS_InMemorySigner_is_outbound"))) TS_InMemorySigner_is_outbound(uint64_t this_arg) {
25466         LDKInMemorySigner this_arg_conv;
25467         this_arg_conv.inner = untag_ptr(this_arg);
25468         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25470         this_arg_conv.is_owned = false;
25471         jboolean ret_conv = InMemorySigner_is_outbound(&this_arg_conv);
25472         return ret_conv;
25473 }
25474
25475 uint64_t  __attribute__((export_name("TS_InMemorySigner_funding_outpoint"))) TS_InMemorySigner_funding_outpoint(uint64_t this_arg) {
25476         LDKInMemorySigner this_arg_conv;
25477         this_arg_conv.inner = untag_ptr(this_arg);
25478         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25480         this_arg_conv.is_owned = false;
25481         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
25482         uint64_t ret_ref = 0;
25483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25485         return ret_ref;
25486 }
25487
25488 uint64_t  __attribute__((export_name("TS_InMemorySigner_get_channel_parameters"))) TS_InMemorySigner_get_channel_parameters(uint64_t this_arg) {
25489         LDKInMemorySigner this_arg_conv;
25490         this_arg_conv.inner = untag_ptr(this_arg);
25491         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25493         this_arg_conv.is_owned = false;
25494         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
25495         uint64_t ret_ref = 0;
25496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25498         return ret_ref;
25499 }
25500
25501 jboolean  __attribute__((export_name("TS_InMemorySigner_opt_anchors"))) TS_InMemorySigner_opt_anchors(uint64_t this_arg) {
25502         LDKInMemorySigner this_arg_conv;
25503         this_arg_conv.inner = untag_ptr(this_arg);
25504         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25506         this_arg_conv.is_owned = false;
25507         jboolean ret_conv = InMemorySigner_opt_anchors(&this_arg_conv);
25508         return ret_conv;
25509 }
25510
25511 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) {
25512         LDKInMemorySigner this_arg_conv;
25513         this_arg_conv.inner = untag_ptr(this_arg);
25514         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25516         this_arg_conv.is_owned = false;
25517         LDKTransaction spend_tx_ref;
25518         spend_tx_ref.datalen = spend_tx->arr_len;
25519         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
25520         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
25521         spend_tx_ref.data_is_owned = true;
25522         LDKStaticPaymentOutputDescriptor descriptor_conv;
25523         descriptor_conv.inner = untag_ptr(descriptor);
25524         descriptor_conv.is_owned = ptr_is_owned(descriptor);
25525         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
25526         descriptor_conv.is_owned = false;
25527         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
25528         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
25529         return tag_ptr(ret_conv, true);
25530 }
25531
25532 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) {
25533         LDKInMemorySigner this_arg_conv;
25534         this_arg_conv.inner = untag_ptr(this_arg);
25535         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25537         this_arg_conv.is_owned = false;
25538         LDKTransaction spend_tx_ref;
25539         spend_tx_ref.datalen = spend_tx->arr_len;
25540         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
25541         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
25542         spend_tx_ref.data_is_owned = true;
25543         LDKDelayedPaymentOutputDescriptor descriptor_conv;
25544         descriptor_conv.inner = untag_ptr(descriptor);
25545         descriptor_conv.is_owned = ptr_is_owned(descriptor);
25546         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
25547         descriptor_conv.is_owned = false;
25548         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
25549         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
25550         return tag_ptr(ret_conv, true);
25551 }
25552
25553 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_BaseSign"))) TS_InMemorySigner_as_BaseSign(uint64_t this_arg) {
25554         LDKInMemorySigner this_arg_conv;
25555         this_arg_conv.inner = untag_ptr(this_arg);
25556         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25558         this_arg_conv.is_owned = false;
25559         LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
25560         *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
25561         return tag_ptr(ret_ret, true);
25562 }
25563
25564 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_Sign"))) TS_InMemorySigner_as_Sign(uint64_t this_arg) {
25565         LDKInMemorySigner this_arg_conv;
25566         this_arg_conv.inner = untag_ptr(this_arg);
25567         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25569         this_arg_conv.is_owned = false;
25570         LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign");
25571         *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
25572         return tag_ptr(ret_ret, true);
25573 }
25574
25575 int8_tArray  __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemorySigner_write(uint64_t obj) {
25576         LDKInMemorySigner obj_conv;
25577         obj_conv.inner = untag_ptr(obj);
25578         obj_conv.is_owned = ptr_is_owned(obj);
25579         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
25580         obj_conv.is_owned = false;
25581         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
25582         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
25583         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
25584         CVec_u8Z_free(ret_var);
25585         return ret_arr;
25586 }
25587
25588 uint64_t  __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser, int8_tArray arg) {
25589         LDKu8slice ser_ref;
25590         ser_ref.datalen = ser->arr_len;
25591         ser_ref.data = ser->elems;
25592         LDKSecretKey arg_ref;
25593         CHECK(arg->arr_len == 32);
25594         memcpy(arg_ref.bytes, arg->elems, 32); FREE(arg);
25595         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
25596         *ret_conv = InMemorySigner_read(ser_ref, arg_ref);
25597         FREE(ser);
25598         return tag_ptr(ret_conv, true);
25599 }
25600
25601 void  __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(uint64_t this_obj) {
25602         LDKKeysManager this_obj_conv;
25603         this_obj_conv.inner = untag_ptr(this_obj);
25604         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25606         KeysManager_free(this_obj_conv);
25607 }
25608
25609 uint64_t  __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
25610         unsigned char seed_arr[32];
25611         CHECK(seed->arr_len == 32);
25612         memcpy(seed_arr, seed->elems, 32); FREE(seed);
25613         unsigned char (*seed_ref)[32] = &seed_arr;
25614         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
25615         uint64_t ret_ref = 0;
25616         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25617         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25618         return ret_ref;
25619 }
25620
25621 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) {
25622         LDKKeysManager this_arg_conv;
25623         this_arg_conv.inner = untag_ptr(this_arg);
25624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25626         this_arg_conv.is_owned = false;
25627         unsigned char params_arr[32];
25628         CHECK(params->arr_len == 32);
25629         memcpy(params_arr, params->elems, 32); FREE(params);
25630         unsigned char (*params_ref)[32] = &params_arr;
25631         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
25632         uint64_t ret_ref = 0;
25633         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25634         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25635         return ret_ref;
25636 }
25637
25638 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) {
25639         LDKKeysManager this_arg_conv;
25640         this_arg_conv.inner = untag_ptr(this_arg);
25641         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25643         this_arg_conv.is_owned = false;
25644         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
25645         descriptors_constr.datalen = descriptors->arr_len;
25646         if (descriptors_constr.datalen > 0)
25647                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
25648         else
25649                 descriptors_constr.data = NULL;
25650         uint64_t* descriptors_vals = descriptors->elems;
25651         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
25652                 uint64_t descriptors_conv_27 = descriptors_vals[b];
25653                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
25654                 CHECK_ACCESS(descriptors_conv_27_ptr);
25655                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
25656                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
25657                 descriptors_constr.data[b] = descriptors_conv_27_conv;
25658         }
25659         FREE(descriptors);
25660         LDKCVec_TxOutZ outputs_constr;
25661         outputs_constr.datalen = outputs->arr_len;
25662         if (outputs_constr.datalen > 0)
25663                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
25664         else
25665                 outputs_constr.data = NULL;
25666         uint64_t* outputs_vals = outputs->elems;
25667         for (size_t h = 0; h < outputs_constr.datalen; h++) {
25668                 uint64_t outputs_conv_7 = outputs_vals[h];
25669                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
25670                 CHECK_ACCESS(outputs_conv_7_ptr);
25671                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
25672                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
25673                 outputs_constr.data[h] = outputs_conv_7_conv;
25674         }
25675         FREE(outputs);
25676         LDKCVec_u8Z change_destination_script_ref;
25677         change_destination_script_ref.datalen = change_destination_script->arr_len;
25678         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
25679         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
25680         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
25681         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
25682         return tag_ptr(ret_conv, true);
25683 }
25684
25685 uint64_t  __attribute__((export_name("TS_KeysManager_as_KeysInterface"))) TS_KeysManager_as_KeysInterface(uint64_t this_arg) {
25686         LDKKeysManager this_arg_conv;
25687         this_arg_conv.inner = untag_ptr(this_arg);
25688         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25690         this_arg_conv.is_owned = false;
25691         LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
25692         *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
25693         return tag_ptr(ret_ret, true);
25694 }
25695
25696 void  __attribute__((export_name("TS_PhantomKeysManager_free"))) TS_PhantomKeysManager_free(uint64_t this_obj) {
25697         LDKPhantomKeysManager this_obj_conv;
25698         this_obj_conv.inner = untag_ptr(this_obj);
25699         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25701         PhantomKeysManager_free(this_obj_conv);
25702 }
25703
25704 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_KeysInterface"))) TS_PhantomKeysManager_as_KeysInterface(uint64_t this_arg) {
25705         LDKPhantomKeysManager this_arg_conv;
25706         this_arg_conv.inner = untag_ptr(this_arg);
25707         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25709         this_arg_conv.is_owned = false;
25710         LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
25711         *ret_ret = PhantomKeysManager_as_KeysInterface(&this_arg_conv);
25712         return tag_ptr(ret_ret, true);
25713 }
25714
25715 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) {
25716         unsigned char seed_arr[32];
25717         CHECK(seed->arr_len == 32);
25718         memcpy(seed_arr, seed->elems, 32); FREE(seed);
25719         unsigned char (*seed_ref)[32] = &seed_arr;
25720         unsigned char cross_node_seed_arr[32];
25721         CHECK(cross_node_seed->arr_len == 32);
25722         memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
25723         unsigned char (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
25724         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
25725         uint64_t ret_ref = 0;
25726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25728         return ret_ref;
25729 }
25730
25731 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) {
25732         LDKPhantomKeysManager this_arg_conv;
25733         this_arg_conv.inner = untag_ptr(this_arg);
25734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25736         this_arg_conv.is_owned = false;
25737         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
25738         descriptors_constr.datalen = descriptors->arr_len;
25739         if (descriptors_constr.datalen > 0)
25740                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
25741         else
25742                 descriptors_constr.data = NULL;
25743         uint64_t* descriptors_vals = descriptors->elems;
25744         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
25745                 uint64_t descriptors_conv_27 = descriptors_vals[b];
25746                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
25747                 CHECK_ACCESS(descriptors_conv_27_ptr);
25748                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
25749                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
25750                 descriptors_constr.data[b] = descriptors_conv_27_conv;
25751         }
25752         FREE(descriptors);
25753         LDKCVec_TxOutZ outputs_constr;
25754         outputs_constr.datalen = outputs->arr_len;
25755         if (outputs_constr.datalen > 0)
25756                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
25757         else
25758                 outputs_constr.data = NULL;
25759         uint64_t* outputs_vals = outputs->elems;
25760         for (size_t h = 0; h < outputs_constr.datalen; h++) {
25761                 uint64_t outputs_conv_7 = outputs_vals[h];
25762                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
25763                 CHECK_ACCESS(outputs_conv_7_ptr);
25764                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
25765                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
25766                 outputs_constr.data[h] = outputs_conv_7_conv;
25767         }
25768         FREE(outputs);
25769         LDKCVec_u8Z change_destination_script_ref;
25770         change_destination_script_ref.datalen = change_destination_script->arr_len;
25771         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
25772         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
25773         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
25774         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
25775         return tag_ptr(ret_conv, true);
25776 }
25777
25778 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) {
25779         LDKPhantomKeysManager this_arg_conv;
25780         this_arg_conv.inner = untag_ptr(this_arg);
25781         this_arg_conv.is_owned = ptr_is_owned(this_arg);
25782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
25783         this_arg_conv.is_owned = false;
25784         unsigned char params_arr[32];
25785         CHECK(params->arr_len == 32);
25786         memcpy(params_arr, params->elems, 32); FREE(params);
25787         unsigned char (*params_ref)[32] = &params_arr;
25788         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
25789         uint64_t ret_ref = 0;
25790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25792         return ret_ref;
25793 }
25794
25795 void  __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint64_t this_obj) {
25796         LDKChannelManager this_obj_conv;
25797         this_obj_conv.inner = untag_ptr(this_obj);
25798         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25800         ChannelManager_free(this_obj_conv);
25801 }
25802
25803 void  __attribute__((export_name("TS_ChainParameters_free"))) TS_ChainParameters_free(uint64_t this_obj) {
25804         LDKChainParameters this_obj_conv;
25805         this_obj_conv.inner = untag_ptr(this_obj);
25806         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25808         ChainParameters_free(this_obj_conv);
25809 }
25810
25811 uint32_t  __attribute__((export_name("TS_ChainParameters_get_network"))) TS_ChainParameters_get_network(uint64_t this_ptr) {
25812         LDKChainParameters this_ptr_conv;
25813         this_ptr_conv.inner = untag_ptr(this_ptr);
25814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25816         this_ptr_conv.is_owned = false;
25817         uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
25818         return ret_conv;
25819 }
25820
25821 void  __attribute__((export_name("TS_ChainParameters_set_network"))) TS_ChainParameters_set_network(uint64_t this_ptr, uint32_t val) {
25822         LDKChainParameters this_ptr_conv;
25823         this_ptr_conv.inner = untag_ptr(this_ptr);
25824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25826         this_ptr_conv.is_owned = false;
25827         LDKNetwork val_conv = LDKNetwork_from_js(val);
25828         ChainParameters_set_network(&this_ptr_conv, val_conv);
25829 }
25830
25831 uint64_t  __attribute__((export_name("TS_ChainParameters_get_best_block"))) TS_ChainParameters_get_best_block(uint64_t this_ptr) {
25832         LDKChainParameters this_ptr_conv;
25833         this_ptr_conv.inner = untag_ptr(this_ptr);
25834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25836         this_ptr_conv.is_owned = false;
25837         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
25838         uint64_t ret_ref = 0;
25839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25841         return ret_ref;
25842 }
25843
25844 void  __attribute__((export_name("TS_ChainParameters_set_best_block"))) TS_ChainParameters_set_best_block(uint64_t this_ptr, uint64_t val) {
25845         LDKChainParameters 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         LDKBestBlock val_conv;
25851         val_conv.inner = untag_ptr(val);
25852         val_conv.is_owned = ptr_is_owned(val);
25853         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
25854         val_conv = BestBlock_clone(&val_conv);
25855         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
25856 }
25857
25858 uint64_t  __attribute__((export_name("TS_ChainParameters_new"))) TS_ChainParameters_new(uint32_t network_arg, uint64_t best_block_arg) {
25859         LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
25860         LDKBestBlock best_block_arg_conv;
25861         best_block_arg_conv.inner = untag_ptr(best_block_arg);
25862         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
25863         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
25864         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
25865         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
25866         uint64_t ret_ref = 0;
25867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25869         return ret_ref;
25870 }
25871
25872 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
25873         LDKChainParameters ret_var = ChainParameters_clone(arg);
25874         uint64_t ret_ref = 0;
25875         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25876         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25877         return ret_ref;
25878 }
25879 int64_t  __attribute__((export_name("TS_ChainParameters_clone_ptr"))) TS_ChainParameters_clone_ptr(uint64_t arg) {
25880         LDKChainParameters arg_conv;
25881         arg_conv.inner = untag_ptr(arg);
25882         arg_conv.is_owned = ptr_is_owned(arg);
25883         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25884         arg_conv.is_owned = false;
25885         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
25886         return ret_conv;
25887 }
25888
25889 uint64_t  __attribute__((export_name("TS_ChainParameters_clone"))) TS_ChainParameters_clone(uint64_t orig) {
25890         LDKChainParameters orig_conv;
25891         orig_conv.inner = untag_ptr(orig);
25892         orig_conv.is_owned = ptr_is_owned(orig);
25893         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25894         orig_conv.is_owned = false;
25895         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
25896         uint64_t ret_ref = 0;
25897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25899         return ret_ref;
25900 }
25901
25902 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_free"))) TS_CounterpartyForwardingInfo_free(uint64_t this_obj) {
25903         LDKCounterpartyForwardingInfo this_obj_conv;
25904         this_obj_conv.inner = untag_ptr(this_obj);
25905         this_obj_conv.is_owned = ptr_is_owned(this_obj);
25906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
25907         CounterpartyForwardingInfo_free(this_obj_conv);
25908 }
25909
25910 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_base_msat"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint64_t this_ptr) {
25911         LDKCounterpartyForwardingInfo this_ptr_conv;
25912         this_ptr_conv.inner = untag_ptr(this_ptr);
25913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25915         this_ptr_conv.is_owned = false;
25916         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
25917         return ret_conv;
25918 }
25919
25920 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_base_msat"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
25921         LDKCounterpartyForwardingInfo this_ptr_conv;
25922         this_ptr_conv.inner = untag_ptr(this_ptr);
25923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25925         this_ptr_conv.is_owned = false;
25926         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
25927 }
25928
25929 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
25930         LDKCounterpartyForwardingInfo this_ptr_conv;
25931         this_ptr_conv.inner = untag_ptr(this_ptr);
25932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25934         this_ptr_conv.is_owned = false;
25935         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
25936         return ret_conv;
25937 }
25938
25939 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
25940         LDKCounterpartyForwardingInfo this_ptr_conv;
25941         this_ptr_conv.inner = untag_ptr(this_ptr);
25942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25944         this_ptr_conv.is_owned = false;
25945         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
25946 }
25947
25948 int16_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
25949         LDKCounterpartyForwardingInfo this_ptr_conv;
25950         this_ptr_conv.inner = untag_ptr(this_ptr);
25951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25953         this_ptr_conv.is_owned = false;
25954         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
25955         return ret_conv;
25956 }
25957
25958 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
25959         LDKCounterpartyForwardingInfo this_ptr_conv;
25960         this_ptr_conv.inner = untag_ptr(this_ptr);
25961         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
25962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
25963         this_ptr_conv.is_owned = false;
25964         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
25965 }
25966
25967 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) {
25968         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
25969         uint64_t ret_ref = 0;
25970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25972         return ret_ref;
25973 }
25974
25975 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
25976         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
25977         uint64_t ret_ref = 0;
25978         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
25979         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
25980         return ret_ref;
25981 }
25982 int64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone_ptr"))) TS_CounterpartyForwardingInfo_clone_ptr(uint64_t arg) {
25983         LDKCounterpartyForwardingInfo arg_conv;
25984         arg_conv.inner = untag_ptr(arg);
25985         arg_conv.is_owned = ptr_is_owned(arg);
25986         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
25987         arg_conv.is_owned = false;
25988         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
25989         return ret_conv;
25990 }
25991
25992 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone"))) TS_CounterpartyForwardingInfo_clone(uint64_t orig) {
25993         LDKCounterpartyForwardingInfo orig_conv;
25994         orig_conv.inner = untag_ptr(orig);
25995         orig_conv.is_owned = ptr_is_owned(orig);
25996         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
25997         orig_conv.is_owned = false;
25998         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
25999         uint64_t ret_ref = 0;
26000         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26001         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26002         return ret_ref;
26003 }
26004
26005 void  __attribute__((export_name("TS_ChannelCounterparty_free"))) TS_ChannelCounterparty_free(uint64_t this_obj) {
26006         LDKChannelCounterparty this_obj_conv;
26007         this_obj_conv.inner = untag_ptr(this_obj);
26008         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26010         ChannelCounterparty_free(this_obj_conv);
26011 }
26012
26013 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_get_node_id"))) TS_ChannelCounterparty_get_node_id(uint64_t this_ptr) {
26014         LDKChannelCounterparty this_ptr_conv;
26015         this_ptr_conv.inner = untag_ptr(this_ptr);
26016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26018         this_ptr_conv.is_owned = false;
26019         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
26020         memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
26021         return ret_arr;
26022 }
26023
26024 void  __attribute__((export_name("TS_ChannelCounterparty_set_node_id"))) TS_ChannelCounterparty_set_node_id(uint64_t this_ptr, int8_tArray val) {
26025         LDKChannelCounterparty this_ptr_conv;
26026         this_ptr_conv.inner = untag_ptr(this_ptr);
26027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26029         this_ptr_conv.is_owned = false;
26030         LDKPublicKey val_ref;
26031         CHECK(val->arr_len == 33);
26032         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
26033         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
26034 }
26035
26036 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_features"))) TS_ChannelCounterparty_get_features(uint64_t this_ptr) {
26037         LDKChannelCounterparty this_ptr_conv;
26038         this_ptr_conv.inner = untag_ptr(this_ptr);
26039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26041         this_ptr_conv.is_owned = false;
26042         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
26043         uint64_t ret_ref = 0;
26044         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26045         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26046         return ret_ref;
26047 }
26048
26049 void  __attribute__((export_name("TS_ChannelCounterparty_set_features"))) TS_ChannelCounterparty_set_features(uint64_t this_ptr, uint64_t val) {
26050         LDKChannelCounterparty this_ptr_conv;
26051         this_ptr_conv.inner = untag_ptr(this_ptr);
26052         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26054         this_ptr_conv.is_owned = false;
26055         LDKInitFeatures val_conv;
26056         val_conv.inner = untag_ptr(val);
26057         val_conv.is_owned = ptr_is_owned(val);
26058         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26059         val_conv = InitFeatures_clone(&val_conv);
26060         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
26061 }
26062
26063 int64_t  __attribute__((export_name("TS_ChannelCounterparty_get_unspendable_punishment_reserve"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint64_t this_ptr) {
26064         LDKChannelCounterparty this_ptr_conv;
26065         this_ptr_conv.inner = untag_ptr(this_ptr);
26066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26068         this_ptr_conv.is_owned = false;
26069         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
26070         return ret_conv;
26071 }
26072
26073 void  __attribute__((export_name("TS_ChannelCounterparty_set_unspendable_punishment_reserve"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint64_t this_ptr, int64_t val) {
26074         LDKChannelCounterparty 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         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
26080 }
26081
26082 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_forwarding_info"))) TS_ChannelCounterparty_get_forwarding_info(uint64_t this_ptr) {
26083         LDKChannelCounterparty this_ptr_conv;
26084         this_ptr_conv.inner = untag_ptr(this_ptr);
26085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26087         this_ptr_conv.is_owned = false;
26088         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
26089         uint64_t ret_ref = 0;
26090         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26091         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26092         return ret_ref;
26093 }
26094
26095 void  __attribute__((export_name("TS_ChannelCounterparty_set_forwarding_info"))) TS_ChannelCounterparty_set_forwarding_info(uint64_t this_ptr, uint64_t val) {
26096         LDKChannelCounterparty this_ptr_conv;
26097         this_ptr_conv.inner = untag_ptr(this_ptr);
26098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26100         this_ptr_conv.is_owned = false;
26101         LDKCounterpartyForwardingInfo val_conv;
26102         val_conv.inner = untag_ptr(val);
26103         val_conv.is_owned = ptr_is_owned(val);
26104         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26105         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
26106         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
26107 }
26108
26109 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_minimum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_minimum_msat(uint64_t this_ptr) {
26110         LDKChannelCounterparty 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         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26116         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
26117         uint64_t ret_ref = tag_ptr(ret_copy, true);
26118         return ret_ref;
26119 }
26120
26121 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) {
26122         LDKChannelCounterparty this_ptr_conv;
26123         this_ptr_conv.inner = untag_ptr(this_ptr);
26124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26126         this_ptr_conv.is_owned = false;
26127         void* val_ptr = untag_ptr(val);
26128         CHECK_ACCESS(val_ptr);
26129         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26130         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
26131         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
26132 }
26133
26134 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_maximum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_maximum_msat(uint64_t this_ptr) {
26135         LDKChannelCounterparty this_ptr_conv;
26136         this_ptr_conv.inner = untag_ptr(this_ptr);
26137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26139         this_ptr_conv.is_owned = false;
26140         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26141         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
26142         uint64_t ret_ref = tag_ptr(ret_copy, true);
26143         return ret_ref;
26144 }
26145
26146 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) {
26147         LDKChannelCounterparty this_ptr_conv;
26148         this_ptr_conv.inner = untag_ptr(this_ptr);
26149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26151         this_ptr_conv.is_owned = false;
26152         void* val_ptr = untag_ptr(val);
26153         CHECK_ACCESS(val_ptr);
26154         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26155         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
26156         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
26157 }
26158
26159 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) {
26160         LDKPublicKey node_id_arg_ref;
26161         CHECK(node_id_arg->arr_len == 33);
26162         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
26163         LDKInitFeatures features_arg_conv;
26164         features_arg_conv.inner = untag_ptr(features_arg);
26165         features_arg_conv.is_owned = ptr_is_owned(features_arg);
26166         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
26167         features_arg_conv = InitFeatures_clone(&features_arg_conv);
26168         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
26169         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
26170         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
26171         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
26172         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
26173         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
26174         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
26175         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
26176         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
26177         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
26178         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
26179         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
26180         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
26181         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);
26182         uint64_t ret_ref = 0;
26183         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26184         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26185         return ret_ref;
26186 }
26187
26188 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
26189         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
26190         uint64_t ret_ref = 0;
26191         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26192         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26193         return ret_ref;
26194 }
26195 int64_t  __attribute__((export_name("TS_ChannelCounterparty_clone_ptr"))) TS_ChannelCounterparty_clone_ptr(uint64_t arg) {
26196         LDKChannelCounterparty arg_conv;
26197         arg_conv.inner = untag_ptr(arg);
26198         arg_conv.is_owned = ptr_is_owned(arg);
26199         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26200         arg_conv.is_owned = false;
26201         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
26202         return ret_conv;
26203 }
26204
26205 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_clone"))) TS_ChannelCounterparty_clone(uint64_t orig) {
26206         LDKChannelCounterparty orig_conv;
26207         orig_conv.inner = untag_ptr(orig);
26208         orig_conv.is_owned = ptr_is_owned(orig);
26209         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26210         orig_conv.is_owned = false;
26211         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
26212         uint64_t ret_ref = 0;
26213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26215         return ret_ref;
26216 }
26217
26218 void  __attribute__((export_name("TS_ChannelDetails_free"))) TS_ChannelDetails_free(uint64_t this_obj) {
26219         LDKChannelDetails this_obj_conv;
26220         this_obj_conv.inner = untag_ptr(this_obj);
26221         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26223         ChannelDetails_free(this_obj_conv);
26224 }
26225
26226 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_channel_id"))) TS_ChannelDetails_get_channel_id(uint64_t this_ptr) {
26227         LDKChannelDetails this_ptr_conv;
26228         this_ptr_conv.inner = untag_ptr(this_ptr);
26229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26231         this_ptr_conv.is_owned = false;
26232         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
26233         memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
26234         return ret_arr;
26235 }
26236
26237 void  __attribute__((export_name("TS_ChannelDetails_set_channel_id"))) TS_ChannelDetails_set_channel_id(uint64_t this_ptr, int8_tArray val) {
26238         LDKChannelDetails this_ptr_conv;
26239         this_ptr_conv.inner = untag_ptr(this_ptr);
26240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26242         this_ptr_conv.is_owned = false;
26243         LDKThirtyTwoBytes val_ref;
26244         CHECK(val->arr_len == 32);
26245         memcpy(val_ref.data, val->elems, 32); FREE(val);
26246         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
26247 }
26248
26249 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_counterparty"))) TS_ChannelDetails_get_counterparty(uint64_t this_ptr) {
26250         LDKChannelDetails this_ptr_conv;
26251         this_ptr_conv.inner = untag_ptr(this_ptr);
26252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26254         this_ptr_conv.is_owned = false;
26255         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
26256         uint64_t ret_ref = 0;
26257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26259         return ret_ref;
26260 }
26261
26262 void  __attribute__((export_name("TS_ChannelDetails_set_counterparty"))) TS_ChannelDetails_set_counterparty(uint64_t this_ptr, uint64_t val) {
26263         LDKChannelDetails this_ptr_conv;
26264         this_ptr_conv.inner = untag_ptr(this_ptr);
26265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26267         this_ptr_conv.is_owned = false;
26268         LDKChannelCounterparty val_conv;
26269         val_conv.inner = untag_ptr(val);
26270         val_conv.is_owned = ptr_is_owned(val);
26271         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26272         val_conv = ChannelCounterparty_clone(&val_conv);
26273         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
26274 }
26275
26276 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_funding_txo"))) TS_ChannelDetails_get_funding_txo(uint64_t this_ptr) {
26277         LDKChannelDetails this_ptr_conv;
26278         this_ptr_conv.inner = untag_ptr(this_ptr);
26279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26281         this_ptr_conv.is_owned = false;
26282         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
26283         uint64_t ret_ref = 0;
26284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26286         return ret_ref;
26287 }
26288
26289 void  __attribute__((export_name("TS_ChannelDetails_set_funding_txo"))) TS_ChannelDetails_set_funding_txo(uint64_t this_ptr, uint64_t val) {
26290         LDKChannelDetails this_ptr_conv;
26291         this_ptr_conv.inner = untag_ptr(this_ptr);
26292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26294         this_ptr_conv.is_owned = false;
26295         LDKOutPoint val_conv;
26296         val_conv.inner = untag_ptr(val);
26297         val_conv.is_owned = ptr_is_owned(val);
26298         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26299         val_conv = OutPoint_clone(&val_conv);
26300         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
26301 }
26302
26303 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_type"))) TS_ChannelDetails_get_channel_type(uint64_t this_ptr) {
26304         LDKChannelDetails this_ptr_conv;
26305         this_ptr_conv.inner = untag_ptr(this_ptr);
26306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26308         this_ptr_conv.is_owned = false;
26309         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
26310         uint64_t ret_ref = 0;
26311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26313         return ret_ref;
26314 }
26315
26316 void  __attribute__((export_name("TS_ChannelDetails_set_channel_type"))) TS_ChannelDetails_set_channel_type(uint64_t this_ptr, uint64_t val) {
26317         LDKChannelDetails this_ptr_conv;
26318         this_ptr_conv.inner = untag_ptr(this_ptr);
26319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26321         this_ptr_conv.is_owned = false;
26322         LDKChannelTypeFeatures val_conv;
26323         val_conv.inner = untag_ptr(val);
26324         val_conv.is_owned = ptr_is_owned(val);
26325         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26326         val_conv = ChannelTypeFeatures_clone(&val_conv);
26327         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
26328 }
26329
26330 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_short_channel_id"))) TS_ChannelDetails_get_short_channel_id(uint64_t this_ptr) {
26331         LDKChannelDetails this_ptr_conv;
26332         this_ptr_conv.inner = untag_ptr(this_ptr);
26333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26335         this_ptr_conv.is_owned = false;
26336         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26337         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
26338         uint64_t ret_ref = tag_ptr(ret_copy, true);
26339         return ret_ref;
26340 }
26341
26342 void  __attribute__((export_name("TS_ChannelDetails_set_short_channel_id"))) TS_ChannelDetails_set_short_channel_id(uint64_t this_ptr, uint64_t val) {
26343         LDKChannelDetails this_ptr_conv;
26344         this_ptr_conv.inner = untag_ptr(this_ptr);
26345         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26347         this_ptr_conv.is_owned = false;
26348         void* val_ptr = untag_ptr(val);
26349         CHECK_ACCESS(val_ptr);
26350         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26351         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
26352         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
26353 }
26354
26355 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_scid_alias"))) TS_ChannelDetails_get_outbound_scid_alias(uint64_t this_ptr) {
26356         LDKChannelDetails this_ptr_conv;
26357         this_ptr_conv.inner = untag_ptr(this_ptr);
26358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26360         this_ptr_conv.is_owned = false;
26361         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26362         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
26363         uint64_t ret_ref = tag_ptr(ret_copy, true);
26364         return ret_ref;
26365 }
26366
26367 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_scid_alias"))) TS_ChannelDetails_set_outbound_scid_alias(uint64_t this_ptr, uint64_t val) {
26368         LDKChannelDetails this_ptr_conv;
26369         this_ptr_conv.inner = untag_ptr(this_ptr);
26370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26372         this_ptr_conv.is_owned = false;
26373         void* val_ptr = untag_ptr(val);
26374         CHECK_ACCESS(val_ptr);
26375         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26376         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
26377         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
26378 }
26379
26380 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_scid_alias"))) TS_ChannelDetails_get_inbound_scid_alias(uint64_t this_ptr) {
26381         LDKChannelDetails this_ptr_conv;
26382         this_ptr_conv.inner = untag_ptr(this_ptr);
26383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26385         this_ptr_conv.is_owned = false;
26386         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26387         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
26388         uint64_t ret_ref = tag_ptr(ret_copy, true);
26389         return ret_ref;
26390 }
26391
26392 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_scid_alias"))) TS_ChannelDetails_set_inbound_scid_alias(uint64_t this_ptr, uint64_t val) {
26393         LDKChannelDetails this_ptr_conv;
26394         this_ptr_conv.inner = untag_ptr(this_ptr);
26395         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26397         this_ptr_conv.is_owned = false;
26398         void* val_ptr = untag_ptr(val);
26399         CHECK_ACCESS(val_ptr);
26400         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26401         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
26402         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
26403 }
26404
26405 int64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_value_satoshis"))) TS_ChannelDetails_get_channel_value_satoshis(uint64_t this_ptr) {
26406         LDKChannelDetails this_ptr_conv;
26407         this_ptr_conv.inner = untag_ptr(this_ptr);
26408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26410         this_ptr_conv.is_owned = false;
26411         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
26412         return ret_conv;
26413 }
26414
26415 void  __attribute__((export_name("TS_ChannelDetails_set_channel_value_satoshis"))) TS_ChannelDetails_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
26416         LDKChannelDetails this_ptr_conv;
26417         this_ptr_conv.inner = untag_ptr(this_ptr);
26418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26420         this_ptr_conv.is_owned = false;
26421         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
26422 }
26423
26424 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_unspendable_punishment_reserve"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint64_t this_ptr) {
26425         LDKChannelDetails this_ptr_conv;
26426         this_ptr_conv.inner = untag_ptr(this_ptr);
26427         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26429         this_ptr_conv.is_owned = false;
26430         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26431         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
26432         uint64_t ret_ref = tag_ptr(ret_copy, true);
26433         return ret_ref;
26434 }
26435
26436 void  __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_reserve"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint64_t this_ptr, uint64_t val) {
26437         LDKChannelDetails this_ptr_conv;
26438         this_ptr_conv.inner = untag_ptr(this_ptr);
26439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26441         this_ptr_conv.is_owned = false;
26442         void* val_ptr = untag_ptr(val);
26443         CHECK_ACCESS(val_ptr);
26444         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26445         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
26446         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
26447 }
26448
26449 int64_t  __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint64_t this_ptr) {
26450         LDKChannelDetails this_ptr_conv;
26451         this_ptr_conv.inner = untag_ptr(this_ptr);
26452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26454         this_ptr_conv.is_owned = false;
26455         int64_t ret_conv = ChannelDetails_get_user_channel_id(&this_ptr_conv);
26456         return ret_conv;
26457 }
26458
26459 void  __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint64_t this_ptr, int64_t val) {
26460         LDKChannelDetails this_ptr_conv;
26461         this_ptr_conv.inner = untag_ptr(this_ptr);
26462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26464         this_ptr_conv.is_owned = false;
26465         ChannelDetails_set_user_channel_id(&this_ptr_conv, val);
26466 }
26467
26468 int64_t  __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint64_t this_ptr) {
26469         LDKChannelDetails this_ptr_conv;
26470         this_ptr_conv.inner = untag_ptr(this_ptr);
26471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26473         this_ptr_conv.is_owned = false;
26474         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
26475         return ret_conv;
26476 }
26477
26478 void  __attribute__((export_name("TS_ChannelDetails_set_balance_msat"))) TS_ChannelDetails_set_balance_msat(uint64_t this_ptr, int64_t val) {
26479         LDKChannelDetails this_ptr_conv;
26480         this_ptr_conv.inner = untag_ptr(this_ptr);
26481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26483         this_ptr_conv.is_owned = false;
26484         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
26485 }
26486
26487 int64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_capacity_msat"))) TS_ChannelDetails_get_outbound_capacity_msat(uint64_t this_ptr) {
26488         LDKChannelDetails 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         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
26494         return ret_conv;
26495 }
26496
26497 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_capacity_msat"))) TS_ChannelDetails_set_outbound_capacity_msat(uint64_t this_ptr, int64_t val) {
26498         LDKChannelDetails this_ptr_conv;
26499         this_ptr_conv.inner = untag_ptr(this_ptr);
26500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26502         this_ptr_conv.is_owned = false;
26503         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
26504 }
26505
26506 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) {
26507         LDKChannelDetails this_ptr_conv;
26508         this_ptr_conv.inner = untag_ptr(this_ptr);
26509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26511         this_ptr_conv.is_owned = false;
26512         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
26513         return ret_conv;
26514 }
26515
26516 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) {
26517         LDKChannelDetails this_ptr_conv;
26518         this_ptr_conv.inner = untag_ptr(this_ptr);
26519         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26521         this_ptr_conv.is_owned = false;
26522         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
26523 }
26524
26525 int64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_capacity_msat"))) TS_ChannelDetails_get_inbound_capacity_msat(uint64_t this_ptr) {
26526         LDKChannelDetails this_ptr_conv;
26527         this_ptr_conv.inner = untag_ptr(this_ptr);
26528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26530         this_ptr_conv.is_owned = false;
26531         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
26532         return ret_conv;
26533 }
26534
26535 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_capacity_msat"))) TS_ChannelDetails_set_inbound_capacity_msat(uint64_t this_ptr, int64_t val) {
26536         LDKChannelDetails this_ptr_conv;
26537         this_ptr_conv.inner = untag_ptr(this_ptr);
26538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26540         this_ptr_conv.is_owned = false;
26541         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
26542 }
26543
26544 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations_required"))) TS_ChannelDetails_get_confirmations_required(uint64_t this_ptr) {
26545         LDKChannelDetails this_ptr_conv;
26546         this_ptr_conv.inner = untag_ptr(this_ptr);
26547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26549         this_ptr_conv.is_owned = false;
26550         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
26551         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
26552         uint64_t ret_ref = tag_ptr(ret_copy, true);
26553         return ret_ref;
26554 }
26555
26556 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations_required"))) TS_ChannelDetails_set_confirmations_required(uint64_t this_ptr, uint64_t val) {
26557         LDKChannelDetails this_ptr_conv;
26558         this_ptr_conv.inner = untag_ptr(this_ptr);
26559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26561         this_ptr_conv.is_owned = false;
26562         void* val_ptr = untag_ptr(val);
26563         CHECK_ACCESS(val_ptr);
26564         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
26565         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
26566         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
26567 }
26568
26569 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint64_t this_ptr) {
26570         LDKChannelDetails this_ptr_conv;
26571         this_ptr_conv.inner = untag_ptr(this_ptr);
26572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26574         this_ptr_conv.is_owned = false;
26575         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
26576         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
26577         uint64_t ret_ref = tag_ptr(ret_copy, true);
26578         return ret_ref;
26579 }
26580
26581 void  __attribute__((export_name("TS_ChannelDetails_set_force_close_spend_delay"))) TS_ChannelDetails_set_force_close_spend_delay(uint64_t this_ptr, uint64_t val) {
26582         LDKChannelDetails this_ptr_conv;
26583         this_ptr_conv.inner = untag_ptr(this_ptr);
26584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26586         this_ptr_conv.is_owned = false;
26587         void* val_ptr = untag_ptr(val);
26588         CHECK_ACCESS(val_ptr);
26589         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
26590         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
26591         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
26592 }
26593
26594 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_outbound"))) TS_ChannelDetails_get_is_outbound(uint64_t this_ptr) {
26595         LDKChannelDetails this_ptr_conv;
26596         this_ptr_conv.inner = untag_ptr(this_ptr);
26597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26599         this_ptr_conv.is_owned = false;
26600         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
26601         return ret_conv;
26602 }
26603
26604 void  __attribute__((export_name("TS_ChannelDetails_set_is_outbound"))) TS_ChannelDetails_set_is_outbound(uint64_t this_ptr, jboolean val) {
26605         LDKChannelDetails this_ptr_conv;
26606         this_ptr_conv.inner = untag_ptr(this_ptr);
26607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26609         this_ptr_conv.is_owned = false;
26610         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
26611 }
26612
26613 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_channel_ready"))) TS_ChannelDetails_get_is_channel_ready(uint64_t this_ptr) {
26614         LDKChannelDetails this_ptr_conv;
26615         this_ptr_conv.inner = untag_ptr(this_ptr);
26616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26618         this_ptr_conv.is_owned = false;
26619         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
26620         return ret_conv;
26621 }
26622
26623 void  __attribute__((export_name("TS_ChannelDetails_set_is_channel_ready"))) TS_ChannelDetails_set_is_channel_ready(uint64_t this_ptr, jboolean val) {
26624         LDKChannelDetails this_ptr_conv;
26625         this_ptr_conv.inner = untag_ptr(this_ptr);
26626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26628         this_ptr_conv.is_owned = false;
26629         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
26630 }
26631
26632 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_usable"))) TS_ChannelDetails_get_is_usable(uint64_t this_ptr) {
26633         LDKChannelDetails this_ptr_conv;
26634         this_ptr_conv.inner = untag_ptr(this_ptr);
26635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26637         this_ptr_conv.is_owned = false;
26638         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
26639         return ret_conv;
26640 }
26641
26642 void  __attribute__((export_name("TS_ChannelDetails_set_is_usable"))) TS_ChannelDetails_set_is_usable(uint64_t this_ptr, jboolean val) {
26643         LDKChannelDetails this_ptr_conv;
26644         this_ptr_conv.inner = untag_ptr(this_ptr);
26645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26647         this_ptr_conv.is_owned = false;
26648         ChannelDetails_set_is_usable(&this_ptr_conv, val);
26649 }
26650
26651 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_public"))) TS_ChannelDetails_get_is_public(uint64_t this_ptr) {
26652         LDKChannelDetails this_ptr_conv;
26653         this_ptr_conv.inner = untag_ptr(this_ptr);
26654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26656         this_ptr_conv.is_owned = false;
26657         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
26658         return ret_conv;
26659 }
26660
26661 void  __attribute__((export_name("TS_ChannelDetails_set_is_public"))) TS_ChannelDetails_set_is_public(uint64_t this_ptr, jboolean val) {
26662         LDKChannelDetails this_ptr_conv;
26663         this_ptr_conv.inner = untag_ptr(this_ptr);
26664         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26666         this_ptr_conv.is_owned = false;
26667         ChannelDetails_set_is_public(&this_ptr_conv, val);
26668 }
26669
26670 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_minimum_msat"))) TS_ChannelDetails_get_inbound_htlc_minimum_msat(uint64_t this_ptr) {
26671         LDKChannelDetails this_ptr_conv;
26672         this_ptr_conv.inner = untag_ptr(this_ptr);
26673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26675         this_ptr_conv.is_owned = false;
26676         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26677         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
26678         uint64_t ret_ref = tag_ptr(ret_copy, true);
26679         return ret_ref;
26680 }
26681
26682 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) {
26683         LDKChannelDetails this_ptr_conv;
26684         this_ptr_conv.inner = untag_ptr(this_ptr);
26685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26687         this_ptr_conv.is_owned = false;
26688         void* val_ptr = untag_ptr(val);
26689         CHECK_ACCESS(val_ptr);
26690         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26691         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
26692         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
26693 }
26694
26695 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_maximum_msat"))) TS_ChannelDetails_get_inbound_htlc_maximum_msat(uint64_t this_ptr) {
26696         LDKChannelDetails this_ptr_conv;
26697         this_ptr_conv.inner = untag_ptr(this_ptr);
26698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26700         this_ptr_conv.is_owned = false;
26701         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26702         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
26703         uint64_t ret_ref = tag_ptr(ret_copy, true);
26704         return ret_ref;
26705 }
26706
26707 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) {
26708         LDKChannelDetails this_ptr_conv;
26709         this_ptr_conv.inner = untag_ptr(this_ptr);
26710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26712         this_ptr_conv.is_owned = false;
26713         void* val_ptr = untag_ptr(val);
26714         CHECK_ACCESS(val_ptr);
26715         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
26716         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
26717         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
26718 }
26719
26720 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_config"))) TS_ChannelDetails_get_config(uint64_t this_ptr) {
26721         LDKChannelDetails this_ptr_conv;
26722         this_ptr_conv.inner = untag_ptr(this_ptr);
26723         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26725         this_ptr_conv.is_owned = false;
26726         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
26727         uint64_t ret_ref = 0;
26728         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26729         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26730         return ret_ref;
26731 }
26732
26733 void  __attribute__((export_name("TS_ChannelDetails_set_config"))) TS_ChannelDetails_set_config(uint64_t this_ptr, uint64_t val) {
26734         LDKChannelDetails this_ptr_conv;
26735         this_ptr_conv.inner = untag_ptr(this_ptr);
26736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26738         this_ptr_conv.is_owned = false;
26739         LDKChannelConfig val_conv;
26740         val_conv.inner = untag_ptr(val);
26741         val_conv.is_owned = ptr_is_owned(val);
26742         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
26743         val_conv = ChannelConfig_clone(&val_conv);
26744         ChannelDetails_set_config(&this_ptr_conv, val_conv);
26745 }
26746
26747 uint64_t  __attribute__((export_name("TS_ChannelDetails_new"))) TS_ChannelDetails_new(int8_tArray channel_id_arg, uint64_t counterparty_arg, uint64_t funding_txo_arg, uint64_t channel_type_arg, uint64_t short_channel_id_arg, uint64_t outbound_scid_alias_arg, uint64_t inbound_scid_alias_arg, int64_t channel_value_satoshis_arg, uint64_t unspendable_punishment_reserve_arg, int64_t user_channel_id_arg, int64_t balance_msat_arg, int64_t outbound_capacity_msat_arg, int64_t next_outbound_htlc_limit_msat_arg, int64_t inbound_capacity_msat_arg, uint64_t confirmations_required_arg, uint64_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_channel_ready_arg, jboolean is_usable_arg, jboolean is_public_arg, uint64_t inbound_htlc_minimum_msat_arg, uint64_t inbound_htlc_maximum_msat_arg, uint64_t config_arg) {
26748         LDKThirtyTwoBytes channel_id_arg_ref;
26749         CHECK(channel_id_arg->arr_len == 32);
26750         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
26751         LDKChannelCounterparty counterparty_arg_conv;
26752         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
26753         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
26754         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
26755         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
26756         LDKOutPoint funding_txo_arg_conv;
26757         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
26758         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
26759         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
26760         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
26761         LDKChannelTypeFeatures channel_type_arg_conv;
26762         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
26763         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
26764         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
26765         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
26766         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
26767         CHECK_ACCESS(short_channel_id_arg_ptr);
26768         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
26769         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
26770         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
26771         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
26772         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
26773         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
26774         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
26775         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
26776         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
26777         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
26778         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
26779         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
26780         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
26781         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
26782         CHECK_ACCESS(confirmations_required_arg_ptr);
26783         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
26784         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
26785         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
26786         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
26787         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
26788         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
26789         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
26790         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
26791         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
26792         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
26793         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
26794         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
26795         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
26796         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
26797         LDKChannelConfig config_arg_conv;
26798         config_arg_conv.inner = untag_ptr(config_arg);
26799         config_arg_conv.is_owned = ptr_is_owned(config_arg);
26800         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
26801         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
26802         LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, channel_type_arg_conv, short_channel_id_arg_conv, outbound_scid_alias_arg_conv, inbound_scid_alias_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg, balance_msat_arg, outbound_capacity_msat_arg, next_outbound_htlc_limit_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_channel_ready_arg, is_usable_arg, is_public_arg, inbound_htlc_minimum_msat_arg_conv, inbound_htlc_maximum_msat_arg_conv, config_arg_conv);
26803         uint64_t ret_ref = 0;
26804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26806         return ret_ref;
26807 }
26808
26809 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
26810         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
26811         uint64_t ret_ref = 0;
26812         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26813         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26814         return ret_ref;
26815 }
26816 int64_t  __attribute__((export_name("TS_ChannelDetails_clone_ptr"))) TS_ChannelDetails_clone_ptr(uint64_t arg) {
26817         LDKChannelDetails arg_conv;
26818         arg_conv.inner = untag_ptr(arg);
26819         arg_conv.is_owned = ptr_is_owned(arg);
26820         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
26821         arg_conv.is_owned = false;
26822         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
26823         return ret_conv;
26824 }
26825
26826 uint64_t  __attribute__((export_name("TS_ChannelDetails_clone"))) TS_ChannelDetails_clone(uint64_t orig) {
26827         LDKChannelDetails orig_conv;
26828         orig_conv.inner = untag_ptr(orig);
26829         orig_conv.is_owned = ptr_is_owned(orig);
26830         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
26831         orig_conv.is_owned = false;
26832         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
26833         uint64_t ret_ref = 0;
26834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
26835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
26836         return ret_ref;
26837 }
26838
26839 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_payment_scid"))) TS_ChannelDetails_get_inbound_payment_scid(uint64_t this_arg) {
26840         LDKChannelDetails this_arg_conv;
26841         this_arg_conv.inner = untag_ptr(this_arg);
26842         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26844         this_arg_conv.is_owned = false;
26845         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26846         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
26847         uint64_t ret_ref = tag_ptr(ret_copy, true);
26848         return ret_ref;
26849 }
26850
26851 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_payment_scid"))) TS_ChannelDetails_get_outbound_payment_scid(uint64_t this_arg) {
26852         LDKChannelDetails this_arg_conv;
26853         this_arg_conv.inner = untag_ptr(this_arg);
26854         this_arg_conv.is_owned = ptr_is_owned(this_arg);
26855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
26856         this_arg_conv.is_owned = false;
26857         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26858         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
26859         uint64_t ret_ref = tag_ptr(ret_copy, true);
26860         return ret_ref;
26861 }
26862
26863 void  __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint64_t this_ptr) {
26864         if (!ptr_is_owned(this_ptr)) return;
26865         void* this_ptr_ptr = untag_ptr(this_ptr);
26866         CHECK_ACCESS(this_ptr_ptr);
26867         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
26868         FREE(untag_ptr(this_ptr));
26869         PaymentSendFailure_free(this_ptr_conv);
26870 }
26871
26872 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
26873         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
26874         *ret_copy = PaymentSendFailure_clone(arg);
26875         uint64_t ret_ref = tag_ptr(ret_copy, true);
26876         return ret_ref;
26877 }
26878 int64_t  __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint64_t arg) {
26879         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
26880         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
26881         return ret_conv;
26882 }
26883
26884 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint64_t orig) {
26885         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
26886         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
26887         *ret_copy = PaymentSendFailure_clone(orig_conv);
26888         uint64_t ret_ref = tag_ptr(ret_copy, true);
26889         return ret_ref;
26890 }
26891
26892 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint64_t a) {
26893         void* a_ptr = untag_ptr(a);
26894         CHECK_ACCESS(a_ptr);
26895         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
26896         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
26897         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
26898         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
26899         uint64_t ret_ref = tag_ptr(ret_copy, true);
26900         return ret_ref;
26901 }
26902
26903 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint64_tArray a) {
26904         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
26905         a_constr.datalen = a->arr_len;
26906         if (a_constr.datalen > 0)
26907                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
26908         else
26909                 a_constr.data = NULL;
26910         uint64_t* a_vals = a->elems;
26911         for (size_t w = 0; w < a_constr.datalen; w++) {
26912                 uint64_t a_conv_22 = a_vals[w];
26913                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
26914                 CHECK_ACCESS(a_conv_22_ptr);
26915                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
26916                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
26917                 a_constr.data[w] = a_conv_22_conv;
26918         }
26919         FREE(a);
26920         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
26921         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
26922         uint64_t ret_ref = tag_ptr(ret_copy, true);
26923         return ret_ref;
26924 }
26925
26926 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_all_failed_retry_safe"))) TS_PaymentSendFailure_all_failed_retry_safe(uint64_tArray a) {
26927         LDKCVec_APIErrorZ a_constr;
26928         a_constr.datalen = a->arr_len;
26929         if (a_constr.datalen > 0)
26930                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
26931         else
26932                 a_constr.data = NULL;
26933         uint64_t* a_vals = a->elems;
26934         for (size_t k = 0; k < a_constr.datalen; k++) {
26935                 uint64_t a_conv_10 = a_vals[k];
26936                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
26937                 CHECK_ACCESS(a_conv_10_ptr);
26938                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
26939                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
26940                 a_constr.data[k] = a_conv_10_conv;
26941         }
26942         FREE(a);
26943         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
26944         *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr);
26945         uint64_t ret_ref = tag_ptr(ret_copy, true);
26946         return ret_ref;
26947 }
26948
26949 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) {
26950         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
26951         results_constr.datalen = results->arr_len;
26952         if (results_constr.datalen > 0)
26953                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
26954         else
26955                 results_constr.data = NULL;
26956         uint64_t* results_vals = results->elems;
26957         for (size_t w = 0; w < results_constr.datalen; w++) {
26958                 uint64_t results_conv_22 = results_vals[w];
26959                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
26960                 CHECK_ACCESS(results_conv_22_ptr);
26961                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
26962                 results_constr.data[w] = results_conv_22_conv;
26963         }
26964         FREE(results);
26965         LDKRouteParameters failed_paths_retry_conv;
26966         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
26967         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
26968         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
26969         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
26970         LDKThirtyTwoBytes payment_id_ref;
26971         CHECK(payment_id->arr_len == 32);
26972         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
26973         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
26974         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
26975         uint64_t ret_ref = tag_ptr(ret_copy, true);
26976         return ret_ref;
26977 }
26978
26979 void  __attribute__((export_name("TS_PhantomRouteHints_free"))) TS_PhantomRouteHints_free(uint64_t this_obj) {
26980         LDKPhantomRouteHints this_obj_conv;
26981         this_obj_conv.inner = untag_ptr(this_obj);
26982         this_obj_conv.is_owned = ptr_is_owned(this_obj);
26983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
26984         PhantomRouteHints_free(this_obj_conv);
26985 }
26986
26987 uint64_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_channels"))) TS_PhantomRouteHints_get_channels(uint64_t this_ptr) {
26988         LDKPhantomRouteHints this_ptr_conv;
26989         this_ptr_conv.inner = untag_ptr(this_ptr);
26990         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
26991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
26992         this_ptr_conv.is_owned = false;
26993         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
26994         uint64_tArray ret_arr = NULL;
26995         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
26996         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
26997         for (size_t q = 0; q < ret_var.datalen; q++) {
26998                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
26999                 uint64_t ret_conv_16_ref = 0;
27000                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
27001                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
27002                 ret_arr_ptr[q] = ret_conv_16_ref;
27003         }
27004         
27005         FREE(ret_var.data);
27006         return ret_arr;
27007 }
27008
27009 void  __attribute__((export_name("TS_PhantomRouteHints_set_channels"))) TS_PhantomRouteHints_set_channels(uint64_t this_ptr, uint64_tArray val) {
27010         LDKPhantomRouteHints this_ptr_conv;
27011         this_ptr_conv.inner = untag_ptr(this_ptr);
27012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27014         this_ptr_conv.is_owned = false;
27015         LDKCVec_ChannelDetailsZ val_constr;
27016         val_constr.datalen = val->arr_len;
27017         if (val_constr.datalen > 0)
27018                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
27019         else
27020                 val_constr.data = NULL;
27021         uint64_t* val_vals = val->elems;
27022         for (size_t q = 0; q < val_constr.datalen; q++) {
27023                 uint64_t val_conv_16 = val_vals[q];
27024                 LDKChannelDetails val_conv_16_conv;
27025                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
27026                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
27027                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
27028                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
27029                 val_constr.data[q] = val_conv_16_conv;
27030         }
27031         FREE(val);
27032         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
27033 }
27034
27035 int64_t  __attribute__((export_name("TS_PhantomRouteHints_get_phantom_scid"))) TS_PhantomRouteHints_get_phantom_scid(uint64_t this_ptr) {
27036         LDKPhantomRouteHints this_ptr_conv;
27037         this_ptr_conv.inner = untag_ptr(this_ptr);
27038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27040         this_ptr_conv.is_owned = false;
27041         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
27042         return ret_conv;
27043 }
27044
27045 void  __attribute__((export_name("TS_PhantomRouteHints_set_phantom_scid"))) TS_PhantomRouteHints_set_phantom_scid(uint64_t this_ptr, int64_t val) {
27046         LDKPhantomRouteHints this_ptr_conv;
27047         this_ptr_conv.inner = untag_ptr(this_ptr);
27048         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27050         this_ptr_conv.is_owned = false;
27051         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
27052 }
27053
27054 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_real_node_pubkey"))) TS_PhantomRouteHints_get_real_node_pubkey(uint64_t this_ptr) {
27055         LDKPhantomRouteHints this_ptr_conv;
27056         this_ptr_conv.inner = untag_ptr(this_ptr);
27057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27059         this_ptr_conv.is_owned = false;
27060         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27061         memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
27062         return ret_arr;
27063 }
27064
27065 void  __attribute__((export_name("TS_PhantomRouteHints_set_real_node_pubkey"))) TS_PhantomRouteHints_set_real_node_pubkey(uint64_t this_ptr, int8_tArray val) {
27066         LDKPhantomRouteHints this_ptr_conv;
27067         this_ptr_conv.inner = untag_ptr(this_ptr);
27068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27070         this_ptr_conv.is_owned = false;
27071         LDKPublicKey val_ref;
27072         CHECK(val->arr_len == 33);
27073         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
27074         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
27075 }
27076
27077 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) {
27078         LDKCVec_ChannelDetailsZ channels_arg_constr;
27079         channels_arg_constr.datalen = channels_arg->arr_len;
27080         if (channels_arg_constr.datalen > 0)
27081                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
27082         else
27083                 channels_arg_constr.data = NULL;
27084         uint64_t* channels_arg_vals = channels_arg->elems;
27085         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
27086                 uint64_t channels_arg_conv_16 = channels_arg_vals[q];
27087                 LDKChannelDetails channels_arg_conv_16_conv;
27088                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
27089                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
27090                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
27091                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
27092                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
27093         }
27094         FREE(channels_arg);
27095         LDKPublicKey real_node_pubkey_arg_ref;
27096         CHECK(real_node_pubkey_arg->arr_len == 33);
27097         memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
27098         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
27099         uint64_t ret_ref = 0;
27100         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27101         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27102         return ret_ref;
27103 }
27104
27105 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
27106         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
27107         uint64_t ret_ref = 0;
27108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27109         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27110         return ret_ref;
27111 }
27112 int64_t  __attribute__((export_name("TS_PhantomRouteHints_clone_ptr"))) TS_PhantomRouteHints_clone_ptr(uint64_t arg) {
27113         LDKPhantomRouteHints arg_conv;
27114         arg_conv.inner = untag_ptr(arg);
27115         arg_conv.is_owned = ptr_is_owned(arg);
27116         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27117         arg_conv.is_owned = false;
27118         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
27119         return ret_conv;
27120 }
27121
27122 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_clone"))) TS_PhantomRouteHints_clone(uint64_t orig) {
27123         LDKPhantomRouteHints orig_conv;
27124         orig_conv.inner = untag_ptr(orig);
27125         orig_conv.is_owned = ptr_is_owned(orig);
27126         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27127         orig_conv.is_owned = false;
27128         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
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
27135 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) {
27136         void* fee_est_ptr = untag_ptr(fee_est);
27137         CHECK_ACCESS(fee_est_ptr);
27138         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
27139         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
27140                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27141                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
27142         }
27143         void* chain_monitor_ptr = untag_ptr(chain_monitor);
27144         CHECK_ACCESS(chain_monitor_ptr);
27145         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
27146         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
27147                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27148                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
27149         }
27150         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
27151         CHECK_ACCESS(tx_broadcaster_ptr);
27152         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
27153         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
27154                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27155                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
27156         }
27157         void* logger_ptr = untag_ptr(logger);
27158         CHECK_ACCESS(logger_ptr);
27159         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
27160         if (logger_conv.free == LDKLogger_JCalls_free) {
27161                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27162                 LDKLogger_JCalls_cloned(&logger_conv);
27163         }
27164         void* keys_manager_ptr = untag_ptr(keys_manager);
27165         CHECK_ACCESS(keys_manager_ptr);
27166         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
27167         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
27168                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27169                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
27170         }
27171         LDKUserConfig config_conv;
27172         config_conv.inner = untag_ptr(config);
27173         config_conv.is_owned = ptr_is_owned(config);
27174         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
27175         config_conv = UserConfig_clone(&config_conv);
27176         LDKChainParameters params_conv;
27177         params_conv.inner = untag_ptr(params);
27178         params_conv.is_owned = ptr_is_owned(params);
27179         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
27180         params_conv = ChainParameters_clone(&params_conv);
27181         LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
27182         uint64_t ret_ref = 0;
27183         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27184         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27185         return ret_ref;
27186 }
27187
27188 uint64_t  __attribute__((export_name("TS_ChannelManager_get_current_default_configuration"))) TS_ChannelManager_get_current_default_configuration(uint64_t this_arg) {
27189         LDKChannelManager this_arg_conv;
27190         this_arg_conv.inner = untag_ptr(this_arg);
27191         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27193         this_arg_conv.is_owned = false;
27194         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_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 uint64_t  __attribute__((export_name("TS_ChannelManager_create_channel"))) TS_ChannelManager_create_channel(uint64_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int64_t user_channel_id, uint64_t override_config) {
27202         LDKChannelManager this_arg_conv;
27203         this_arg_conv.inner = untag_ptr(this_arg);
27204         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27206         this_arg_conv.is_owned = false;
27207         LDKPublicKey their_network_key_ref;
27208         CHECK(their_network_key->arr_len == 33);
27209         memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
27210         LDKUserConfig override_config_conv;
27211         override_config_conv.inner = untag_ptr(override_config);
27212         override_config_conv.is_owned = ptr_is_owned(override_config);
27213         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
27214         override_config_conv = UserConfig_clone(&override_config_conv);
27215         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
27216         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
27217         return tag_ptr(ret_conv, true);
27218 }
27219
27220 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_channels"))) TS_ChannelManager_list_channels(uint64_t this_arg) {
27221         LDKChannelManager this_arg_conv;
27222         this_arg_conv.inner = untag_ptr(this_arg);
27223         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27225         this_arg_conv.is_owned = false;
27226         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
27227         uint64_tArray ret_arr = NULL;
27228         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
27229         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
27230         for (size_t q = 0; q < ret_var.datalen; q++) {
27231                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
27232                 uint64_t ret_conv_16_ref = 0;
27233                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
27234                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
27235                 ret_arr_ptr[q] = ret_conv_16_ref;
27236         }
27237         
27238         FREE(ret_var.data);
27239         return ret_arr;
27240 }
27241
27242 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_usable_channels"))) TS_ChannelManager_list_usable_channels(uint64_t this_arg) {
27243         LDKChannelManager this_arg_conv;
27244         this_arg_conv.inner = untag_ptr(this_arg);
27245         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27247         this_arg_conv.is_owned = false;
27248         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
27249         uint64_tArray ret_arr = NULL;
27250         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
27251         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
27252         for (size_t q = 0; q < ret_var.datalen; q++) {
27253                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
27254                 uint64_t ret_conv_16_ref = 0;
27255                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
27256                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
27257                 ret_arr_ptr[q] = ret_conv_16_ref;
27258         }
27259         
27260         FREE(ret_var.data);
27261         return ret_arr;
27262 }
27263
27264 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) {
27265         LDKChannelManager this_arg_conv;
27266         this_arg_conv.inner = untag_ptr(this_arg);
27267         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27269         this_arg_conv.is_owned = false;
27270         unsigned char channel_id_arr[32];
27271         CHECK(channel_id->arr_len == 32);
27272         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
27273         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
27274         LDKPublicKey counterparty_node_id_ref;
27275         CHECK(counterparty_node_id->arr_len == 33);
27276         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27277         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27278         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
27279         return tag_ptr(ret_conv, true);
27280 }
27281
27282 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) {
27283         LDKChannelManager this_arg_conv;
27284         this_arg_conv.inner = untag_ptr(this_arg);
27285         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27287         this_arg_conv.is_owned = false;
27288         unsigned char channel_id_arr[32];
27289         CHECK(channel_id->arr_len == 32);
27290         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
27291         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
27292         LDKPublicKey counterparty_node_id_ref;
27293         CHECK(counterparty_node_id->arr_len == 33);
27294         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27295         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27296         *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, counterparty_node_id_ref, target_feerate_sats_per_1000_weight);
27297         return tag_ptr(ret_conv, true);
27298 }
27299
27300 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) {
27301         LDKChannelManager this_arg_conv;
27302         this_arg_conv.inner = untag_ptr(this_arg);
27303         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27305         this_arg_conv.is_owned = false;
27306         unsigned char channel_id_arr[32];
27307         CHECK(channel_id->arr_len == 32);
27308         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
27309         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
27310         LDKPublicKey counterparty_node_id_ref;
27311         CHECK(counterparty_node_id->arr_len == 33);
27312         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27313         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27314         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
27315         return tag_ptr(ret_conv, true);
27316 }
27317
27318 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) {
27319         LDKChannelManager this_arg_conv;
27320         this_arg_conv.inner = untag_ptr(this_arg);
27321         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27323         this_arg_conv.is_owned = false;
27324         unsigned char channel_id_arr[32];
27325         CHECK(channel_id->arr_len == 32);
27326         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
27327         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
27328         LDKPublicKey counterparty_node_id_ref;
27329         CHECK(counterparty_node_id->arr_len == 33);
27330         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27331         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27332         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
27333         return tag_ptr(ret_conv, true);
27334 }
27335
27336 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) {
27337         LDKChannelManager this_arg_conv;
27338         this_arg_conv.inner = untag_ptr(this_arg);
27339         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27341         this_arg_conv.is_owned = false;
27342         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
27343 }
27344
27345 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) {
27346         LDKChannelManager this_arg_conv;
27347         this_arg_conv.inner = untag_ptr(this_arg);
27348         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27350         this_arg_conv.is_owned = false;
27351         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
27352 }
27353
27354 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) {
27355         LDKChannelManager this_arg_conv;
27356         this_arg_conv.inner = untag_ptr(this_arg);
27357         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27359         this_arg_conv.is_owned = false;
27360         LDKRoute route_conv;
27361         route_conv.inner = untag_ptr(route);
27362         route_conv.is_owned = ptr_is_owned(route);
27363         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
27364         route_conv.is_owned = false;
27365         LDKThirtyTwoBytes payment_hash_ref;
27366         CHECK(payment_hash->arr_len == 32);
27367         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
27368         LDKThirtyTwoBytes payment_secret_ref;
27369         CHECK(payment_secret->arr_len == 32);
27370         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
27371         LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
27372         *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
27373         return tag_ptr(ret_conv, true);
27374 }
27375
27376 uint64_t  __attribute__((export_name("TS_ChannelManager_retry_payment"))) TS_ChannelManager_retry_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_id) {
27377         LDKChannelManager this_arg_conv;
27378         this_arg_conv.inner = untag_ptr(this_arg);
27379         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27381         this_arg_conv.is_owned = false;
27382         LDKRoute route_conv;
27383         route_conv.inner = untag_ptr(route);
27384         route_conv.is_owned = ptr_is_owned(route);
27385         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
27386         route_conv.is_owned = false;
27387         LDKThirtyTwoBytes payment_id_ref;
27388         CHECK(payment_id->arr_len == 32);
27389         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
27390         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
27391         *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
27392         return tag_ptr(ret_conv, true);
27393 }
27394
27395 void  __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_ChannelManager_abandon_payment(uint64_t this_arg, int8_tArray payment_id) {
27396         LDKChannelManager this_arg_conv;
27397         this_arg_conv.inner = untag_ptr(this_arg);
27398         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27400         this_arg_conv.is_owned = false;
27401         LDKThirtyTwoBytes payment_id_ref;
27402         CHECK(payment_id->arr_len == 32);
27403         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
27404         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
27405 }
27406
27407 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) {
27408         LDKChannelManager this_arg_conv;
27409         this_arg_conv.inner = untag_ptr(this_arg);
27410         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27412         this_arg_conv.is_owned = false;
27413         LDKRoute route_conv;
27414         route_conv.inner = untag_ptr(route);
27415         route_conv.is_owned = ptr_is_owned(route);
27416         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
27417         route_conv.is_owned = false;
27418         LDKThirtyTwoBytes payment_preimage_ref;
27419         CHECK(payment_preimage->arr_len == 32);
27420         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
27421         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
27422         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
27423         return tag_ptr(ret_conv, true);
27424 }
27425
27426 uint64_t  __attribute__((export_name("TS_ChannelManager_send_probe"))) TS_ChannelManager_send_probe(uint64_t this_arg, uint64_tArray hops) {
27427         LDKChannelManager this_arg_conv;
27428         this_arg_conv.inner = untag_ptr(this_arg);
27429         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27431         this_arg_conv.is_owned = false;
27432         LDKCVec_RouteHopZ hops_constr;
27433         hops_constr.datalen = hops->arr_len;
27434         if (hops_constr.datalen > 0)
27435                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
27436         else
27437                 hops_constr.data = NULL;
27438         uint64_t* hops_vals = hops->elems;
27439         for (size_t k = 0; k < hops_constr.datalen; k++) {
27440                 uint64_t hops_conv_10 = hops_vals[k];
27441                 LDKRouteHop hops_conv_10_conv;
27442                 hops_conv_10_conv.inner = untag_ptr(hops_conv_10);
27443                 hops_conv_10_conv.is_owned = ptr_is_owned(hops_conv_10);
27444                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv_10_conv);
27445                 hops_conv_10_conv = RouteHop_clone(&hops_conv_10_conv);
27446                 hops_constr.data[k] = hops_conv_10_conv;
27447         }
27448         FREE(hops);
27449         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
27450         *ret_conv = ChannelManager_send_probe(&this_arg_conv, hops_constr);
27451         return tag_ptr(ret_conv, true);
27452 }
27453
27454 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) {
27455         LDKChannelManager this_arg_conv;
27456         this_arg_conv.inner = untag_ptr(this_arg);
27457         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27459         this_arg_conv.is_owned = false;
27460         unsigned char temporary_channel_id_arr[32];
27461         CHECK(temporary_channel_id->arr_len == 32);
27462         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
27463         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
27464         LDKPublicKey counterparty_node_id_ref;
27465         CHECK(counterparty_node_id->arr_len == 33);
27466         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27467         LDKTransaction funding_transaction_ref;
27468         funding_transaction_ref.datalen = funding_transaction->arr_len;
27469         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
27470         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
27471         funding_transaction_ref.data_is_owned = true;
27472         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27473         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
27474         return tag_ptr(ret_conv, true);
27475 }
27476
27477 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) {
27478         LDKChannelManager this_arg_conv;
27479         this_arg_conv.inner = untag_ptr(this_arg);
27480         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27482         this_arg_conv.is_owned = false;
27483         LDKPublicKey counterparty_node_id_ref;
27484         CHECK(counterparty_node_id->arr_len == 33);
27485         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27486         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
27487         channel_ids_constr.datalen = channel_ids->arr_len;
27488         if (channel_ids_constr.datalen > 0)
27489                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
27490         else
27491                 channel_ids_constr.data = NULL;
27492         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
27493         for (size_t m = 0; m < channel_ids_constr.datalen; m++) {
27494                 int8_tArray channel_ids_conv_12 = channel_ids_vals[m];
27495                 LDKThirtyTwoBytes channel_ids_conv_12_ref;
27496                 CHECK(channel_ids_conv_12->arr_len == 32);
27497                 memcpy(channel_ids_conv_12_ref.data, channel_ids_conv_12->elems, 32); FREE(channel_ids_conv_12);
27498                 channel_ids_constr.data[m] = channel_ids_conv_12_ref;
27499         }
27500         FREE(channel_ids);
27501         LDKChannelConfig config_conv;
27502         config_conv.inner = untag_ptr(config);
27503         config_conv.is_owned = ptr_is_owned(config);
27504         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
27505         config_conv.is_owned = false;
27506         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27507         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
27508         return tag_ptr(ret_conv, true);
27509 }
27510
27511 void  __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint64_t this_arg) {
27512         LDKChannelManager this_arg_conv;
27513         this_arg_conv.inner = untag_ptr(this_arg);
27514         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27516         this_arg_conv.is_owned = false;
27517         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
27518 }
27519
27520 void  __attribute__((export_name("TS_ChannelManager_timer_tick_occurred"))) TS_ChannelManager_timer_tick_occurred(uint64_t this_arg) {
27521         LDKChannelManager this_arg_conv;
27522         this_arg_conv.inner = untag_ptr(this_arg);
27523         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27525         this_arg_conv.is_owned = false;
27526         ChannelManager_timer_tick_occurred(&this_arg_conv);
27527 }
27528
27529 void  __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_ChannelManager_fail_htlc_backwards(uint64_t this_arg, int8_tArray payment_hash) {
27530         LDKChannelManager this_arg_conv;
27531         this_arg_conv.inner = untag_ptr(this_arg);
27532         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27534         this_arg_conv.is_owned = false;
27535         unsigned char payment_hash_arr[32];
27536         CHECK(payment_hash->arr_len == 32);
27537         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
27538         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
27539         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
27540 }
27541
27542 void  __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint64_t this_arg, int8_tArray payment_preimage) {
27543         LDKChannelManager this_arg_conv;
27544         this_arg_conv.inner = untag_ptr(this_arg);
27545         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27547         this_arg_conv.is_owned = false;
27548         LDKThirtyTwoBytes payment_preimage_ref;
27549         CHECK(payment_preimage->arr_len == 32);
27550         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
27551         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
27552 }
27553
27554 int8_tArray  __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) TS_ChannelManager_get_our_node_id(uint64_t this_arg) {
27555         LDKChannelManager this_arg_conv;
27556         this_arg_conv.inner = untag_ptr(this_arg);
27557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27559         this_arg_conv.is_owned = false;
27560         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
27561         memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
27562         return ret_arr;
27563 }
27564
27565 uint64_t  __attribute__((export_name("TS_ChannelManager_accept_inbound_channel"))) TS_ChannelManager_accept_inbound_channel(uint64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t user_channel_id) {
27566         LDKChannelManager this_arg_conv;
27567         this_arg_conv.inner = untag_ptr(this_arg);
27568         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27570         this_arg_conv.is_owned = false;
27571         unsigned char temporary_channel_id_arr[32];
27572         CHECK(temporary_channel_id->arr_len == 32);
27573         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
27574         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
27575         LDKPublicKey counterparty_node_id_ref;
27576         CHECK(counterparty_node_id->arr_len == 33);
27577         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27578         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27579         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
27580         return tag_ptr(ret_conv, true);
27581 }
27582
27583 uint64_t  __attribute__((export_name("TS_ChannelManager_accept_inbound_channel_from_trusted_peer_0conf"))) TS_ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(uint64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t user_channel_id) {
27584         LDKChannelManager this_arg_conv;
27585         this_arg_conv.inner = untag_ptr(this_arg);
27586         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27588         this_arg_conv.is_owned = false;
27589         unsigned char temporary_channel_id_arr[32];
27590         CHECK(temporary_channel_id->arr_len == 32);
27591         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
27592         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
27593         LDKPublicKey counterparty_node_id_ref;
27594         CHECK(counterparty_node_id->arr_len == 33);
27595         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
27596         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
27597         *ret_conv = ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id);
27598         return tag_ptr(ret_conv, true);
27599 }
27600
27601 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) {
27602         LDKChannelManager this_arg_conv;
27603         this_arg_conv.inner = untag_ptr(this_arg);
27604         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27606         this_arg_conv.is_owned = false;
27607         void* min_value_msat_ptr = untag_ptr(min_value_msat);
27608         CHECK_ACCESS(min_value_msat_ptr);
27609         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
27610         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
27611         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
27612         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
27613         return tag_ptr(ret_conv, true);
27614 }
27615
27616 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) {
27617         LDKChannelManager this_arg_conv;
27618         this_arg_conv.inner = untag_ptr(this_arg);
27619         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27621         this_arg_conv.is_owned = false;
27622         void* min_value_msat_ptr = untag_ptr(min_value_msat);
27623         CHECK_ACCESS(min_value_msat_ptr);
27624         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
27625         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
27626         LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ");
27627         *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs);
27628         return tag_ptr(ret_conv, true);
27629 }
27630
27631 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) {
27632         LDKChannelManager this_arg_conv;
27633         this_arg_conv.inner = untag_ptr(this_arg);
27634         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27636         this_arg_conv.is_owned = false;
27637         LDKThirtyTwoBytes payment_hash_ref;
27638         CHECK(payment_hash->arr_len == 32);
27639         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
27640         void* min_value_msat_ptr = untag_ptr(min_value_msat);
27641         CHECK_ACCESS(min_value_msat_ptr);
27642         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
27643         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
27644         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
27645         *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
27646         return tag_ptr(ret_conv, true);
27647 }
27648
27649 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) {
27650         LDKChannelManager this_arg_conv;
27651         this_arg_conv.inner = untag_ptr(this_arg);
27652         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27654         this_arg_conv.is_owned = false;
27655         LDKThirtyTwoBytes payment_hash_ref;
27656         CHECK(payment_hash->arr_len == 32);
27657         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
27658         void* min_value_msat_ptr = untag_ptr(min_value_msat);
27659         CHECK_ACCESS(min_value_msat_ptr);
27660         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
27661         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
27662         LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
27663         *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs);
27664         return tag_ptr(ret_conv, true);
27665 }
27666
27667 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) {
27668         LDKChannelManager this_arg_conv;
27669         this_arg_conv.inner = untag_ptr(this_arg);
27670         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27672         this_arg_conv.is_owned = false;
27673         LDKThirtyTwoBytes payment_hash_ref;
27674         CHECK(payment_hash->arr_len == 32);
27675         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
27676         LDKThirtyTwoBytes payment_secret_ref;
27677         CHECK(payment_secret->arr_len == 32);
27678         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
27679         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
27680         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
27681         return tag_ptr(ret_conv, true);
27682 }
27683
27684 int64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_scid"))) TS_ChannelManager_get_phantom_scid(uint64_t this_arg) {
27685         LDKChannelManager this_arg_conv;
27686         this_arg_conv.inner = untag_ptr(this_arg);
27687         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27689         this_arg_conv.is_owned = false;
27690         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
27691         return ret_conv;
27692 }
27693
27694 uint64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_route_hints"))) TS_ChannelManager_get_phantom_route_hints(uint64_t this_arg) {
27695         LDKChannelManager this_arg_conv;
27696         this_arg_conv.inner = untag_ptr(this_arg);
27697         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27699         this_arg_conv.is_owned = false;
27700         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
27701         uint64_t ret_ref = 0;
27702         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27703         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27704         return ret_ref;
27705 }
27706
27707 uint64_t  __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint64_t this_arg) {
27708         LDKChannelManager this_arg_conv;
27709         this_arg_conv.inner = untag_ptr(this_arg);
27710         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27712         this_arg_conv.is_owned = false;
27713         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
27714         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
27715         return tag_ptr(ret_ret, true);
27716 }
27717
27718 uint64_t  __attribute__((export_name("TS_ChannelManager_as_EventsProvider"))) TS_ChannelManager_as_EventsProvider(uint64_t this_arg) {
27719         LDKChannelManager this_arg_conv;
27720         this_arg_conv.inner = untag_ptr(this_arg);
27721         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27723         this_arg_conv.is_owned = false;
27724         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
27725         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
27726         return tag_ptr(ret_ret, true);
27727 }
27728
27729 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Listen"))) TS_ChannelManager_as_Listen(uint64_t this_arg) {
27730         LDKChannelManager this_arg_conv;
27731         this_arg_conv.inner = untag_ptr(this_arg);
27732         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27734         this_arg_conv.is_owned = false;
27735         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
27736         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
27737         return tag_ptr(ret_ret, true);
27738 }
27739
27740 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Confirm"))) TS_ChannelManager_as_Confirm(uint64_t this_arg) {
27741         LDKChannelManager this_arg_conv;
27742         this_arg_conv.inner = untag_ptr(this_arg);
27743         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27745         this_arg_conv.is_owned = false;
27746         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
27747         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
27748         return tag_ptr(ret_ret, true);
27749 }
27750
27751 void  __attribute__((export_name("TS_ChannelManager_await_persistable_update"))) TS_ChannelManager_await_persistable_update(uint64_t this_arg) {
27752         LDKChannelManager this_arg_conv;
27753         this_arg_conv.inner = untag_ptr(this_arg);
27754         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27756         this_arg_conv.is_owned = false;
27757         ChannelManager_await_persistable_update(&this_arg_conv);
27758 }
27759
27760 uint64_t  __attribute__((export_name("TS_ChannelManager_get_persistable_update_future"))) TS_ChannelManager_get_persistable_update_future(uint64_t this_arg) {
27761         LDKChannelManager this_arg_conv;
27762         this_arg_conv.inner = untag_ptr(this_arg);
27763         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27765         this_arg_conv.is_owned = false;
27766         LDKFuture ret_var = ChannelManager_get_persistable_update_future(&this_arg_conv);
27767         uint64_t ret_ref = 0;
27768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27770         return ret_ref;
27771 }
27772
27773 uint64_t  __attribute__((export_name("TS_ChannelManager_current_best_block"))) TS_ChannelManager_current_best_block(uint64_t this_arg) {
27774         LDKChannelManager this_arg_conv;
27775         this_arg_conv.inner = untag_ptr(this_arg);
27776         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27778         this_arg_conv.is_owned = false;
27779         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
27780         uint64_t ret_ref = 0;
27781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27783         return ret_ref;
27784 }
27785
27786 uint64_t  __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(uint64_t this_arg) {
27787         LDKChannelManager this_arg_conv;
27788         this_arg_conv.inner = untag_ptr(this_arg);
27789         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27791         this_arg_conv.is_owned = false;
27792         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
27793         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
27794         return tag_ptr(ret_ret, true);
27795 }
27796
27797 int8_tArray  __attribute__((export_name("TS_CounterpartyForwardingInfo_write"))) TS_CounterpartyForwardingInfo_write(uint64_t obj) {
27798         LDKCounterpartyForwardingInfo obj_conv;
27799         obj_conv.inner = untag_ptr(obj);
27800         obj_conv.is_owned = ptr_is_owned(obj);
27801         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27802         obj_conv.is_owned = false;
27803         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
27804         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27805         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27806         CVec_u8Z_free(ret_var);
27807         return ret_arr;
27808 }
27809
27810 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_read"))) TS_CounterpartyForwardingInfo_read(int8_tArray ser) {
27811         LDKu8slice ser_ref;
27812         ser_ref.datalen = ser->arr_len;
27813         ser_ref.data = ser->elems;
27814         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
27815         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
27816         FREE(ser);
27817         return tag_ptr(ret_conv, true);
27818 }
27819
27820 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_write"))) TS_ChannelCounterparty_write(uint64_t obj) {
27821         LDKChannelCounterparty obj_conv;
27822         obj_conv.inner = untag_ptr(obj);
27823         obj_conv.is_owned = ptr_is_owned(obj);
27824         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27825         obj_conv.is_owned = false;
27826         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
27827         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27828         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27829         CVec_u8Z_free(ret_var);
27830         return ret_arr;
27831 }
27832
27833 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_read"))) TS_ChannelCounterparty_read(int8_tArray ser) {
27834         LDKu8slice ser_ref;
27835         ser_ref.datalen = ser->arr_len;
27836         ser_ref.data = ser->elems;
27837         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
27838         *ret_conv = ChannelCounterparty_read(ser_ref);
27839         FREE(ser);
27840         return tag_ptr(ret_conv, true);
27841 }
27842
27843 int8_tArray  __attribute__((export_name("TS_ChannelDetails_write"))) TS_ChannelDetails_write(uint64_t obj) {
27844         LDKChannelDetails obj_conv;
27845         obj_conv.inner = untag_ptr(obj);
27846         obj_conv.is_owned = ptr_is_owned(obj);
27847         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27848         obj_conv.is_owned = false;
27849         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
27850         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27851         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27852         CVec_u8Z_free(ret_var);
27853         return ret_arr;
27854 }
27855
27856 uint64_t  __attribute__((export_name("TS_ChannelDetails_read"))) TS_ChannelDetails_read(int8_tArray ser) {
27857         LDKu8slice ser_ref;
27858         ser_ref.datalen = ser->arr_len;
27859         ser_ref.data = ser->elems;
27860         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
27861         *ret_conv = ChannelDetails_read(ser_ref);
27862         FREE(ser);
27863         return tag_ptr(ret_conv, true);
27864 }
27865
27866 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_write"))) TS_PhantomRouteHints_write(uint64_t obj) {
27867         LDKPhantomRouteHints obj_conv;
27868         obj_conv.inner = untag_ptr(obj);
27869         obj_conv.is_owned = ptr_is_owned(obj);
27870         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27871         obj_conv.is_owned = false;
27872         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
27873         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27874         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27875         CVec_u8Z_free(ret_var);
27876         return ret_arr;
27877 }
27878
27879 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_read"))) TS_PhantomRouteHints_read(int8_tArray ser) {
27880         LDKu8slice ser_ref;
27881         ser_ref.datalen = ser->arr_len;
27882         ser_ref.data = ser->elems;
27883         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
27884         *ret_conv = PhantomRouteHints_read(ser_ref);
27885         FREE(ser);
27886         return tag_ptr(ret_conv, true);
27887 }
27888
27889 int8_tArray  __attribute__((export_name("TS_ChannelManager_write"))) TS_ChannelManager_write(uint64_t obj) {
27890         LDKChannelManager obj_conv;
27891         obj_conv.inner = untag_ptr(obj);
27892         obj_conv.is_owned = ptr_is_owned(obj);
27893         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27894         obj_conv.is_owned = false;
27895         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
27896         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27897         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27898         CVec_u8Z_free(ret_var);
27899         return ret_arr;
27900 }
27901
27902 void  __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelManagerReadArgs_free(uint64_t this_obj) {
27903         LDKChannelManagerReadArgs this_obj_conv;
27904         this_obj_conv.inner = untag_ptr(this_obj);
27905         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27907         ChannelManagerReadArgs_free(this_obj_conv);
27908 }
27909
27910 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_keys_manager"))) TS_ChannelManagerReadArgs_get_keys_manager(uint64_t this_ptr) {
27911         LDKChannelManagerReadArgs this_ptr_conv;
27912         this_ptr_conv.inner = untag_ptr(this_ptr);
27913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27915         this_ptr_conv.is_owned = false;
27916         // WARNING: This object doesn't live past this scope, needs clone!
27917         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv), false);
27918         return ret_ret;
27919 }
27920
27921 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_keys_manager"))) TS_ChannelManagerReadArgs_set_keys_manager(uint64_t this_ptr, uint64_t val) {
27922         LDKChannelManagerReadArgs this_ptr_conv;
27923         this_ptr_conv.inner = untag_ptr(this_ptr);
27924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27926         this_ptr_conv.is_owned = false;
27927         void* val_ptr = untag_ptr(val);
27928         CHECK_ACCESS(val_ptr);
27929         LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
27930         if (val_conv.free == LDKKeysInterface_JCalls_free) {
27931                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27932                 LDKKeysInterface_JCalls_cloned(&val_conv);
27933         }
27934         ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
27935 }
27936
27937 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint64_t this_ptr) {
27938         LDKChannelManagerReadArgs this_ptr_conv;
27939         this_ptr_conv.inner = untag_ptr(this_ptr);
27940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27942         this_ptr_conv.is_owned = false;
27943         // WARNING: This object doesn't live past this scope, needs clone!
27944         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
27945         return ret_ret;
27946 }
27947
27948 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_fee_estimator"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint64_t this_ptr, uint64_t val) {
27949         LDKChannelManagerReadArgs this_ptr_conv;
27950         this_ptr_conv.inner = untag_ptr(this_ptr);
27951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27953         this_ptr_conv.is_owned = false;
27954         void* val_ptr = untag_ptr(val);
27955         CHECK_ACCESS(val_ptr);
27956         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
27957         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
27958                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27959                 LDKFeeEstimator_JCalls_cloned(&val_conv);
27960         }
27961         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
27962 }
27963
27964 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_chain_monitor"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint64_t this_ptr) {
27965         LDKChannelManagerReadArgs this_ptr_conv;
27966         this_ptr_conv.inner = untag_ptr(this_ptr);
27967         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27969         this_ptr_conv.is_owned = false;
27970         // WARNING: This object doesn't live past this scope, needs clone!
27971         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
27972         return ret_ret;
27973 }
27974
27975 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_chain_monitor"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint64_t this_ptr, uint64_t val) {
27976         LDKChannelManagerReadArgs this_ptr_conv;
27977         this_ptr_conv.inner = untag_ptr(this_ptr);
27978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27980         this_ptr_conv.is_owned = false;
27981         void* val_ptr = untag_ptr(val);
27982         CHECK_ACCESS(val_ptr);
27983         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
27984         if (val_conv.free == LDKWatch_JCalls_free) {
27985                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
27986                 LDKWatch_JCalls_cloned(&val_conv);
27987         }
27988         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
27989 }
27990
27991 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_tx_broadcaster"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint64_t this_ptr) {
27992         LDKChannelManagerReadArgs this_ptr_conv;
27993         this_ptr_conv.inner = untag_ptr(this_ptr);
27994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27996         this_ptr_conv.is_owned = false;
27997         // WARNING: This object doesn't live past this scope, needs clone!
27998         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
27999         return ret_ret;
28000 }
28001
28002 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint64_t this_ptr, uint64_t val) {
28003         LDKChannelManagerReadArgs this_ptr_conv;
28004         this_ptr_conv.inner = untag_ptr(this_ptr);
28005         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28007         this_ptr_conv.is_owned = false;
28008         void* val_ptr = untag_ptr(val);
28009         CHECK_ACCESS(val_ptr);
28010         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
28011         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
28012                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28013                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
28014         }
28015         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
28016 }
28017
28018 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint64_t this_ptr) {
28019         LDKChannelManagerReadArgs this_ptr_conv;
28020         this_ptr_conv.inner = untag_ptr(this_ptr);
28021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28023         this_ptr_conv.is_owned = false;
28024         // WARNING: This object doesn't live past this scope, needs clone!
28025         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
28026         return ret_ret;
28027 }
28028
28029 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_logger"))) TS_ChannelManagerReadArgs_set_logger(uint64_t this_ptr, uint64_t val) {
28030         LDKChannelManagerReadArgs this_ptr_conv;
28031         this_ptr_conv.inner = untag_ptr(this_ptr);
28032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28034         this_ptr_conv.is_owned = false;
28035         void* val_ptr = untag_ptr(val);
28036         CHECK_ACCESS(val_ptr);
28037         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
28038         if (val_conv.free == LDKLogger_JCalls_free) {
28039                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28040                 LDKLogger_JCalls_cloned(&val_conv);
28041         }
28042         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
28043 }
28044
28045 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_default_config"))) TS_ChannelManagerReadArgs_get_default_config(uint64_t this_ptr) {
28046         LDKChannelManagerReadArgs this_ptr_conv;
28047         this_ptr_conv.inner = untag_ptr(this_ptr);
28048         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28050         this_ptr_conv.is_owned = false;
28051         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
28052         uint64_t ret_ref = 0;
28053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28055         return ret_ref;
28056 }
28057
28058 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config"))) TS_ChannelManagerReadArgs_set_default_config(uint64_t this_ptr, uint64_t val) {
28059         LDKChannelManagerReadArgs this_ptr_conv;
28060         this_ptr_conv.inner = untag_ptr(this_ptr);
28061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28063         this_ptr_conv.is_owned = false;
28064         LDKUserConfig val_conv;
28065         val_conv.inner = untag_ptr(val);
28066         val_conv.is_owned = ptr_is_owned(val);
28067         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28068         val_conv = UserConfig_clone(&val_conv);
28069         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
28070 }
28071
28072 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) {
28073         void* keys_manager_ptr = untag_ptr(keys_manager);
28074         CHECK_ACCESS(keys_manager_ptr);
28075         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
28076         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
28077                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28078                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
28079         }
28080         void* fee_estimator_ptr = untag_ptr(fee_estimator);
28081         CHECK_ACCESS(fee_estimator_ptr);
28082         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
28083         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
28084                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28085                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
28086         }
28087         void* chain_monitor_ptr = untag_ptr(chain_monitor);
28088         CHECK_ACCESS(chain_monitor_ptr);
28089         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
28090         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
28091                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28092                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
28093         }
28094         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
28095         CHECK_ACCESS(tx_broadcaster_ptr);
28096         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
28097         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
28098                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28099                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
28100         }
28101         void* logger_ptr = untag_ptr(logger);
28102         CHECK_ACCESS(logger_ptr);
28103         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
28104         if (logger_conv.free == LDKLogger_JCalls_free) {
28105                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28106                 LDKLogger_JCalls_cloned(&logger_conv);
28107         }
28108         LDKUserConfig default_config_conv;
28109         default_config_conv.inner = untag_ptr(default_config);
28110         default_config_conv.is_owned = ptr_is_owned(default_config);
28111         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
28112         default_config_conv = UserConfig_clone(&default_config_conv);
28113         LDKCVec_ChannelMonitorZ channel_monitors_constr;
28114         channel_monitors_constr.datalen = channel_monitors->arr_len;
28115         if (channel_monitors_constr.datalen > 0)
28116                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
28117         else
28118                 channel_monitors_constr.data = NULL;
28119         uint64_t* channel_monitors_vals = channel_monitors->elems;
28120         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
28121                 uint64_t channel_monitors_conv_16 = channel_monitors_vals[q];
28122                 LDKChannelMonitor channel_monitors_conv_16_conv;
28123                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
28124                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
28125                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
28126                 channel_monitors_conv_16_conv.is_owned = false;
28127                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
28128         }
28129         FREE(channel_monitors);
28130         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);
28131         uint64_t ret_ref = 0;
28132         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28133         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28134         return ret_ref;
28135 }
28136
28137 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_read"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint64_t arg) {
28138         LDKu8slice ser_ref;
28139         ser_ref.datalen = ser->arr_len;
28140         ser_ref.data = ser->elems;
28141         LDKChannelManagerReadArgs arg_conv;
28142         arg_conv.inner = untag_ptr(arg);
28143         arg_conv.is_owned = ptr_is_owned(arg);
28144         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28145         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
28146         
28147         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
28148         *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
28149         FREE(ser);
28150         return tag_ptr(ret_conv, true);
28151 }
28152
28153 void  __attribute__((export_name("TS_ExpandedKey_free"))) TS_ExpandedKey_free(uint64_t this_obj) {
28154         LDKExpandedKey this_obj_conv;
28155         this_obj_conv.inner = untag_ptr(this_obj);
28156         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28158         ExpandedKey_free(this_obj_conv);
28159 }
28160
28161 uint64_t  __attribute__((export_name("TS_ExpandedKey_new"))) TS_ExpandedKey_new(int8_tArray key_material) {
28162         unsigned char key_material_arr[32];
28163         CHECK(key_material->arr_len == 32);
28164         memcpy(key_material_arr, key_material->elems, 32); FREE(key_material);
28165         unsigned char (*key_material_ref)[32] = &key_material_arr;
28166         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
28167         uint64_t ret_ref = 0;
28168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28170         return ret_ref;
28171 }
28172
28173 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) {
28174         LDKExpandedKey keys_conv;
28175         keys_conv.inner = untag_ptr(keys);
28176         keys_conv.is_owned = ptr_is_owned(keys);
28177         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
28178         keys_conv.is_owned = false;
28179         void* min_value_msat_ptr = untag_ptr(min_value_msat);
28180         CHECK_ACCESS(min_value_msat_ptr);
28181         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
28182         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
28183         void* keys_manager_ptr = untag_ptr(keys_manager);
28184         if (ptr_is_owned(keys_manager)) { CHECK_ACCESS(keys_manager_ptr); }
28185         LDKKeysInterface* keys_manager_conv = (LDKKeysInterface*)keys_manager_ptr;
28186         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
28187         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, keys_manager_conv, current_time);
28188         return tag_ptr(ret_conv, true);
28189 }
28190
28191 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) {
28192         LDKExpandedKey keys_conv;
28193         keys_conv.inner = untag_ptr(keys);
28194         keys_conv.is_owned = ptr_is_owned(keys);
28195         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
28196         keys_conv.is_owned = false;
28197         void* min_value_msat_ptr = untag_ptr(min_value_msat);
28198         CHECK_ACCESS(min_value_msat_ptr);
28199         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
28200         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
28201         LDKThirtyTwoBytes payment_hash_ref;
28202         CHECK(payment_hash->arr_len == 32);
28203         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
28204         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
28205         *ret_conv = create_from_hash(&keys_conv, min_value_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, current_time);
28206         return tag_ptr(ret_conv, true);
28207 }
28208
28209 void  __attribute__((export_name("TS_DecodeError_free"))) TS_DecodeError_free(uint64_t this_obj) {
28210         LDKDecodeError this_obj_conv;
28211         this_obj_conv.inner = untag_ptr(this_obj);
28212         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28214         DecodeError_free(this_obj_conv);
28215 }
28216
28217 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
28218         LDKDecodeError ret_var = DecodeError_clone(arg);
28219         uint64_t ret_ref = 0;
28220         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28221         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28222         return ret_ref;
28223 }
28224 int64_t  __attribute__((export_name("TS_DecodeError_clone_ptr"))) TS_DecodeError_clone_ptr(uint64_t arg) {
28225         LDKDecodeError arg_conv;
28226         arg_conv.inner = untag_ptr(arg);
28227         arg_conv.is_owned = ptr_is_owned(arg);
28228         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28229         arg_conv.is_owned = false;
28230         int64_t ret_conv = DecodeError_clone_ptr(&arg_conv);
28231         return ret_conv;
28232 }
28233
28234 uint64_t  __attribute__((export_name("TS_DecodeError_clone"))) TS_DecodeError_clone(uint64_t orig) {
28235         LDKDecodeError orig_conv;
28236         orig_conv.inner = untag_ptr(orig);
28237         orig_conv.is_owned = ptr_is_owned(orig);
28238         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28239         orig_conv.is_owned = false;
28240         LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
28241         uint64_t ret_ref = 0;
28242         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28243         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28244         return ret_ref;
28245 }
28246
28247 void  __attribute__((export_name("TS_Init_free"))) TS_Init_free(uint64_t this_obj) {
28248         LDKInit this_obj_conv;
28249         this_obj_conv.inner = untag_ptr(this_obj);
28250         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28252         Init_free(this_obj_conv);
28253 }
28254
28255 uint64_t  __attribute__((export_name("TS_Init_get_features"))) TS_Init_get_features(uint64_t this_ptr) {
28256         LDKInit this_ptr_conv;
28257         this_ptr_conv.inner = untag_ptr(this_ptr);
28258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28260         this_ptr_conv.is_owned = false;
28261         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
28262         uint64_t ret_ref = 0;
28263         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28264         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28265         return ret_ref;
28266 }
28267
28268 void  __attribute__((export_name("TS_Init_set_features"))) TS_Init_set_features(uint64_t this_ptr, uint64_t val) {
28269         LDKInit this_ptr_conv;
28270         this_ptr_conv.inner = untag_ptr(this_ptr);
28271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28273         this_ptr_conv.is_owned = false;
28274         LDKInitFeatures val_conv;
28275         val_conv.inner = untag_ptr(val);
28276         val_conv.is_owned = ptr_is_owned(val);
28277         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
28278         val_conv = InitFeatures_clone(&val_conv);
28279         Init_set_features(&this_ptr_conv, val_conv);
28280 }
28281
28282 uint64_t  __attribute__((export_name("TS_Init_get_remote_network_address"))) TS_Init_get_remote_network_address(uint64_t this_ptr) {
28283         LDKInit this_ptr_conv;
28284         this_ptr_conv.inner = untag_ptr(this_ptr);
28285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28287         this_ptr_conv.is_owned = false;
28288         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
28289         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
28290         uint64_t ret_ref = tag_ptr(ret_copy, true);
28291         return ret_ref;
28292 }
28293
28294 void  __attribute__((export_name("TS_Init_set_remote_network_address"))) TS_Init_set_remote_network_address(uint64_t this_ptr, uint64_t val) {
28295         LDKInit this_ptr_conv;
28296         this_ptr_conv.inner = untag_ptr(this_ptr);
28297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28299         this_ptr_conv.is_owned = false;
28300         void* val_ptr = untag_ptr(val);
28301         CHECK_ACCESS(val_ptr);
28302         LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr);
28303         val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(val));
28304         Init_set_remote_network_address(&this_ptr_conv, val_conv);
28305 }
28306
28307 uint64_t  __attribute__((export_name("TS_Init_new"))) TS_Init_new(uint64_t features_arg, uint64_t remote_network_address_arg) {
28308         LDKInitFeatures features_arg_conv;
28309         features_arg_conv.inner = untag_ptr(features_arg);
28310         features_arg_conv.is_owned = ptr_is_owned(features_arg);
28311         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
28312         features_arg_conv = InitFeatures_clone(&features_arg_conv);
28313         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
28314         CHECK_ACCESS(remote_network_address_arg_ptr);
28315         LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr);
28316         LDKInit ret_var = Init_new(features_arg_conv, remote_network_address_arg_conv);
28317         uint64_t ret_ref = 0;
28318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28320         return ret_ref;
28321 }
28322
28323 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
28324         LDKInit ret_var = Init_clone(arg);
28325         uint64_t ret_ref = 0;
28326         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28327         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28328         return ret_ref;
28329 }
28330 int64_t  __attribute__((export_name("TS_Init_clone_ptr"))) TS_Init_clone_ptr(uint64_t arg) {
28331         LDKInit arg_conv;
28332         arg_conv.inner = untag_ptr(arg);
28333         arg_conv.is_owned = ptr_is_owned(arg);
28334         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28335         arg_conv.is_owned = false;
28336         int64_t ret_conv = Init_clone_ptr(&arg_conv);
28337         return ret_conv;
28338 }
28339
28340 uint64_t  __attribute__((export_name("TS_Init_clone"))) TS_Init_clone(uint64_t orig) {
28341         LDKInit orig_conv;
28342         orig_conv.inner = untag_ptr(orig);
28343         orig_conv.is_owned = ptr_is_owned(orig);
28344         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28345         orig_conv.is_owned = false;
28346         LDKInit ret_var = Init_clone(&orig_conv);
28347         uint64_t ret_ref = 0;
28348         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28349         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28350         return ret_ref;
28351 }
28352
28353 void  __attribute__((export_name("TS_ErrorMessage_free"))) TS_ErrorMessage_free(uint64_t this_obj) {
28354         LDKErrorMessage this_obj_conv;
28355         this_obj_conv.inner = untag_ptr(this_obj);
28356         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28358         ErrorMessage_free(this_obj_conv);
28359 }
28360
28361 int8_tArray  __attribute__((export_name("TS_ErrorMessage_get_channel_id"))) TS_ErrorMessage_get_channel_id(uint64_t this_ptr) {
28362         LDKErrorMessage this_ptr_conv;
28363         this_ptr_conv.inner = untag_ptr(this_ptr);
28364         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28366         this_ptr_conv.is_owned = false;
28367         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28368         memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
28369         return ret_arr;
28370 }
28371
28372 void  __attribute__((export_name("TS_ErrorMessage_set_channel_id"))) TS_ErrorMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
28373         LDKErrorMessage this_ptr_conv;
28374         this_ptr_conv.inner = untag_ptr(this_ptr);
28375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28377         this_ptr_conv.is_owned = false;
28378         LDKThirtyTwoBytes val_ref;
28379         CHECK(val->arr_len == 32);
28380         memcpy(val_ref.data, val->elems, 32); FREE(val);
28381         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
28382 }
28383
28384 jstring  __attribute__((export_name("TS_ErrorMessage_get_data"))) TS_ErrorMessage_get_data(uint64_t this_ptr) {
28385         LDKErrorMessage this_ptr_conv;
28386         this_ptr_conv.inner = untag_ptr(this_ptr);
28387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28389         this_ptr_conv.is_owned = false;
28390         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
28391         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
28392         Str_free(ret_str);
28393         return ret_conv;
28394 }
28395
28396 void  __attribute__((export_name("TS_ErrorMessage_set_data"))) TS_ErrorMessage_set_data(uint64_t this_ptr, jstring val) {
28397         LDKErrorMessage this_ptr_conv;
28398         this_ptr_conv.inner = untag_ptr(this_ptr);
28399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28401         this_ptr_conv.is_owned = false;
28402         LDKStr val_conv = str_ref_to_owned_c(val);
28403         ErrorMessage_set_data(&this_ptr_conv, val_conv);
28404 }
28405
28406 uint64_t  __attribute__((export_name("TS_ErrorMessage_new"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
28407         LDKThirtyTwoBytes channel_id_arg_ref;
28408         CHECK(channel_id_arg->arr_len == 32);
28409         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28410         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
28411         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
28412         uint64_t ret_ref = 0;
28413         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28414         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28415         return ret_ref;
28416 }
28417
28418 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
28419         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
28420         uint64_t ret_ref = 0;
28421         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28422         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28423         return ret_ref;
28424 }
28425 int64_t  __attribute__((export_name("TS_ErrorMessage_clone_ptr"))) TS_ErrorMessage_clone_ptr(uint64_t arg) {
28426         LDKErrorMessage arg_conv;
28427         arg_conv.inner = untag_ptr(arg);
28428         arg_conv.is_owned = ptr_is_owned(arg);
28429         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28430         arg_conv.is_owned = false;
28431         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
28432         return ret_conv;
28433 }
28434
28435 uint64_t  __attribute__((export_name("TS_ErrorMessage_clone"))) TS_ErrorMessage_clone(uint64_t orig) {
28436         LDKErrorMessage orig_conv;
28437         orig_conv.inner = untag_ptr(orig);
28438         orig_conv.is_owned = ptr_is_owned(orig);
28439         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28440         orig_conv.is_owned = false;
28441         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
28442         uint64_t ret_ref = 0;
28443         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28444         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28445         return ret_ref;
28446 }
28447
28448 void  __attribute__((export_name("TS_WarningMessage_free"))) TS_WarningMessage_free(uint64_t this_obj) {
28449         LDKWarningMessage this_obj_conv;
28450         this_obj_conv.inner = untag_ptr(this_obj);
28451         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28453         WarningMessage_free(this_obj_conv);
28454 }
28455
28456 int8_tArray  __attribute__((export_name("TS_WarningMessage_get_channel_id"))) TS_WarningMessage_get_channel_id(uint64_t this_ptr) {
28457         LDKWarningMessage this_ptr_conv;
28458         this_ptr_conv.inner = untag_ptr(this_ptr);
28459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28461         this_ptr_conv.is_owned = false;
28462         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28463         memcpy(ret_arr->elems, *WarningMessage_get_channel_id(&this_ptr_conv), 32);
28464         return ret_arr;
28465 }
28466
28467 void  __attribute__((export_name("TS_WarningMessage_set_channel_id"))) TS_WarningMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
28468         LDKWarningMessage this_ptr_conv;
28469         this_ptr_conv.inner = untag_ptr(this_ptr);
28470         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28472         this_ptr_conv.is_owned = false;
28473         LDKThirtyTwoBytes val_ref;
28474         CHECK(val->arr_len == 32);
28475         memcpy(val_ref.data, val->elems, 32); FREE(val);
28476         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
28477 }
28478
28479 jstring  __attribute__((export_name("TS_WarningMessage_get_data"))) TS_WarningMessage_get_data(uint64_t this_ptr) {
28480         LDKWarningMessage this_ptr_conv;
28481         this_ptr_conv.inner = untag_ptr(this_ptr);
28482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28484         this_ptr_conv.is_owned = false;
28485         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
28486         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
28487         Str_free(ret_str);
28488         return ret_conv;
28489 }
28490
28491 void  __attribute__((export_name("TS_WarningMessage_set_data"))) TS_WarningMessage_set_data(uint64_t this_ptr, jstring val) {
28492         LDKWarningMessage this_ptr_conv;
28493         this_ptr_conv.inner = untag_ptr(this_ptr);
28494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28496         this_ptr_conv.is_owned = false;
28497         LDKStr val_conv = str_ref_to_owned_c(val);
28498         WarningMessage_set_data(&this_ptr_conv, val_conv);
28499 }
28500
28501 uint64_t  __attribute__((export_name("TS_WarningMessage_new"))) TS_WarningMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
28502         LDKThirtyTwoBytes channel_id_arg_ref;
28503         CHECK(channel_id_arg->arr_len == 32);
28504         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
28505         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
28506         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
28507         uint64_t ret_ref = 0;
28508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28510         return ret_ref;
28511 }
28512
28513 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
28514         LDKWarningMessage ret_var = WarningMessage_clone(arg);
28515         uint64_t ret_ref = 0;
28516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28517         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28518         return ret_ref;
28519 }
28520 int64_t  __attribute__((export_name("TS_WarningMessage_clone_ptr"))) TS_WarningMessage_clone_ptr(uint64_t arg) {
28521         LDKWarningMessage arg_conv;
28522         arg_conv.inner = untag_ptr(arg);
28523         arg_conv.is_owned = ptr_is_owned(arg);
28524         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28525         arg_conv.is_owned = false;
28526         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
28527         return ret_conv;
28528 }
28529
28530 uint64_t  __attribute__((export_name("TS_WarningMessage_clone"))) TS_WarningMessage_clone(uint64_t orig) {
28531         LDKWarningMessage orig_conv;
28532         orig_conv.inner = untag_ptr(orig);
28533         orig_conv.is_owned = ptr_is_owned(orig);
28534         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28535         orig_conv.is_owned = false;
28536         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
28537         uint64_t ret_ref = 0;
28538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28540         return ret_ref;
28541 }
28542
28543 void  __attribute__((export_name("TS_Ping_free"))) TS_Ping_free(uint64_t this_obj) {
28544         LDKPing this_obj_conv;
28545         this_obj_conv.inner = untag_ptr(this_obj);
28546         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28548         Ping_free(this_obj_conv);
28549 }
28550
28551 int16_t  __attribute__((export_name("TS_Ping_get_ponglen"))) TS_Ping_get_ponglen(uint64_t this_ptr) {
28552         LDKPing this_ptr_conv;
28553         this_ptr_conv.inner = untag_ptr(this_ptr);
28554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28556         this_ptr_conv.is_owned = false;
28557         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
28558         return ret_conv;
28559 }
28560
28561 void  __attribute__((export_name("TS_Ping_set_ponglen"))) TS_Ping_set_ponglen(uint64_t this_ptr, int16_t val) {
28562         LDKPing this_ptr_conv;
28563         this_ptr_conv.inner = untag_ptr(this_ptr);
28564         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28566         this_ptr_conv.is_owned = false;
28567         Ping_set_ponglen(&this_ptr_conv, val);
28568 }
28569
28570 int16_t  __attribute__((export_name("TS_Ping_get_byteslen"))) TS_Ping_get_byteslen(uint64_t this_ptr) {
28571         LDKPing this_ptr_conv;
28572         this_ptr_conv.inner = untag_ptr(this_ptr);
28573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28575         this_ptr_conv.is_owned = false;
28576         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
28577         return ret_conv;
28578 }
28579
28580 void  __attribute__((export_name("TS_Ping_set_byteslen"))) TS_Ping_set_byteslen(uint64_t this_ptr, int16_t val) {
28581         LDKPing this_ptr_conv;
28582         this_ptr_conv.inner = untag_ptr(this_ptr);
28583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28585         this_ptr_conv.is_owned = false;
28586         Ping_set_byteslen(&this_ptr_conv, val);
28587 }
28588
28589 uint64_t  __attribute__((export_name("TS_Ping_new"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
28590         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
28591         uint64_t ret_ref = 0;
28592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28594         return ret_ref;
28595 }
28596
28597 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
28598         LDKPing ret_var = Ping_clone(arg);
28599         uint64_t ret_ref = 0;
28600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28602         return ret_ref;
28603 }
28604 int64_t  __attribute__((export_name("TS_Ping_clone_ptr"))) TS_Ping_clone_ptr(uint64_t arg) {
28605         LDKPing arg_conv;
28606         arg_conv.inner = untag_ptr(arg);
28607         arg_conv.is_owned = ptr_is_owned(arg);
28608         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28609         arg_conv.is_owned = false;
28610         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
28611         return ret_conv;
28612 }
28613
28614 uint64_t  __attribute__((export_name("TS_Ping_clone"))) TS_Ping_clone(uint64_t orig) {
28615         LDKPing orig_conv;
28616         orig_conv.inner = untag_ptr(orig);
28617         orig_conv.is_owned = ptr_is_owned(orig);
28618         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28619         orig_conv.is_owned = false;
28620         LDKPing ret_var = Ping_clone(&orig_conv);
28621         uint64_t ret_ref = 0;
28622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28624         return ret_ref;
28625 }
28626
28627 void  __attribute__((export_name("TS_Pong_free"))) TS_Pong_free(uint64_t this_obj) {
28628         LDKPong this_obj_conv;
28629         this_obj_conv.inner = untag_ptr(this_obj);
28630         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28632         Pong_free(this_obj_conv);
28633 }
28634
28635 int16_t  __attribute__((export_name("TS_Pong_get_byteslen"))) TS_Pong_get_byteslen(uint64_t this_ptr) {
28636         LDKPong this_ptr_conv;
28637         this_ptr_conv.inner = untag_ptr(this_ptr);
28638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28640         this_ptr_conv.is_owned = false;
28641         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
28642         return ret_conv;
28643 }
28644
28645 void  __attribute__((export_name("TS_Pong_set_byteslen"))) TS_Pong_set_byteslen(uint64_t this_ptr, int16_t val) {
28646         LDKPong this_ptr_conv;
28647         this_ptr_conv.inner = untag_ptr(this_ptr);
28648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28650         this_ptr_conv.is_owned = false;
28651         Pong_set_byteslen(&this_ptr_conv, val);
28652 }
28653
28654 uint64_t  __attribute__((export_name("TS_Pong_new"))) TS_Pong_new(int16_t byteslen_arg) {
28655         LDKPong ret_var = Pong_new(byteslen_arg);
28656         uint64_t ret_ref = 0;
28657         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28658         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28659         return ret_ref;
28660 }
28661
28662 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
28663         LDKPong ret_var = Pong_clone(arg);
28664         uint64_t ret_ref = 0;
28665         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28666         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28667         return ret_ref;
28668 }
28669 int64_t  __attribute__((export_name("TS_Pong_clone_ptr"))) TS_Pong_clone_ptr(uint64_t arg) {
28670         LDKPong arg_conv;
28671         arg_conv.inner = untag_ptr(arg);
28672         arg_conv.is_owned = ptr_is_owned(arg);
28673         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28674         arg_conv.is_owned = false;
28675         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
28676         return ret_conv;
28677 }
28678
28679 uint64_t  __attribute__((export_name("TS_Pong_clone"))) TS_Pong_clone(uint64_t orig) {
28680         LDKPong orig_conv;
28681         orig_conv.inner = untag_ptr(orig);
28682         orig_conv.is_owned = ptr_is_owned(orig);
28683         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28684         orig_conv.is_owned = false;
28685         LDKPong ret_var = Pong_clone(&orig_conv);
28686         uint64_t ret_ref = 0;
28687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28689         return ret_ref;
28690 }
28691
28692 void  __attribute__((export_name("TS_OpenChannel_free"))) TS_OpenChannel_free(uint64_t this_obj) {
28693         LDKOpenChannel this_obj_conv;
28694         this_obj_conv.inner = untag_ptr(this_obj);
28695         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28697         OpenChannel_free(this_obj_conv);
28698 }
28699
28700 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_chain_hash"))) TS_OpenChannel_get_chain_hash(uint64_t this_ptr) {
28701         LDKOpenChannel this_ptr_conv;
28702         this_ptr_conv.inner = untag_ptr(this_ptr);
28703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28705         this_ptr_conv.is_owned = false;
28706         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28707         memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
28708         return ret_arr;
28709 }
28710
28711 void  __attribute__((export_name("TS_OpenChannel_set_chain_hash"))) TS_OpenChannel_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
28712         LDKOpenChannel this_ptr_conv;
28713         this_ptr_conv.inner = untag_ptr(this_ptr);
28714         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28716         this_ptr_conv.is_owned = false;
28717         LDKThirtyTwoBytes val_ref;
28718         CHECK(val->arr_len == 32);
28719         memcpy(val_ref.data, val->elems, 32); FREE(val);
28720         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
28721 }
28722
28723 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_temporary_channel_id"))) TS_OpenChannel_get_temporary_channel_id(uint64_t this_ptr) {
28724         LDKOpenChannel this_ptr_conv;
28725         this_ptr_conv.inner = untag_ptr(this_ptr);
28726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28728         this_ptr_conv.is_owned = false;
28729         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
28730         memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
28731         return ret_arr;
28732 }
28733
28734 void  __attribute__((export_name("TS_OpenChannel_set_temporary_channel_id"))) TS_OpenChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
28735         LDKOpenChannel this_ptr_conv;
28736         this_ptr_conv.inner = untag_ptr(this_ptr);
28737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28739         this_ptr_conv.is_owned = false;
28740         LDKThirtyTwoBytes val_ref;
28741         CHECK(val->arr_len == 32);
28742         memcpy(val_ref.data, val->elems, 32); FREE(val);
28743         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
28744 }
28745
28746 int64_t  __attribute__((export_name("TS_OpenChannel_get_funding_satoshis"))) TS_OpenChannel_get_funding_satoshis(uint64_t this_ptr) {
28747         LDKOpenChannel this_ptr_conv;
28748         this_ptr_conv.inner = untag_ptr(this_ptr);
28749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28751         this_ptr_conv.is_owned = false;
28752         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
28753         return ret_conv;
28754 }
28755
28756 void  __attribute__((export_name("TS_OpenChannel_set_funding_satoshis"))) TS_OpenChannel_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
28757         LDKOpenChannel this_ptr_conv;
28758         this_ptr_conv.inner = untag_ptr(this_ptr);
28759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28761         this_ptr_conv.is_owned = false;
28762         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
28763 }
28764
28765 int64_t  __attribute__((export_name("TS_OpenChannel_get_push_msat"))) TS_OpenChannel_get_push_msat(uint64_t this_ptr) {
28766         LDKOpenChannel this_ptr_conv;
28767         this_ptr_conv.inner = untag_ptr(this_ptr);
28768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28770         this_ptr_conv.is_owned = false;
28771         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
28772         return ret_conv;
28773 }
28774
28775 void  __attribute__((export_name("TS_OpenChannel_set_push_msat"))) TS_OpenChannel_set_push_msat(uint64_t this_ptr, int64_t val) {
28776         LDKOpenChannel this_ptr_conv;
28777         this_ptr_conv.inner = untag_ptr(this_ptr);
28778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28780         this_ptr_conv.is_owned = false;
28781         OpenChannel_set_push_msat(&this_ptr_conv, val);
28782 }
28783
28784 int64_t  __attribute__((export_name("TS_OpenChannel_get_dust_limit_satoshis"))) TS_OpenChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
28785         LDKOpenChannel this_ptr_conv;
28786         this_ptr_conv.inner = untag_ptr(this_ptr);
28787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28789         this_ptr_conv.is_owned = false;
28790         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
28791         return ret_conv;
28792 }
28793
28794 void  __attribute__((export_name("TS_OpenChannel_set_dust_limit_satoshis"))) TS_OpenChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
28795         LDKOpenChannel this_ptr_conv;
28796         this_ptr_conv.inner = untag_ptr(this_ptr);
28797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28799         this_ptr_conv.is_owned = false;
28800         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
28801 }
28802
28803 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) {
28804         LDKOpenChannel this_ptr_conv;
28805         this_ptr_conv.inner = untag_ptr(this_ptr);
28806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28808         this_ptr_conv.is_owned = false;
28809         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
28810         return ret_conv;
28811 }
28812
28813 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) {
28814         LDKOpenChannel this_ptr_conv;
28815         this_ptr_conv.inner = untag_ptr(this_ptr);
28816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28818         this_ptr_conv.is_owned = false;
28819         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
28820 }
28821
28822 int64_t  __attribute__((export_name("TS_OpenChannel_get_channel_reserve_satoshis"))) TS_OpenChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
28823         LDKOpenChannel this_ptr_conv;
28824         this_ptr_conv.inner = untag_ptr(this_ptr);
28825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28827         this_ptr_conv.is_owned = false;
28828         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
28829         return ret_conv;
28830 }
28831
28832 void  __attribute__((export_name("TS_OpenChannel_set_channel_reserve_satoshis"))) TS_OpenChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
28833         LDKOpenChannel this_ptr_conv;
28834         this_ptr_conv.inner = untag_ptr(this_ptr);
28835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28837         this_ptr_conv.is_owned = false;
28838         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
28839 }
28840
28841 int64_t  __attribute__((export_name("TS_OpenChannel_get_htlc_minimum_msat"))) TS_OpenChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
28842         LDKOpenChannel this_ptr_conv;
28843         this_ptr_conv.inner = untag_ptr(this_ptr);
28844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28846         this_ptr_conv.is_owned = false;
28847         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
28848         return ret_conv;
28849 }
28850
28851 void  __attribute__((export_name("TS_OpenChannel_set_htlc_minimum_msat"))) TS_OpenChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
28852         LDKOpenChannel this_ptr_conv;
28853         this_ptr_conv.inner = untag_ptr(this_ptr);
28854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28856         this_ptr_conv.is_owned = false;
28857         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
28858 }
28859
28860 int32_t  __attribute__((export_name("TS_OpenChannel_get_feerate_per_kw"))) TS_OpenChannel_get_feerate_per_kw(uint64_t this_ptr) {
28861         LDKOpenChannel this_ptr_conv;
28862         this_ptr_conv.inner = untag_ptr(this_ptr);
28863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28865         this_ptr_conv.is_owned = false;
28866         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
28867         return ret_conv;
28868 }
28869
28870 void  __attribute__((export_name("TS_OpenChannel_set_feerate_per_kw"))) TS_OpenChannel_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
28871         LDKOpenChannel this_ptr_conv;
28872         this_ptr_conv.inner = untag_ptr(this_ptr);
28873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28875         this_ptr_conv.is_owned = false;
28876         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
28877 }
28878
28879 int16_t  __attribute__((export_name("TS_OpenChannel_get_to_self_delay"))) TS_OpenChannel_get_to_self_delay(uint64_t this_ptr) {
28880         LDKOpenChannel this_ptr_conv;
28881         this_ptr_conv.inner = untag_ptr(this_ptr);
28882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28884         this_ptr_conv.is_owned = false;
28885         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
28886         return ret_conv;
28887 }
28888
28889 void  __attribute__((export_name("TS_OpenChannel_set_to_self_delay"))) TS_OpenChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
28890         LDKOpenChannel this_ptr_conv;
28891         this_ptr_conv.inner = untag_ptr(this_ptr);
28892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28894         this_ptr_conv.is_owned = false;
28895         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
28896 }
28897
28898 int16_t  __attribute__((export_name("TS_OpenChannel_get_max_accepted_htlcs"))) TS_OpenChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
28899         LDKOpenChannel this_ptr_conv;
28900         this_ptr_conv.inner = untag_ptr(this_ptr);
28901         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28903         this_ptr_conv.is_owned = false;
28904         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
28905         return ret_conv;
28906 }
28907
28908 void  __attribute__((export_name("TS_OpenChannel_set_max_accepted_htlcs"))) TS_OpenChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
28909         LDKOpenChannel this_ptr_conv;
28910         this_ptr_conv.inner = untag_ptr(this_ptr);
28911         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28913         this_ptr_conv.is_owned = false;
28914         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
28915 }
28916
28917 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_funding_pubkey"))) TS_OpenChannel_get_funding_pubkey(uint64_t this_ptr) {
28918         LDKOpenChannel this_ptr_conv;
28919         this_ptr_conv.inner = untag_ptr(this_ptr);
28920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28922         this_ptr_conv.is_owned = false;
28923         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28924         memcpy(ret_arr->elems, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
28925         return ret_arr;
28926 }
28927
28928 void  __attribute__((export_name("TS_OpenChannel_set_funding_pubkey"))) TS_OpenChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
28929         LDKOpenChannel this_ptr_conv;
28930         this_ptr_conv.inner = untag_ptr(this_ptr);
28931         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28933         this_ptr_conv.is_owned = false;
28934         LDKPublicKey val_ref;
28935         CHECK(val->arr_len == 33);
28936         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28937         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
28938 }
28939
28940 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_revocation_basepoint"))) TS_OpenChannel_get_revocation_basepoint(uint64_t this_ptr) {
28941         LDKOpenChannel this_ptr_conv;
28942         this_ptr_conv.inner = untag_ptr(this_ptr);
28943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28945         this_ptr_conv.is_owned = false;
28946         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28947         memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
28948         return ret_arr;
28949 }
28950
28951 void  __attribute__((export_name("TS_OpenChannel_set_revocation_basepoint"))) TS_OpenChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
28952         LDKOpenChannel this_ptr_conv;
28953         this_ptr_conv.inner = untag_ptr(this_ptr);
28954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28956         this_ptr_conv.is_owned = false;
28957         LDKPublicKey val_ref;
28958         CHECK(val->arr_len == 33);
28959         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28960         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
28961 }
28962
28963 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_payment_point"))) TS_OpenChannel_get_payment_point(uint64_t this_ptr) {
28964         LDKOpenChannel this_ptr_conv;
28965         this_ptr_conv.inner = untag_ptr(this_ptr);
28966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28968         this_ptr_conv.is_owned = false;
28969         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28970         memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
28971         return ret_arr;
28972 }
28973
28974 void  __attribute__((export_name("TS_OpenChannel_set_payment_point"))) TS_OpenChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
28975         LDKOpenChannel this_ptr_conv;
28976         this_ptr_conv.inner = untag_ptr(this_ptr);
28977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28979         this_ptr_conv.is_owned = false;
28980         LDKPublicKey val_ref;
28981         CHECK(val->arr_len == 33);
28982         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
28983         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
28984 }
28985
28986 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_delayed_payment_basepoint"))) TS_OpenChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
28987         LDKOpenChannel this_ptr_conv;
28988         this_ptr_conv.inner = untag_ptr(this_ptr);
28989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28991         this_ptr_conv.is_owned = false;
28992         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
28993         memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
28994         return ret_arr;
28995 }
28996
28997 void  __attribute__((export_name("TS_OpenChannel_set_delayed_payment_basepoint"))) TS_OpenChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
28998         LDKOpenChannel this_ptr_conv;
28999         this_ptr_conv.inner = untag_ptr(this_ptr);
29000         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29002         this_ptr_conv.is_owned = false;
29003         LDKPublicKey val_ref;
29004         CHECK(val->arr_len == 33);
29005         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29006         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
29007 }
29008
29009 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_htlc_basepoint"))) TS_OpenChannel_get_htlc_basepoint(uint64_t this_ptr) {
29010         LDKOpenChannel this_ptr_conv;
29011         this_ptr_conv.inner = untag_ptr(this_ptr);
29012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29014         this_ptr_conv.is_owned = false;
29015         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29016         memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
29017         return ret_arr;
29018 }
29019
29020 void  __attribute__((export_name("TS_OpenChannel_set_htlc_basepoint"))) TS_OpenChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
29021         LDKOpenChannel this_ptr_conv;
29022         this_ptr_conv.inner = untag_ptr(this_ptr);
29023         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29025         this_ptr_conv.is_owned = false;
29026         LDKPublicKey val_ref;
29027         CHECK(val->arr_len == 33);
29028         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29029         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
29030 }
29031
29032 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_first_per_commitment_point"))) TS_OpenChannel_get_first_per_commitment_point(uint64_t this_ptr) {
29033         LDKOpenChannel this_ptr_conv;
29034         this_ptr_conv.inner = untag_ptr(this_ptr);
29035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29037         this_ptr_conv.is_owned = false;
29038         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29039         memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
29040         return ret_arr;
29041 }
29042
29043 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) {
29044         LDKOpenChannel this_ptr_conv;
29045         this_ptr_conv.inner = untag_ptr(this_ptr);
29046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29048         this_ptr_conv.is_owned = false;
29049         LDKPublicKey val_ref;
29050         CHECK(val->arr_len == 33);
29051         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29052         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
29053 }
29054
29055 int8_t  __attribute__((export_name("TS_OpenChannel_get_channel_flags"))) TS_OpenChannel_get_channel_flags(uint64_t this_ptr) {
29056         LDKOpenChannel this_ptr_conv;
29057         this_ptr_conv.inner = untag_ptr(this_ptr);
29058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29060         this_ptr_conv.is_owned = false;
29061         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
29062         return ret_conv;
29063 }
29064
29065 void  __attribute__((export_name("TS_OpenChannel_set_channel_flags"))) TS_OpenChannel_set_channel_flags(uint64_t this_ptr, int8_t val) {
29066         LDKOpenChannel this_ptr_conv;
29067         this_ptr_conv.inner = untag_ptr(this_ptr);
29068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29070         this_ptr_conv.is_owned = false;
29071         OpenChannel_set_channel_flags(&this_ptr_conv, val);
29072 }
29073
29074 uint64_t  __attribute__((export_name("TS_OpenChannel_get_channel_type"))) TS_OpenChannel_get_channel_type(uint64_t this_ptr) {
29075         LDKOpenChannel this_ptr_conv;
29076         this_ptr_conv.inner = untag_ptr(this_ptr);
29077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29079         this_ptr_conv.is_owned = false;
29080         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
29081         uint64_t ret_ref = 0;
29082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29084         return ret_ref;
29085 }
29086
29087 void  __attribute__((export_name("TS_OpenChannel_set_channel_type"))) TS_OpenChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
29088         LDKOpenChannel this_ptr_conv;
29089         this_ptr_conv.inner = untag_ptr(this_ptr);
29090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29092         this_ptr_conv.is_owned = false;
29093         LDKChannelTypeFeatures val_conv;
29094         val_conv.inner = untag_ptr(val);
29095         val_conv.is_owned = ptr_is_owned(val);
29096         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29097         val_conv = ChannelTypeFeatures_clone(&val_conv);
29098         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
29099 }
29100
29101 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
29102         LDKOpenChannel ret_var = OpenChannel_clone(arg);
29103         uint64_t ret_ref = 0;
29104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29106         return ret_ref;
29107 }
29108 int64_t  __attribute__((export_name("TS_OpenChannel_clone_ptr"))) TS_OpenChannel_clone_ptr(uint64_t arg) {
29109         LDKOpenChannel arg_conv;
29110         arg_conv.inner = untag_ptr(arg);
29111         arg_conv.is_owned = ptr_is_owned(arg);
29112         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29113         arg_conv.is_owned = false;
29114         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
29115         return ret_conv;
29116 }
29117
29118 uint64_t  __attribute__((export_name("TS_OpenChannel_clone"))) TS_OpenChannel_clone(uint64_t orig) {
29119         LDKOpenChannel orig_conv;
29120         orig_conv.inner = untag_ptr(orig);
29121         orig_conv.is_owned = ptr_is_owned(orig);
29122         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29123         orig_conv.is_owned = false;
29124         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
29125         uint64_t ret_ref = 0;
29126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29128         return ret_ref;
29129 }
29130
29131 void  __attribute__((export_name("TS_AcceptChannel_free"))) TS_AcceptChannel_free(uint64_t this_obj) {
29132         LDKAcceptChannel this_obj_conv;
29133         this_obj_conv.inner = untag_ptr(this_obj);
29134         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29136         AcceptChannel_free(this_obj_conv);
29137 }
29138
29139 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_temporary_channel_id"))) TS_AcceptChannel_get_temporary_channel_id(uint64_t this_ptr) {
29140         LDKAcceptChannel this_ptr_conv;
29141         this_ptr_conv.inner = untag_ptr(this_ptr);
29142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29144         this_ptr_conv.is_owned = false;
29145         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29146         memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
29147         return ret_arr;
29148 }
29149
29150 void  __attribute__((export_name("TS_AcceptChannel_set_temporary_channel_id"))) TS_AcceptChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
29151         LDKAcceptChannel this_ptr_conv;
29152         this_ptr_conv.inner = untag_ptr(this_ptr);
29153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29155         this_ptr_conv.is_owned = false;
29156         LDKThirtyTwoBytes val_ref;
29157         CHECK(val->arr_len == 32);
29158         memcpy(val_ref.data, val->elems, 32); FREE(val);
29159         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
29160 }
29161
29162 int64_t  __attribute__((export_name("TS_AcceptChannel_get_dust_limit_satoshis"))) TS_AcceptChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
29163         LDKAcceptChannel this_ptr_conv;
29164         this_ptr_conv.inner = untag_ptr(this_ptr);
29165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29167         this_ptr_conv.is_owned = false;
29168         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
29169         return ret_conv;
29170 }
29171
29172 void  __attribute__((export_name("TS_AcceptChannel_set_dust_limit_satoshis"))) TS_AcceptChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
29173         LDKAcceptChannel this_ptr_conv;
29174         this_ptr_conv.inner = untag_ptr(this_ptr);
29175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29177         this_ptr_conv.is_owned = false;
29178         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
29179 }
29180
29181 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) {
29182         LDKAcceptChannel this_ptr_conv;
29183         this_ptr_conv.inner = untag_ptr(this_ptr);
29184         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29186         this_ptr_conv.is_owned = false;
29187         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
29188         return ret_conv;
29189 }
29190
29191 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) {
29192         LDKAcceptChannel this_ptr_conv;
29193         this_ptr_conv.inner = untag_ptr(this_ptr);
29194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29196         this_ptr_conv.is_owned = false;
29197         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
29198 }
29199
29200 int64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_reserve_satoshis"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
29201         LDKAcceptChannel this_ptr_conv;
29202         this_ptr_conv.inner = untag_ptr(this_ptr);
29203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29205         this_ptr_conv.is_owned = false;
29206         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
29207         return ret_conv;
29208 }
29209
29210 void  __attribute__((export_name("TS_AcceptChannel_set_channel_reserve_satoshis"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
29211         LDKAcceptChannel this_ptr_conv;
29212         this_ptr_conv.inner = untag_ptr(this_ptr);
29213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29215         this_ptr_conv.is_owned = false;
29216         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
29217 }
29218
29219 int64_t  __attribute__((export_name("TS_AcceptChannel_get_htlc_minimum_msat"))) TS_AcceptChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
29220         LDKAcceptChannel this_ptr_conv;
29221         this_ptr_conv.inner = untag_ptr(this_ptr);
29222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29224         this_ptr_conv.is_owned = false;
29225         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
29226         return ret_conv;
29227 }
29228
29229 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_minimum_msat"))) TS_AcceptChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
29230         LDKAcceptChannel 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         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
29236 }
29237
29238 int32_t  __attribute__((export_name("TS_AcceptChannel_get_minimum_depth"))) TS_AcceptChannel_get_minimum_depth(uint64_t this_ptr) {
29239         LDKAcceptChannel this_ptr_conv;
29240         this_ptr_conv.inner = untag_ptr(this_ptr);
29241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29243         this_ptr_conv.is_owned = false;
29244         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
29245         return ret_conv;
29246 }
29247
29248 void  __attribute__((export_name("TS_AcceptChannel_set_minimum_depth"))) TS_AcceptChannel_set_minimum_depth(uint64_t this_ptr, int32_t val) {
29249         LDKAcceptChannel this_ptr_conv;
29250         this_ptr_conv.inner = untag_ptr(this_ptr);
29251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29253         this_ptr_conv.is_owned = false;
29254         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
29255 }
29256
29257 int16_t  __attribute__((export_name("TS_AcceptChannel_get_to_self_delay"))) TS_AcceptChannel_get_to_self_delay(uint64_t this_ptr) {
29258         LDKAcceptChannel this_ptr_conv;
29259         this_ptr_conv.inner = untag_ptr(this_ptr);
29260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29262         this_ptr_conv.is_owned = false;
29263         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
29264         return ret_conv;
29265 }
29266
29267 void  __attribute__((export_name("TS_AcceptChannel_set_to_self_delay"))) TS_AcceptChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
29268         LDKAcceptChannel 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         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
29274 }
29275
29276 int16_t  __attribute__((export_name("TS_AcceptChannel_get_max_accepted_htlcs"))) TS_AcceptChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
29277         LDKAcceptChannel this_ptr_conv;
29278         this_ptr_conv.inner = untag_ptr(this_ptr);
29279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29281         this_ptr_conv.is_owned = false;
29282         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
29283         return ret_conv;
29284 }
29285
29286 void  __attribute__((export_name("TS_AcceptChannel_set_max_accepted_htlcs"))) TS_AcceptChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
29287         LDKAcceptChannel this_ptr_conv;
29288         this_ptr_conv.inner = untag_ptr(this_ptr);
29289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29291         this_ptr_conv.is_owned = false;
29292         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
29293 }
29294
29295 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_funding_pubkey"))) TS_AcceptChannel_get_funding_pubkey(uint64_t this_ptr) {
29296         LDKAcceptChannel this_ptr_conv;
29297         this_ptr_conv.inner = untag_ptr(this_ptr);
29298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29300         this_ptr_conv.is_owned = false;
29301         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29302         memcpy(ret_arr->elems, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
29303         return ret_arr;
29304 }
29305
29306 void  __attribute__((export_name("TS_AcceptChannel_set_funding_pubkey"))) TS_AcceptChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
29307         LDKAcceptChannel this_ptr_conv;
29308         this_ptr_conv.inner = untag_ptr(this_ptr);
29309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29311         this_ptr_conv.is_owned = false;
29312         LDKPublicKey val_ref;
29313         CHECK(val->arr_len == 33);
29314         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29315         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
29316 }
29317
29318 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_revocation_basepoint"))) TS_AcceptChannel_get_revocation_basepoint(uint64_t this_ptr) {
29319         LDKAcceptChannel this_ptr_conv;
29320         this_ptr_conv.inner = untag_ptr(this_ptr);
29321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29323         this_ptr_conv.is_owned = false;
29324         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29325         memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
29326         return ret_arr;
29327 }
29328
29329 void  __attribute__((export_name("TS_AcceptChannel_set_revocation_basepoint"))) TS_AcceptChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
29330         LDKAcceptChannel this_ptr_conv;
29331         this_ptr_conv.inner = untag_ptr(this_ptr);
29332         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29334         this_ptr_conv.is_owned = false;
29335         LDKPublicKey val_ref;
29336         CHECK(val->arr_len == 33);
29337         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29338         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
29339 }
29340
29341 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_payment_point"))) TS_AcceptChannel_get_payment_point(uint64_t this_ptr) {
29342         LDKAcceptChannel this_ptr_conv;
29343         this_ptr_conv.inner = untag_ptr(this_ptr);
29344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29346         this_ptr_conv.is_owned = false;
29347         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29348         memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
29349         return ret_arr;
29350 }
29351
29352 void  __attribute__((export_name("TS_AcceptChannel_set_payment_point"))) TS_AcceptChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
29353         LDKAcceptChannel this_ptr_conv;
29354         this_ptr_conv.inner = untag_ptr(this_ptr);
29355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29357         this_ptr_conv.is_owned = false;
29358         LDKPublicKey val_ref;
29359         CHECK(val->arr_len == 33);
29360         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29361         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
29362 }
29363
29364 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_delayed_payment_basepoint"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
29365         LDKAcceptChannel this_ptr_conv;
29366         this_ptr_conv.inner = untag_ptr(this_ptr);
29367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29369         this_ptr_conv.is_owned = false;
29370         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29371         memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
29372         return ret_arr;
29373 }
29374
29375 void  __attribute__((export_name("TS_AcceptChannel_set_delayed_payment_basepoint"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
29376         LDKAcceptChannel this_ptr_conv;
29377         this_ptr_conv.inner = untag_ptr(this_ptr);
29378         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29380         this_ptr_conv.is_owned = false;
29381         LDKPublicKey val_ref;
29382         CHECK(val->arr_len == 33);
29383         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29384         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
29385 }
29386
29387 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_htlc_basepoint"))) TS_AcceptChannel_get_htlc_basepoint(uint64_t this_ptr) {
29388         LDKAcceptChannel this_ptr_conv;
29389         this_ptr_conv.inner = untag_ptr(this_ptr);
29390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29392         this_ptr_conv.is_owned = false;
29393         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29394         memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
29395         return ret_arr;
29396 }
29397
29398 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_basepoint"))) TS_AcceptChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
29399         LDKAcceptChannel this_ptr_conv;
29400         this_ptr_conv.inner = untag_ptr(this_ptr);
29401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29403         this_ptr_conv.is_owned = false;
29404         LDKPublicKey val_ref;
29405         CHECK(val->arr_len == 33);
29406         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29407         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
29408 }
29409
29410 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_first_per_commitment_point"))) TS_AcceptChannel_get_first_per_commitment_point(uint64_t this_ptr) {
29411         LDKAcceptChannel this_ptr_conv;
29412         this_ptr_conv.inner = untag_ptr(this_ptr);
29413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29415         this_ptr_conv.is_owned = false;
29416         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29417         memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
29418         return ret_arr;
29419 }
29420
29421 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) {
29422         LDKAcceptChannel this_ptr_conv;
29423         this_ptr_conv.inner = untag_ptr(this_ptr);
29424         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29426         this_ptr_conv.is_owned = false;
29427         LDKPublicKey val_ref;
29428         CHECK(val->arr_len == 33);
29429         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29430         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
29431 }
29432
29433 uint64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_type"))) TS_AcceptChannel_get_channel_type(uint64_t this_ptr) {
29434         LDKAcceptChannel this_ptr_conv;
29435         this_ptr_conv.inner = untag_ptr(this_ptr);
29436         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29438         this_ptr_conv.is_owned = false;
29439         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
29440         uint64_t ret_ref = 0;
29441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29443         return ret_ref;
29444 }
29445
29446 void  __attribute__((export_name("TS_AcceptChannel_set_channel_type"))) TS_AcceptChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
29447         LDKAcceptChannel this_ptr_conv;
29448         this_ptr_conv.inner = untag_ptr(this_ptr);
29449         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29451         this_ptr_conv.is_owned = false;
29452         LDKChannelTypeFeatures val_conv;
29453         val_conv.inner = untag_ptr(val);
29454         val_conv.is_owned = ptr_is_owned(val);
29455         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29456         val_conv = ChannelTypeFeatures_clone(&val_conv);
29457         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
29458 }
29459
29460 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
29461         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
29462         uint64_t ret_ref = 0;
29463         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29464         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29465         return ret_ref;
29466 }
29467 int64_t  __attribute__((export_name("TS_AcceptChannel_clone_ptr"))) TS_AcceptChannel_clone_ptr(uint64_t arg) {
29468         LDKAcceptChannel arg_conv;
29469         arg_conv.inner = untag_ptr(arg);
29470         arg_conv.is_owned = ptr_is_owned(arg);
29471         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29472         arg_conv.is_owned = false;
29473         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
29474         return ret_conv;
29475 }
29476
29477 uint64_t  __attribute__((export_name("TS_AcceptChannel_clone"))) TS_AcceptChannel_clone(uint64_t orig) {
29478         LDKAcceptChannel orig_conv;
29479         orig_conv.inner = untag_ptr(orig);
29480         orig_conv.is_owned = ptr_is_owned(orig);
29481         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29482         orig_conv.is_owned = false;
29483         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
29484         uint64_t ret_ref = 0;
29485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29487         return ret_ref;
29488 }
29489
29490 void  __attribute__((export_name("TS_FundingCreated_free"))) TS_FundingCreated_free(uint64_t this_obj) {
29491         LDKFundingCreated this_obj_conv;
29492         this_obj_conv.inner = untag_ptr(this_obj);
29493         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29495         FundingCreated_free(this_obj_conv);
29496 }
29497
29498 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_temporary_channel_id"))) TS_FundingCreated_get_temporary_channel_id(uint64_t this_ptr) {
29499         LDKFundingCreated this_ptr_conv;
29500         this_ptr_conv.inner = untag_ptr(this_ptr);
29501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29503         this_ptr_conv.is_owned = false;
29504         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29505         memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
29506         return ret_arr;
29507 }
29508
29509 void  __attribute__((export_name("TS_FundingCreated_set_temporary_channel_id"))) TS_FundingCreated_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
29510         LDKFundingCreated this_ptr_conv;
29511         this_ptr_conv.inner = untag_ptr(this_ptr);
29512         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29514         this_ptr_conv.is_owned = false;
29515         LDKThirtyTwoBytes val_ref;
29516         CHECK(val->arr_len == 32);
29517         memcpy(val_ref.data, val->elems, 32); FREE(val);
29518         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
29519 }
29520
29521 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_funding_txid"))) TS_FundingCreated_get_funding_txid(uint64_t this_ptr) {
29522         LDKFundingCreated this_ptr_conv;
29523         this_ptr_conv.inner = untag_ptr(this_ptr);
29524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29526         this_ptr_conv.is_owned = false;
29527         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29528         memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
29529         return ret_arr;
29530 }
29531
29532 void  __attribute__((export_name("TS_FundingCreated_set_funding_txid"))) TS_FundingCreated_set_funding_txid(uint64_t this_ptr, int8_tArray val) {
29533         LDKFundingCreated this_ptr_conv;
29534         this_ptr_conv.inner = untag_ptr(this_ptr);
29535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29537         this_ptr_conv.is_owned = false;
29538         LDKThirtyTwoBytes val_ref;
29539         CHECK(val->arr_len == 32);
29540         memcpy(val_ref.data, val->elems, 32); FREE(val);
29541         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
29542 }
29543
29544 int16_t  __attribute__((export_name("TS_FundingCreated_get_funding_output_index"))) TS_FundingCreated_get_funding_output_index(uint64_t this_ptr) {
29545         LDKFundingCreated this_ptr_conv;
29546         this_ptr_conv.inner = untag_ptr(this_ptr);
29547         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29549         this_ptr_conv.is_owned = false;
29550         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
29551         return ret_conv;
29552 }
29553
29554 void  __attribute__((export_name("TS_FundingCreated_set_funding_output_index"))) TS_FundingCreated_set_funding_output_index(uint64_t this_ptr, int16_t val) {
29555         LDKFundingCreated this_ptr_conv;
29556         this_ptr_conv.inner = untag_ptr(this_ptr);
29557         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29559         this_ptr_conv.is_owned = false;
29560         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
29561 }
29562
29563 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_signature"))) TS_FundingCreated_get_signature(uint64_t this_ptr) {
29564         LDKFundingCreated this_ptr_conv;
29565         this_ptr_conv.inner = untag_ptr(this_ptr);
29566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29568         this_ptr_conv.is_owned = false;
29569         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
29570         memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
29571         return ret_arr;
29572 }
29573
29574 void  __attribute__((export_name("TS_FundingCreated_set_signature"))) TS_FundingCreated_set_signature(uint64_t this_ptr, int8_tArray val) {
29575         LDKFundingCreated this_ptr_conv;
29576         this_ptr_conv.inner = untag_ptr(this_ptr);
29577         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29579         this_ptr_conv.is_owned = false;
29580         LDKSignature val_ref;
29581         CHECK(val->arr_len == 64);
29582         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
29583         FundingCreated_set_signature(&this_ptr_conv, val_ref);
29584 }
29585
29586 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) {
29587         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
29588         CHECK(temporary_channel_id_arg->arr_len == 32);
29589         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
29590         LDKThirtyTwoBytes funding_txid_arg_ref;
29591         CHECK(funding_txid_arg->arr_len == 32);
29592         memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
29593         LDKSignature signature_arg_ref;
29594         CHECK(signature_arg->arr_len == 64);
29595         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
29596         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
29597         uint64_t ret_ref = 0;
29598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29600         return ret_ref;
29601 }
29602
29603 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
29604         LDKFundingCreated ret_var = FundingCreated_clone(arg);
29605         uint64_t ret_ref = 0;
29606         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29607         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29608         return ret_ref;
29609 }
29610 int64_t  __attribute__((export_name("TS_FundingCreated_clone_ptr"))) TS_FundingCreated_clone_ptr(uint64_t arg) {
29611         LDKFundingCreated arg_conv;
29612         arg_conv.inner = untag_ptr(arg);
29613         arg_conv.is_owned = ptr_is_owned(arg);
29614         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29615         arg_conv.is_owned = false;
29616         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
29617         return ret_conv;
29618 }
29619
29620 uint64_t  __attribute__((export_name("TS_FundingCreated_clone"))) TS_FundingCreated_clone(uint64_t orig) {
29621         LDKFundingCreated orig_conv;
29622         orig_conv.inner = untag_ptr(orig);
29623         orig_conv.is_owned = ptr_is_owned(orig);
29624         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29625         orig_conv.is_owned = false;
29626         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
29627         uint64_t ret_ref = 0;
29628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29630         return ret_ref;
29631 }
29632
29633 void  __attribute__((export_name("TS_FundingSigned_free"))) TS_FundingSigned_free(uint64_t this_obj) {
29634         LDKFundingSigned this_obj_conv;
29635         this_obj_conv.inner = untag_ptr(this_obj);
29636         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29638         FundingSigned_free(this_obj_conv);
29639 }
29640
29641 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_channel_id"))) TS_FundingSigned_get_channel_id(uint64_t this_ptr) {
29642         LDKFundingSigned this_ptr_conv;
29643         this_ptr_conv.inner = untag_ptr(this_ptr);
29644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29646         this_ptr_conv.is_owned = false;
29647         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29648         memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
29649         return ret_arr;
29650 }
29651
29652 void  __attribute__((export_name("TS_FundingSigned_set_channel_id"))) TS_FundingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
29653         LDKFundingSigned this_ptr_conv;
29654         this_ptr_conv.inner = untag_ptr(this_ptr);
29655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29657         this_ptr_conv.is_owned = false;
29658         LDKThirtyTwoBytes val_ref;
29659         CHECK(val->arr_len == 32);
29660         memcpy(val_ref.data, val->elems, 32); FREE(val);
29661         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
29662 }
29663
29664 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_signature"))) TS_FundingSigned_get_signature(uint64_t this_ptr) {
29665         LDKFundingSigned this_ptr_conv;
29666         this_ptr_conv.inner = untag_ptr(this_ptr);
29667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29669         this_ptr_conv.is_owned = false;
29670         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
29671         memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
29672         return ret_arr;
29673 }
29674
29675 void  __attribute__((export_name("TS_FundingSigned_set_signature"))) TS_FundingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
29676         LDKFundingSigned this_ptr_conv;
29677         this_ptr_conv.inner = untag_ptr(this_ptr);
29678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29680         this_ptr_conv.is_owned = false;
29681         LDKSignature val_ref;
29682         CHECK(val->arr_len == 64);
29683         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
29684         FundingSigned_set_signature(&this_ptr_conv, val_ref);
29685 }
29686
29687 uint64_t  __attribute__((export_name("TS_FundingSigned_new"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
29688         LDKThirtyTwoBytes channel_id_arg_ref;
29689         CHECK(channel_id_arg->arr_len == 32);
29690         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29691         LDKSignature signature_arg_ref;
29692         CHECK(signature_arg->arr_len == 64);
29693         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
29694         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
29695         uint64_t ret_ref = 0;
29696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29698         return ret_ref;
29699 }
29700
29701 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
29702         LDKFundingSigned ret_var = FundingSigned_clone(arg);
29703         uint64_t ret_ref = 0;
29704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29706         return ret_ref;
29707 }
29708 int64_t  __attribute__((export_name("TS_FundingSigned_clone_ptr"))) TS_FundingSigned_clone_ptr(uint64_t arg) {
29709         LDKFundingSigned arg_conv;
29710         arg_conv.inner = untag_ptr(arg);
29711         arg_conv.is_owned = ptr_is_owned(arg);
29712         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29713         arg_conv.is_owned = false;
29714         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
29715         return ret_conv;
29716 }
29717
29718 uint64_t  __attribute__((export_name("TS_FundingSigned_clone"))) TS_FundingSigned_clone(uint64_t orig) {
29719         LDKFundingSigned orig_conv;
29720         orig_conv.inner = untag_ptr(orig);
29721         orig_conv.is_owned = ptr_is_owned(orig);
29722         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29723         orig_conv.is_owned = false;
29724         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
29725         uint64_t ret_ref = 0;
29726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29728         return ret_ref;
29729 }
29730
29731 void  __attribute__((export_name("TS_ChannelReady_free"))) TS_ChannelReady_free(uint64_t this_obj) {
29732         LDKChannelReady this_obj_conv;
29733         this_obj_conv.inner = untag_ptr(this_obj);
29734         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29736         ChannelReady_free(this_obj_conv);
29737 }
29738
29739 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_channel_id"))) TS_ChannelReady_get_channel_id(uint64_t this_ptr) {
29740         LDKChannelReady 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29746         memcpy(ret_arr->elems, *ChannelReady_get_channel_id(&this_ptr_conv), 32);
29747         return ret_arr;
29748 }
29749
29750 void  __attribute__((export_name("TS_ChannelReady_set_channel_id"))) TS_ChannelReady_set_channel_id(uint64_t this_ptr, int8_tArray val) {
29751         LDKChannelReady this_ptr_conv;
29752         this_ptr_conv.inner = untag_ptr(this_ptr);
29753         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29755         this_ptr_conv.is_owned = false;
29756         LDKThirtyTwoBytes val_ref;
29757         CHECK(val->arr_len == 32);
29758         memcpy(val_ref.data, val->elems, 32); FREE(val);
29759         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
29760 }
29761
29762 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_next_per_commitment_point"))) TS_ChannelReady_get_next_per_commitment_point(uint64_t this_ptr) {
29763         LDKChannelReady this_ptr_conv;
29764         this_ptr_conv.inner = untag_ptr(this_ptr);
29765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29767         this_ptr_conv.is_owned = false;
29768         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
29769         memcpy(ret_arr->elems, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
29770         return ret_arr;
29771 }
29772
29773 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) {
29774         LDKChannelReady this_ptr_conv;
29775         this_ptr_conv.inner = untag_ptr(this_ptr);
29776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29778         this_ptr_conv.is_owned = false;
29779         LDKPublicKey val_ref;
29780         CHECK(val->arr_len == 33);
29781         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
29782         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
29783 }
29784
29785 uint64_t  __attribute__((export_name("TS_ChannelReady_get_short_channel_id_alias"))) TS_ChannelReady_get_short_channel_id_alias(uint64_t this_ptr) {
29786         LDKChannelReady this_ptr_conv;
29787         this_ptr_conv.inner = untag_ptr(this_ptr);
29788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29790         this_ptr_conv.is_owned = false;
29791         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29792         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
29793         uint64_t ret_ref = tag_ptr(ret_copy, true);
29794         return ret_ref;
29795 }
29796
29797 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) {
29798         LDKChannelReady this_ptr_conv;
29799         this_ptr_conv.inner = untag_ptr(this_ptr);
29800         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29802         this_ptr_conv.is_owned = false;
29803         void* val_ptr = untag_ptr(val);
29804         CHECK_ACCESS(val_ptr);
29805         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29806         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
29807         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
29808 }
29809
29810 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) {
29811         LDKThirtyTwoBytes channel_id_arg_ref;
29812         CHECK(channel_id_arg->arr_len == 32);
29813         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29814         LDKPublicKey next_per_commitment_point_arg_ref;
29815         CHECK(next_per_commitment_point_arg->arr_len == 33);
29816         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
29817         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
29818         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
29819         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
29820         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
29821         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
29822         uint64_t ret_ref = 0;
29823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29824         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29825         return ret_ref;
29826 }
29827
29828 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
29829         LDKChannelReady ret_var = ChannelReady_clone(arg);
29830         uint64_t ret_ref = 0;
29831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29833         return ret_ref;
29834 }
29835 int64_t  __attribute__((export_name("TS_ChannelReady_clone_ptr"))) TS_ChannelReady_clone_ptr(uint64_t arg) {
29836         LDKChannelReady arg_conv;
29837         arg_conv.inner = untag_ptr(arg);
29838         arg_conv.is_owned = ptr_is_owned(arg);
29839         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29840         arg_conv.is_owned = false;
29841         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
29842         return ret_conv;
29843 }
29844
29845 uint64_t  __attribute__((export_name("TS_ChannelReady_clone"))) TS_ChannelReady_clone(uint64_t orig) {
29846         LDKChannelReady orig_conv;
29847         orig_conv.inner = untag_ptr(orig);
29848         orig_conv.is_owned = ptr_is_owned(orig);
29849         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29850         orig_conv.is_owned = false;
29851         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
29852         uint64_t ret_ref = 0;
29853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29855         return ret_ref;
29856 }
29857
29858 void  __attribute__((export_name("TS_Shutdown_free"))) TS_Shutdown_free(uint64_t this_obj) {
29859         LDKShutdown this_obj_conv;
29860         this_obj_conv.inner = untag_ptr(this_obj);
29861         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29863         Shutdown_free(this_obj_conv);
29864 }
29865
29866 int8_tArray  __attribute__((export_name("TS_Shutdown_get_channel_id"))) TS_Shutdown_get_channel_id(uint64_t this_ptr) {
29867         LDKShutdown this_ptr_conv;
29868         this_ptr_conv.inner = untag_ptr(this_ptr);
29869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29871         this_ptr_conv.is_owned = false;
29872         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29873         memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
29874         return ret_arr;
29875 }
29876
29877 void  __attribute__((export_name("TS_Shutdown_set_channel_id"))) TS_Shutdown_set_channel_id(uint64_t this_ptr, int8_tArray val) {
29878         LDKShutdown this_ptr_conv;
29879         this_ptr_conv.inner = untag_ptr(this_ptr);
29880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29882         this_ptr_conv.is_owned = false;
29883         LDKThirtyTwoBytes val_ref;
29884         CHECK(val->arr_len == 32);
29885         memcpy(val_ref.data, val->elems, 32); FREE(val);
29886         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
29887 }
29888
29889 int8_tArray  __attribute__((export_name("TS_Shutdown_get_scriptpubkey"))) TS_Shutdown_get_scriptpubkey(uint64_t this_ptr) {
29890         LDKShutdown this_ptr_conv;
29891         this_ptr_conv.inner = untag_ptr(this_ptr);
29892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29894         this_ptr_conv.is_owned = false;
29895         LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
29896         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29897         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29898         return ret_arr;
29899 }
29900
29901 void  __attribute__((export_name("TS_Shutdown_set_scriptpubkey"))) TS_Shutdown_set_scriptpubkey(uint64_t this_ptr, int8_tArray val) {
29902         LDKShutdown this_ptr_conv;
29903         this_ptr_conv.inner = untag_ptr(this_ptr);
29904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29906         this_ptr_conv.is_owned = false;
29907         LDKCVec_u8Z val_ref;
29908         val_ref.datalen = val->arr_len;
29909         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
29910         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
29911         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
29912 }
29913
29914 uint64_t  __attribute__((export_name("TS_Shutdown_new"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
29915         LDKThirtyTwoBytes channel_id_arg_ref;
29916         CHECK(channel_id_arg->arr_len == 32);
29917         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
29918         LDKCVec_u8Z scriptpubkey_arg_ref;
29919         scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
29920         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
29921         memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
29922         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
29923         uint64_t ret_ref = 0;
29924         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29925         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29926         return ret_ref;
29927 }
29928
29929 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
29930         LDKShutdown ret_var = Shutdown_clone(arg);
29931         uint64_t ret_ref = 0;
29932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29934         return ret_ref;
29935 }
29936 int64_t  __attribute__((export_name("TS_Shutdown_clone_ptr"))) TS_Shutdown_clone_ptr(uint64_t arg) {
29937         LDKShutdown arg_conv;
29938         arg_conv.inner = untag_ptr(arg);
29939         arg_conv.is_owned = ptr_is_owned(arg);
29940         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29941         arg_conv.is_owned = false;
29942         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
29943         return ret_conv;
29944 }
29945
29946 uint64_t  __attribute__((export_name("TS_Shutdown_clone"))) TS_Shutdown_clone(uint64_t orig) {
29947         LDKShutdown orig_conv;
29948         orig_conv.inner = untag_ptr(orig);
29949         orig_conv.is_owned = ptr_is_owned(orig);
29950         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29951         orig_conv.is_owned = false;
29952         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
29953         uint64_t ret_ref = 0;
29954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29955         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29956         return ret_ref;
29957 }
29958
29959 void  __attribute__((export_name("TS_ClosingSignedFeeRange_free"))) TS_ClosingSignedFeeRange_free(uint64_t this_obj) {
29960         LDKClosingSignedFeeRange this_obj_conv;
29961         this_obj_conv.inner = untag_ptr(this_obj);
29962         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29964         ClosingSignedFeeRange_free(this_obj_conv);
29965 }
29966
29967 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_min_fee_satoshis"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint64_t this_ptr) {
29968         LDKClosingSignedFeeRange this_ptr_conv;
29969         this_ptr_conv.inner = untag_ptr(this_ptr);
29970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29972         this_ptr_conv.is_owned = false;
29973         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
29974         return ret_conv;
29975 }
29976
29977 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_min_fee_satoshis"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint64_t this_ptr, int64_t val) {
29978         LDKClosingSignedFeeRange this_ptr_conv;
29979         this_ptr_conv.inner = untag_ptr(this_ptr);
29980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29982         this_ptr_conv.is_owned = false;
29983         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
29984 }
29985
29986 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_max_fee_satoshis"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint64_t this_ptr) {
29987         LDKClosingSignedFeeRange this_ptr_conv;
29988         this_ptr_conv.inner = untag_ptr(this_ptr);
29989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29991         this_ptr_conv.is_owned = false;
29992         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
29993         return ret_conv;
29994 }
29995
29996 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_max_fee_satoshis"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint64_t this_ptr, int64_t val) {
29997         LDKClosingSignedFeeRange this_ptr_conv;
29998         this_ptr_conv.inner = untag_ptr(this_ptr);
29999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30001         this_ptr_conv.is_owned = false;
30002         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
30003 }
30004
30005 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_new"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
30006         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
30007         uint64_t ret_ref = 0;
30008         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30009         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30010         return ret_ref;
30011 }
30012
30013 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
30014         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
30015         uint64_t ret_ref = 0;
30016         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30017         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30018         return ret_ref;
30019 }
30020 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone_ptr"))) TS_ClosingSignedFeeRange_clone_ptr(uint64_t arg) {
30021         LDKClosingSignedFeeRange arg_conv;
30022         arg_conv.inner = untag_ptr(arg);
30023         arg_conv.is_owned = ptr_is_owned(arg);
30024         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30025         arg_conv.is_owned = false;
30026         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
30027         return ret_conv;
30028 }
30029
30030 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone"))) TS_ClosingSignedFeeRange_clone(uint64_t orig) {
30031         LDKClosingSignedFeeRange orig_conv;
30032         orig_conv.inner = untag_ptr(orig);
30033         orig_conv.is_owned = ptr_is_owned(orig);
30034         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30035         orig_conv.is_owned = false;
30036         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
30037         uint64_t ret_ref = 0;
30038         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30039         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30040         return ret_ref;
30041 }
30042
30043 void  __attribute__((export_name("TS_ClosingSigned_free"))) TS_ClosingSigned_free(uint64_t this_obj) {
30044         LDKClosingSigned this_obj_conv;
30045         this_obj_conv.inner = untag_ptr(this_obj);
30046         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30048         ClosingSigned_free(this_obj_conv);
30049 }
30050
30051 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_channel_id"))) TS_ClosingSigned_get_channel_id(uint64_t this_ptr) {
30052         LDKClosingSigned this_ptr_conv;
30053         this_ptr_conv.inner = untag_ptr(this_ptr);
30054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30056         this_ptr_conv.is_owned = false;
30057         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30058         memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
30059         return ret_arr;
30060 }
30061
30062 void  __attribute__((export_name("TS_ClosingSigned_set_channel_id"))) TS_ClosingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30063         LDKClosingSigned this_ptr_conv;
30064         this_ptr_conv.inner = untag_ptr(this_ptr);
30065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30067         this_ptr_conv.is_owned = false;
30068         LDKThirtyTwoBytes val_ref;
30069         CHECK(val->arr_len == 32);
30070         memcpy(val_ref.data, val->elems, 32); FREE(val);
30071         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
30072 }
30073
30074 int64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_satoshis"))) TS_ClosingSigned_get_fee_satoshis(uint64_t this_ptr) {
30075         LDKClosingSigned this_ptr_conv;
30076         this_ptr_conv.inner = untag_ptr(this_ptr);
30077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30079         this_ptr_conv.is_owned = false;
30080         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
30081         return ret_conv;
30082 }
30083
30084 void  __attribute__((export_name("TS_ClosingSigned_set_fee_satoshis"))) TS_ClosingSigned_set_fee_satoshis(uint64_t this_ptr, int64_t val) {
30085         LDKClosingSigned this_ptr_conv;
30086         this_ptr_conv.inner = untag_ptr(this_ptr);
30087         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30089         this_ptr_conv.is_owned = false;
30090         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
30091 }
30092
30093 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_signature"))) TS_ClosingSigned_get_signature(uint64_t this_ptr) {
30094         LDKClosingSigned this_ptr_conv;
30095         this_ptr_conv.inner = untag_ptr(this_ptr);
30096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30098         this_ptr_conv.is_owned = false;
30099         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30100         memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
30101         return ret_arr;
30102 }
30103
30104 void  __attribute__((export_name("TS_ClosingSigned_set_signature"))) TS_ClosingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
30105         LDKClosingSigned this_ptr_conv;
30106         this_ptr_conv.inner = untag_ptr(this_ptr);
30107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30109         this_ptr_conv.is_owned = false;
30110         LDKSignature val_ref;
30111         CHECK(val->arr_len == 64);
30112         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30113         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
30114 }
30115
30116 uint64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_range"))) TS_ClosingSigned_get_fee_range(uint64_t this_ptr) {
30117         LDKClosingSigned this_ptr_conv;
30118         this_ptr_conv.inner = untag_ptr(this_ptr);
30119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30121         this_ptr_conv.is_owned = false;
30122         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
30123         uint64_t ret_ref = 0;
30124         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30125         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30126         return ret_ref;
30127 }
30128
30129 void  __attribute__((export_name("TS_ClosingSigned_set_fee_range"))) TS_ClosingSigned_set_fee_range(uint64_t this_ptr, uint64_t val) {
30130         LDKClosingSigned this_ptr_conv;
30131         this_ptr_conv.inner = untag_ptr(this_ptr);
30132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30134         this_ptr_conv.is_owned = false;
30135         LDKClosingSignedFeeRange val_conv;
30136         val_conv.inner = untag_ptr(val);
30137         val_conv.is_owned = ptr_is_owned(val);
30138         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
30139         val_conv = ClosingSignedFeeRange_clone(&val_conv);
30140         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
30141 }
30142
30143 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) {
30144         LDKThirtyTwoBytes channel_id_arg_ref;
30145         CHECK(channel_id_arg->arr_len == 32);
30146         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30147         LDKSignature signature_arg_ref;
30148         CHECK(signature_arg->arr_len == 64);
30149         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
30150         LDKClosingSignedFeeRange fee_range_arg_conv;
30151         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
30152         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
30153         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
30154         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
30155         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
30156         uint64_t ret_ref = 0;
30157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30159         return ret_ref;
30160 }
30161
30162 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
30163         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
30164         uint64_t ret_ref = 0;
30165         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30166         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30167         return ret_ref;
30168 }
30169 int64_t  __attribute__((export_name("TS_ClosingSigned_clone_ptr"))) TS_ClosingSigned_clone_ptr(uint64_t arg) {
30170         LDKClosingSigned arg_conv;
30171         arg_conv.inner = untag_ptr(arg);
30172         arg_conv.is_owned = ptr_is_owned(arg);
30173         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30174         arg_conv.is_owned = false;
30175         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
30176         return ret_conv;
30177 }
30178
30179 uint64_t  __attribute__((export_name("TS_ClosingSigned_clone"))) TS_ClosingSigned_clone(uint64_t orig) {
30180         LDKClosingSigned orig_conv;
30181         orig_conv.inner = untag_ptr(orig);
30182         orig_conv.is_owned = ptr_is_owned(orig);
30183         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30184         orig_conv.is_owned = false;
30185         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
30186         uint64_t ret_ref = 0;
30187         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30188         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30189         return ret_ref;
30190 }
30191
30192 void  __attribute__((export_name("TS_UpdateAddHTLC_free"))) TS_UpdateAddHTLC_free(uint64_t this_obj) {
30193         LDKUpdateAddHTLC this_obj_conv;
30194         this_obj_conv.inner = untag_ptr(this_obj);
30195         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30197         UpdateAddHTLC_free(this_obj_conv);
30198 }
30199
30200 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_channel_id"))) TS_UpdateAddHTLC_get_channel_id(uint64_t this_ptr) {
30201         LDKUpdateAddHTLC this_ptr_conv;
30202         this_ptr_conv.inner = untag_ptr(this_ptr);
30203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30205         this_ptr_conv.is_owned = false;
30206         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30207         memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
30208         return ret_arr;
30209 }
30210
30211 void  __attribute__((export_name("TS_UpdateAddHTLC_set_channel_id"))) TS_UpdateAddHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30212         LDKUpdateAddHTLC this_ptr_conv;
30213         this_ptr_conv.inner = untag_ptr(this_ptr);
30214         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30216         this_ptr_conv.is_owned = false;
30217         LDKThirtyTwoBytes val_ref;
30218         CHECK(val->arr_len == 32);
30219         memcpy(val_ref.data, val->elems, 32); FREE(val);
30220         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
30221 }
30222
30223 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_htlc_id"))) TS_UpdateAddHTLC_get_htlc_id(uint64_t this_ptr) {
30224         LDKUpdateAddHTLC this_ptr_conv;
30225         this_ptr_conv.inner = untag_ptr(this_ptr);
30226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30228         this_ptr_conv.is_owned = false;
30229         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
30230         return ret_conv;
30231 }
30232
30233 void  __attribute__((export_name("TS_UpdateAddHTLC_set_htlc_id"))) TS_UpdateAddHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
30234         LDKUpdateAddHTLC this_ptr_conv;
30235         this_ptr_conv.inner = untag_ptr(this_ptr);
30236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30238         this_ptr_conv.is_owned = false;
30239         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
30240 }
30241
30242 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_amount_msat"))) TS_UpdateAddHTLC_get_amount_msat(uint64_t this_ptr) {
30243         LDKUpdateAddHTLC this_ptr_conv;
30244         this_ptr_conv.inner = untag_ptr(this_ptr);
30245         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30247         this_ptr_conv.is_owned = false;
30248         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
30249         return ret_conv;
30250 }
30251
30252 void  __attribute__((export_name("TS_UpdateAddHTLC_set_amount_msat"))) TS_UpdateAddHTLC_set_amount_msat(uint64_t this_ptr, int64_t val) {
30253         LDKUpdateAddHTLC this_ptr_conv;
30254         this_ptr_conv.inner = untag_ptr(this_ptr);
30255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30257         this_ptr_conv.is_owned = false;
30258         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
30259 }
30260
30261 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_payment_hash"))) TS_UpdateAddHTLC_get_payment_hash(uint64_t this_ptr) {
30262         LDKUpdateAddHTLC this_ptr_conv;
30263         this_ptr_conv.inner = untag_ptr(this_ptr);
30264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30266         this_ptr_conv.is_owned = false;
30267         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30268         memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
30269         return ret_arr;
30270 }
30271
30272 void  __attribute__((export_name("TS_UpdateAddHTLC_set_payment_hash"))) TS_UpdateAddHTLC_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
30273         LDKUpdateAddHTLC this_ptr_conv;
30274         this_ptr_conv.inner = untag_ptr(this_ptr);
30275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30277         this_ptr_conv.is_owned = false;
30278         LDKThirtyTwoBytes val_ref;
30279         CHECK(val->arr_len == 32);
30280         memcpy(val_ref.data, val->elems, 32); FREE(val);
30281         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
30282 }
30283
30284 int32_t  __attribute__((export_name("TS_UpdateAddHTLC_get_cltv_expiry"))) TS_UpdateAddHTLC_get_cltv_expiry(uint64_t this_ptr) {
30285         LDKUpdateAddHTLC this_ptr_conv;
30286         this_ptr_conv.inner = untag_ptr(this_ptr);
30287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30289         this_ptr_conv.is_owned = false;
30290         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
30291         return ret_conv;
30292 }
30293
30294 void  __attribute__((export_name("TS_UpdateAddHTLC_set_cltv_expiry"))) TS_UpdateAddHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
30295         LDKUpdateAddHTLC 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         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
30301 }
30302
30303 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
30304         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
30305         uint64_t ret_ref = 0;
30306         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30307         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30308         return ret_ref;
30309 }
30310 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone_ptr"))) TS_UpdateAddHTLC_clone_ptr(uint64_t arg) {
30311         LDKUpdateAddHTLC arg_conv;
30312         arg_conv.inner = untag_ptr(arg);
30313         arg_conv.is_owned = ptr_is_owned(arg);
30314         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30315         arg_conv.is_owned = false;
30316         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
30317         return ret_conv;
30318 }
30319
30320 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone"))) TS_UpdateAddHTLC_clone(uint64_t orig) {
30321         LDKUpdateAddHTLC orig_conv;
30322         orig_conv.inner = untag_ptr(orig);
30323         orig_conv.is_owned = ptr_is_owned(orig);
30324         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30325         orig_conv.is_owned = false;
30326         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
30327         uint64_t ret_ref = 0;
30328         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30329         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30330         return ret_ref;
30331 }
30332
30333 void  __attribute__((export_name("TS_OnionMessage_free"))) TS_OnionMessage_free(uint64_t this_obj) {
30334         LDKOnionMessage this_obj_conv;
30335         this_obj_conv.inner = untag_ptr(this_obj);
30336         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30338         OnionMessage_free(this_obj_conv);
30339 }
30340
30341 int8_tArray  __attribute__((export_name("TS_OnionMessage_get_blinding_point"))) TS_OnionMessage_get_blinding_point(uint64_t this_ptr) {
30342         LDKOnionMessage this_ptr_conv;
30343         this_ptr_conv.inner = untag_ptr(this_ptr);
30344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30346         this_ptr_conv.is_owned = false;
30347         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30348         memcpy(ret_arr->elems, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form, 33);
30349         return ret_arr;
30350 }
30351
30352 void  __attribute__((export_name("TS_OnionMessage_set_blinding_point"))) TS_OnionMessage_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
30353         LDKOnionMessage this_ptr_conv;
30354         this_ptr_conv.inner = untag_ptr(this_ptr);
30355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30357         this_ptr_conv.is_owned = false;
30358         LDKPublicKey val_ref;
30359         CHECK(val->arr_len == 33);
30360         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30361         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
30362 }
30363
30364 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
30365         LDKOnionMessage ret_var = OnionMessage_clone(arg);
30366         uint64_t ret_ref = 0;
30367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30369         return ret_ref;
30370 }
30371 int64_t  __attribute__((export_name("TS_OnionMessage_clone_ptr"))) TS_OnionMessage_clone_ptr(uint64_t arg) {
30372         LDKOnionMessage arg_conv;
30373         arg_conv.inner = untag_ptr(arg);
30374         arg_conv.is_owned = ptr_is_owned(arg);
30375         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30376         arg_conv.is_owned = false;
30377         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
30378         return ret_conv;
30379 }
30380
30381 uint64_t  __attribute__((export_name("TS_OnionMessage_clone"))) TS_OnionMessage_clone(uint64_t orig) {
30382         LDKOnionMessage orig_conv;
30383         orig_conv.inner = untag_ptr(orig);
30384         orig_conv.is_owned = ptr_is_owned(orig);
30385         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30386         orig_conv.is_owned = false;
30387         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
30388         uint64_t ret_ref = 0;
30389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30391         return ret_ref;
30392 }
30393
30394 void  __attribute__((export_name("TS_UpdateFulfillHTLC_free"))) TS_UpdateFulfillHTLC_free(uint64_t this_obj) {
30395         LDKUpdateFulfillHTLC this_obj_conv;
30396         this_obj_conv.inner = untag_ptr(this_obj);
30397         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30399         UpdateFulfillHTLC_free(this_obj_conv);
30400 }
30401
30402 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_channel_id"))) TS_UpdateFulfillHTLC_get_channel_id(uint64_t this_ptr) {
30403         LDKUpdateFulfillHTLC this_ptr_conv;
30404         this_ptr_conv.inner = untag_ptr(this_ptr);
30405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30407         this_ptr_conv.is_owned = false;
30408         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30409         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
30410         return ret_arr;
30411 }
30412
30413 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_channel_id"))) TS_UpdateFulfillHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30414         LDKUpdateFulfillHTLC this_ptr_conv;
30415         this_ptr_conv.inner = untag_ptr(this_ptr);
30416         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30418         this_ptr_conv.is_owned = false;
30419         LDKThirtyTwoBytes val_ref;
30420         CHECK(val->arr_len == 32);
30421         memcpy(val_ref.data, val->elems, 32); FREE(val);
30422         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
30423 }
30424
30425 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_get_htlc_id"))) TS_UpdateFulfillHTLC_get_htlc_id(uint64_t this_ptr) {
30426         LDKUpdateFulfillHTLC this_ptr_conv;
30427         this_ptr_conv.inner = untag_ptr(this_ptr);
30428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30430         this_ptr_conv.is_owned = false;
30431         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
30432         return ret_conv;
30433 }
30434
30435 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_htlc_id"))) TS_UpdateFulfillHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
30436         LDKUpdateFulfillHTLC 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         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
30442 }
30443
30444 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_payment_preimage"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint64_t this_ptr) {
30445         LDKUpdateFulfillHTLC this_ptr_conv;
30446         this_ptr_conv.inner = untag_ptr(this_ptr);
30447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30449         this_ptr_conv.is_owned = false;
30450         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30451         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
30452         return ret_arr;
30453 }
30454
30455 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_payment_preimage"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint64_t this_ptr, int8_tArray val) {
30456         LDKUpdateFulfillHTLC this_ptr_conv;
30457         this_ptr_conv.inner = untag_ptr(this_ptr);
30458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30460         this_ptr_conv.is_owned = false;
30461         LDKThirtyTwoBytes val_ref;
30462         CHECK(val->arr_len == 32);
30463         memcpy(val_ref.data, val->elems, 32); FREE(val);
30464         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
30465 }
30466
30467 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) {
30468         LDKThirtyTwoBytes channel_id_arg_ref;
30469         CHECK(channel_id_arg->arr_len == 32);
30470         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30471         LDKThirtyTwoBytes payment_preimage_arg_ref;
30472         CHECK(payment_preimage_arg->arr_len == 32);
30473         memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
30474         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
30475         uint64_t ret_ref = 0;
30476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30478         return ret_ref;
30479 }
30480
30481 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
30482         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
30483         uint64_t ret_ref = 0;
30484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30486         return ret_ref;
30487 }
30488 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone_ptr"))) TS_UpdateFulfillHTLC_clone_ptr(uint64_t arg) {
30489         LDKUpdateFulfillHTLC arg_conv;
30490         arg_conv.inner = untag_ptr(arg);
30491         arg_conv.is_owned = ptr_is_owned(arg);
30492         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30493         arg_conv.is_owned = false;
30494         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
30495         return ret_conv;
30496 }
30497
30498 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone"))) TS_UpdateFulfillHTLC_clone(uint64_t orig) {
30499         LDKUpdateFulfillHTLC orig_conv;
30500         orig_conv.inner = untag_ptr(orig);
30501         orig_conv.is_owned = ptr_is_owned(orig);
30502         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30503         orig_conv.is_owned = false;
30504         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
30505         uint64_t ret_ref = 0;
30506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30508         return ret_ref;
30509 }
30510
30511 void  __attribute__((export_name("TS_UpdateFailHTLC_free"))) TS_UpdateFailHTLC_free(uint64_t this_obj) {
30512         LDKUpdateFailHTLC this_obj_conv;
30513         this_obj_conv.inner = untag_ptr(this_obj);
30514         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30516         UpdateFailHTLC_free(this_obj_conv);
30517 }
30518
30519 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_get_channel_id"))) TS_UpdateFailHTLC_get_channel_id(uint64_t this_ptr) {
30520         LDKUpdateFailHTLC this_ptr_conv;
30521         this_ptr_conv.inner = untag_ptr(this_ptr);
30522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30524         this_ptr_conv.is_owned = false;
30525         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30526         memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
30527         return ret_arr;
30528 }
30529
30530 void  __attribute__((export_name("TS_UpdateFailHTLC_set_channel_id"))) TS_UpdateFailHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30531         LDKUpdateFailHTLC this_ptr_conv;
30532         this_ptr_conv.inner = untag_ptr(this_ptr);
30533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30535         this_ptr_conv.is_owned = false;
30536         LDKThirtyTwoBytes val_ref;
30537         CHECK(val->arr_len == 32);
30538         memcpy(val_ref.data, val->elems, 32); FREE(val);
30539         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
30540 }
30541
30542 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_get_htlc_id"))) TS_UpdateFailHTLC_get_htlc_id(uint64_t this_ptr) {
30543         LDKUpdateFailHTLC this_ptr_conv;
30544         this_ptr_conv.inner = untag_ptr(this_ptr);
30545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30547         this_ptr_conv.is_owned = false;
30548         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
30549         return ret_conv;
30550 }
30551
30552 void  __attribute__((export_name("TS_UpdateFailHTLC_set_htlc_id"))) TS_UpdateFailHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
30553         LDKUpdateFailHTLC this_ptr_conv;
30554         this_ptr_conv.inner = untag_ptr(this_ptr);
30555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30557         this_ptr_conv.is_owned = false;
30558         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
30559 }
30560
30561 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
30562         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
30563         uint64_t ret_ref = 0;
30564         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30565         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30566         return ret_ref;
30567 }
30568 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone_ptr"))) TS_UpdateFailHTLC_clone_ptr(uint64_t arg) {
30569         LDKUpdateFailHTLC arg_conv;
30570         arg_conv.inner = untag_ptr(arg);
30571         arg_conv.is_owned = ptr_is_owned(arg);
30572         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30573         arg_conv.is_owned = false;
30574         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
30575         return ret_conv;
30576 }
30577
30578 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone"))) TS_UpdateFailHTLC_clone(uint64_t orig) {
30579         LDKUpdateFailHTLC orig_conv;
30580         orig_conv.inner = untag_ptr(orig);
30581         orig_conv.is_owned = ptr_is_owned(orig);
30582         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30583         orig_conv.is_owned = false;
30584         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
30585         uint64_t ret_ref = 0;
30586         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30587         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30588         return ret_ref;
30589 }
30590
30591 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_free"))) TS_UpdateFailMalformedHTLC_free(uint64_t this_obj) {
30592         LDKUpdateFailMalformedHTLC this_obj_conv;
30593         this_obj_conv.inner = untag_ptr(this_obj);
30594         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30596         UpdateFailMalformedHTLC_free(this_obj_conv);
30597 }
30598
30599 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_channel_id"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint64_t this_ptr) {
30600         LDKUpdateFailMalformedHTLC this_ptr_conv;
30601         this_ptr_conv.inner = untag_ptr(this_ptr);
30602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30604         this_ptr_conv.is_owned = false;
30605         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30606         memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
30607         return ret_arr;
30608 }
30609
30610 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_channel_id"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30611         LDKUpdateFailMalformedHTLC this_ptr_conv;
30612         this_ptr_conv.inner = untag_ptr(this_ptr);
30613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30615         this_ptr_conv.is_owned = false;
30616         LDKThirtyTwoBytes val_ref;
30617         CHECK(val->arr_len == 32);
30618         memcpy(val_ref.data, val->elems, 32); FREE(val);
30619         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
30620 }
30621
30622 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_htlc_id"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint64_t this_ptr) {
30623         LDKUpdateFailMalformedHTLC this_ptr_conv;
30624         this_ptr_conv.inner = untag_ptr(this_ptr);
30625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30627         this_ptr_conv.is_owned = false;
30628         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
30629         return ret_conv;
30630 }
30631
30632 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_htlc_id"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
30633         LDKUpdateFailMalformedHTLC this_ptr_conv;
30634         this_ptr_conv.inner = untag_ptr(this_ptr);
30635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30637         this_ptr_conv.is_owned = false;
30638         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
30639 }
30640
30641 int16_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_failure_code"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint64_t this_ptr) {
30642         LDKUpdateFailMalformedHTLC this_ptr_conv;
30643         this_ptr_conv.inner = untag_ptr(this_ptr);
30644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30646         this_ptr_conv.is_owned = false;
30647         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
30648         return ret_conv;
30649 }
30650
30651 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_failure_code"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint64_t this_ptr, int16_t val) {
30652         LDKUpdateFailMalformedHTLC this_ptr_conv;
30653         this_ptr_conv.inner = untag_ptr(this_ptr);
30654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30656         this_ptr_conv.is_owned = false;
30657         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
30658 }
30659
30660 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
30661         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
30662         uint64_t ret_ref = 0;
30663         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30664         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30665         return ret_ref;
30666 }
30667 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone_ptr"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint64_t arg) {
30668         LDKUpdateFailMalformedHTLC arg_conv;
30669         arg_conv.inner = untag_ptr(arg);
30670         arg_conv.is_owned = ptr_is_owned(arg);
30671         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30672         arg_conv.is_owned = false;
30673         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
30674         return ret_conv;
30675 }
30676
30677 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone"))) TS_UpdateFailMalformedHTLC_clone(uint64_t orig) {
30678         LDKUpdateFailMalformedHTLC orig_conv;
30679         orig_conv.inner = untag_ptr(orig);
30680         orig_conv.is_owned = ptr_is_owned(orig);
30681         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30682         orig_conv.is_owned = false;
30683         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
30684         uint64_t ret_ref = 0;
30685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30687         return ret_ref;
30688 }
30689
30690 void  __attribute__((export_name("TS_CommitmentSigned_free"))) TS_CommitmentSigned_free(uint64_t this_obj) {
30691         LDKCommitmentSigned this_obj_conv;
30692         this_obj_conv.inner = untag_ptr(this_obj);
30693         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30695         CommitmentSigned_free(this_obj_conv);
30696 }
30697
30698 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_channel_id"))) TS_CommitmentSigned_get_channel_id(uint64_t this_ptr) {
30699         LDKCommitmentSigned this_ptr_conv;
30700         this_ptr_conv.inner = untag_ptr(this_ptr);
30701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30703         this_ptr_conv.is_owned = false;
30704         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30705         memcpy(ret_arr->elems, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
30706         return ret_arr;
30707 }
30708
30709 void  __attribute__((export_name("TS_CommitmentSigned_set_channel_id"))) TS_CommitmentSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30710         LDKCommitmentSigned this_ptr_conv;
30711         this_ptr_conv.inner = untag_ptr(this_ptr);
30712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30714         this_ptr_conv.is_owned = false;
30715         LDKThirtyTwoBytes val_ref;
30716         CHECK(val->arr_len == 32);
30717         memcpy(val_ref.data, val->elems, 32); FREE(val);
30718         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
30719 }
30720
30721 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_signature"))) TS_CommitmentSigned_get_signature(uint64_t this_ptr) {
30722         LDKCommitmentSigned this_ptr_conv;
30723         this_ptr_conv.inner = untag_ptr(this_ptr);
30724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30726         this_ptr_conv.is_owned = false;
30727         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
30728         memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
30729         return ret_arr;
30730 }
30731
30732 void  __attribute__((export_name("TS_CommitmentSigned_set_signature"))) TS_CommitmentSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
30733         LDKCommitmentSigned this_ptr_conv;
30734         this_ptr_conv.inner = untag_ptr(this_ptr);
30735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30737         this_ptr_conv.is_owned = false;
30738         LDKSignature val_ref;
30739         CHECK(val->arr_len == 64);
30740         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
30741         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
30742 }
30743
30744 ptrArray  __attribute__((export_name("TS_CommitmentSigned_get_htlc_signatures"))) TS_CommitmentSigned_get_htlc_signatures(uint64_t this_ptr) {
30745         LDKCommitmentSigned this_ptr_conv;
30746         this_ptr_conv.inner = untag_ptr(this_ptr);
30747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30749         this_ptr_conv.is_owned = false;
30750         LDKCVec_SignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
30751         ptrArray ret_arr = NULL;
30752         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
30753         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
30754         for (size_t m = 0; m < ret_var.datalen; m++) {
30755                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
30756                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
30757                 ret_arr_ptr[m] = ret_conv_12_arr;
30758         }
30759         
30760         FREE(ret_var.data);
30761         return ret_arr;
30762 }
30763
30764 void  __attribute__((export_name("TS_CommitmentSigned_set_htlc_signatures"))) TS_CommitmentSigned_set_htlc_signatures(uint64_t this_ptr, ptrArray val) {
30765         LDKCommitmentSigned this_ptr_conv;
30766         this_ptr_conv.inner = untag_ptr(this_ptr);
30767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30769         this_ptr_conv.is_owned = false;
30770         LDKCVec_SignatureZ val_constr;
30771         val_constr.datalen = val->arr_len;
30772         if (val_constr.datalen > 0)
30773                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
30774         else
30775                 val_constr.data = NULL;
30776         int8_tArray* val_vals = (void*) val->elems;
30777         for (size_t m = 0; m < val_constr.datalen; m++) {
30778                 int8_tArray val_conv_12 = val_vals[m];
30779                 LDKSignature val_conv_12_ref;
30780                 CHECK(val_conv_12->arr_len == 64);
30781                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
30782                 val_constr.data[m] = val_conv_12_ref;
30783         }
30784         FREE(val);
30785         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
30786 }
30787
30788 uint64_t  __attribute__((export_name("TS_CommitmentSigned_new"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
30789         LDKThirtyTwoBytes channel_id_arg_ref;
30790         CHECK(channel_id_arg->arr_len == 32);
30791         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30792         LDKSignature signature_arg_ref;
30793         CHECK(signature_arg->arr_len == 64);
30794         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
30795         LDKCVec_SignatureZ htlc_signatures_arg_constr;
30796         htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
30797         if (htlc_signatures_arg_constr.datalen > 0)
30798                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
30799         else
30800                 htlc_signatures_arg_constr.data = NULL;
30801         int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
30802         for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
30803                 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
30804                 LDKSignature htlc_signatures_arg_conv_12_ref;
30805                 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
30806                 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64); FREE(htlc_signatures_arg_conv_12);
30807                 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
30808         }
30809         FREE(htlc_signatures_arg);
30810         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
30811         uint64_t ret_ref = 0;
30812         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30813         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30814         return ret_ref;
30815 }
30816
30817 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
30818         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
30819         uint64_t ret_ref = 0;
30820         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30821         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30822         return ret_ref;
30823 }
30824 int64_t  __attribute__((export_name("TS_CommitmentSigned_clone_ptr"))) TS_CommitmentSigned_clone_ptr(uint64_t arg) {
30825         LDKCommitmentSigned arg_conv;
30826         arg_conv.inner = untag_ptr(arg);
30827         arg_conv.is_owned = ptr_is_owned(arg);
30828         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30829         arg_conv.is_owned = false;
30830         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
30831         return ret_conv;
30832 }
30833
30834 uint64_t  __attribute__((export_name("TS_CommitmentSigned_clone"))) TS_CommitmentSigned_clone(uint64_t orig) {
30835         LDKCommitmentSigned orig_conv;
30836         orig_conv.inner = untag_ptr(orig);
30837         orig_conv.is_owned = ptr_is_owned(orig);
30838         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30839         orig_conv.is_owned = false;
30840         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
30841         uint64_t ret_ref = 0;
30842         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30843         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30844         return ret_ref;
30845 }
30846
30847 void  __attribute__((export_name("TS_RevokeAndACK_free"))) TS_RevokeAndACK_free(uint64_t this_obj) {
30848         LDKRevokeAndACK this_obj_conv;
30849         this_obj_conv.inner = untag_ptr(this_obj);
30850         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30852         RevokeAndACK_free(this_obj_conv);
30853 }
30854
30855 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_channel_id"))) TS_RevokeAndACK_get_channel_id(uint64_t this_ptr) {
30856         LDKRevokeAndACK this_ptr_conv;
30857         this_ptr_conv.inner = untag_ptr(this_ptr);
30858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30860         this_ptr_conv.is_owned = false;
30861         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30862         memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
30863         return ret_arr;
30864 }
30865
30866 void  __attribute__((export_name("TS_RevokeAndACK_set_channel_id"))) TS_RevokeAndACK_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30867         LDKRevokeAndACK this_ptr_conv;
30868         this_ptr_conv.inner = untag_ptr(this_ptr);
30869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30871         this_ptr_conv.is_owned = false;
30872         LDKThirtyTwoBytes val_ref;
30873         CHECK(val->arr_len == 32);
30874         memcpy(val_ref.data, val->elems, 32); FREE(val);
30875         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
30876 }
30877
30878 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_per_commitment_secret"))) TS_RevokeAndACK_get_per_commitment_secret(uint64_t this_ptr) {
30879         LDKRevokeAndACK this_ptr_conv;
30880         this_ptr_conv.inner = untag_ptr(this_ptr);
30881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30883         this_ptr_conv.is_owned = false;
30884         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30885         memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
30886         return ret_arr;
30887 }
30888
30889 void  __attribute__((export_name("TS_RevokeAndACK_set_per_commitment_secret"))) TS_RevokeAndACK_set_per_commitment_secret(uint64_t this_ptr, int8_tArray val) {
30890         LDKRevokeAndACK this_ptr_conv;
30891         this_ptr_conv.inner = untag_ptr(this_ptr);
30892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30894         this_ptr_conv.is_owned = false;
30895         LDKThirtyTwoBytes val_ref;
30896         CHECK(val->arr_len == 32);
30897         memcpy(val_ref.data, val->elems, 32); FREE(val);
30898         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
30899 }
30900
30901 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_next_per_commitment_point"))) TS_RevokeAndACK_get_next_per_commitment_point(uint64_t this_ptr) {
30902         LDKRevokeAndACK this_ptr_conv;
30903         this_ptr_conv.inner = untag_ptr(this_ptr);
30904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30906         this_ptr_conv.is_owned = false;
30907         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30908         memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
30909         return ret_arr;
30910 }
30911
30912 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) {
30913         LDKRevokeAndACK this_ptr_conv;
30914         this_ptr_conv.inner = untag_ptr(this_ptr);
30915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30917         this_ptr_conv.is_owned = false;
30918         LDKPublicKey val_ref;
30919         CHECK(val->arr_len == 33);
30920         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
30921         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
30922 }
30923
30924 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) {
30925         LDKThirtyTwoBytes channel_id_arg_ref;
30926         CHECK(channel_id_arg->arr_len == 32);
30927         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
30928         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
30929         CHECK(per_commitment_secret_arg->arr_len == 32);
30930         memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
30931         LDKPublicKey next_per_commitment_point_arg_ref;
30932         CHECK(next_per_commitment_point_arg->arr_len == 33);
30933         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
30934         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
30935         uint64_t ret_ref = 0;
30936         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30937         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30938         return ret_ref;
30939 }
30940
30941 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
30942         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
30943         uint64_t ret_ref = 0;
30944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30946         return ret_ref;
30947 }
30948 int64_t  __attribute__((export_name("TS_RevokeAndACK_clone_ptr"))) TS_RevokeAndACK_clone_ptr(uint64_t arg) {
30949         LDKRevokeAndACK arg_conv;
30950         arg_conv.inner = untag_ptr(arg);
30951         arg_conv.is_owned = ptr_is_owned(arg);
30952         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30953         arg_conv.is_owned = false;
30954         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
30955         return ret_conv;
30956 }
30957
30958 uint64_t  __attribute__((export_name("TS_RevokeAndACK_clone"))) TS_RevokeAndACK_clone(uint64_t orig) {
30959         LDKRevokeAndACK orig_conv;
30960         orig_conv.inner = untag_ptr(orig);
30961         orig_conv.is_owned = ptr_is_owned(orig);
30962         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30963         orig_conv.is_owned = false;
30964         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
30965         uint64_t ret_ref = 0;
30966         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30967         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30968         return ret_ref;
30969 }
30970
30971 void  __attribute__((export_name("TS_UpdateFee_free"))) TS_UpdateFee_free(uint64_t this_obj) {
30972         LDKUpdateFee this_obj_conv;
30973         this_obj_conv.inner = untag_ptr(this_obj);
30974         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30976         UpdateFee_free(this_obj_conv);
30977 }
30978
30979 int8_tArray  __attribute__((export_name("TS_UpdateFee_get_channel_id"))) TS_UpdateFee_get_channel_id(uint64_t this_ptr) {
30980         LDKUpdateFee this_ptr_conv;
30981         this_ptr_conv.inner = untag_ptr(this_ptr);
30982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30984         this_ptr_conv.is_owned = false;
30985         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
30986         memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
30987         return ret_arr;
30988 }
30989
30990 void  __attribute__((export_name("TS_UpdateFee_set_channel_id"))) TS_UpdateFee_set_channel_id(uint64_t this_ptr, int8_tArray val) {
30991         LDKUpdateFee this_ptr_conv;
30992         this_ptr_conv.inner = untag_ptr(this_ptr);
30993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30995         this_ptr_conv.is_owned = false;
30996         LDKThirtyTwoBytes val_ref;
30997         CHECK(val->arr_len == 32);
30998         memcpy(val_ref.data, val->elems, 32); FREE(val);
30999         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
31000 }
31001
31002 int32_t  __attribute__((export_name("TS_UpdateFee_get_feerate_per_kw"))) TS_UpdateFee_get_feerate_per_kw(uint64_t this_ptr) {
31003         LDKUpdateFee this_ptr_conv;
31004         this_ptr_conv.inner = untag_ptr(this_ptr);
31005         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31007         this_ptr_conv.is_owned = false;
31008         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
31009         return ret_conv;
31010 }
31011
31012 void  __attribute__((export_name("TS_UpdateFee_set_feerate_per_kw"))) TS_UpdateFee_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
31013         LDKUpdateFee this_ptr_conv;
31014         this_ptr_conv.inner = untag_ptr(this_ptr);
31015         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31017         this_ptr_conv.is_owned = false;
31018         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
31019 }
31020
31021 uint64_t  __attribute__((export_name("TS_UpdateFee_new"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
31022         LDKThirtyTwoBytes channel_id_arg_ref;
31023         CHECK(channel_id_arg->arr_len == 32);
31024         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
31025         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
31026         uint64_t ret_ref = 0;
31027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31029         return ret_ref;
31030 }
31031
31032 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
31033         LDKUpdateFee ret_var = UpdateFee_clone(arg);
31034         uint64_t ret_ref = 0;
31035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31037         return ret_ref;
31038 }
31039 int64_t  __attribute__((export_name("TS_UpdateFee_clone_ptr"))) TS_UpdateFee_clone_ptr(uint64_t arg) {
31040         LDKUpdateFee arg_conv;
31041         arg_conv.inner = untag_ptr(arg);
31042         arg_conv.is_owned = ptr_is_owned(arg);
31043         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31044         arg_conv.is_owned = false;
31045         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
31046         return ret_conv;
31047 }
31048
31049 uint64_t  __attribute__((export_name("TS_UpdateFee_clone"))) TS_UpdateFee_clone(uint64_t orig) {
31050         LDKUpdateFee orig_conv;
31051         orig_conv.inner = untag_ptr(orig);
31052         orig_conv.is_owned = ptr_is_owned(orig);
31053         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31054         orig_conv.is_owned = false;
31055         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
31056         uint64_t ret_ref = 0;
31057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31059         return ret_ref;
31060 }
31061
31062 void  __attribute__((export_name("TS_DataLossProtect_free"))) TS_DataLossProtect_free(uint64_t this_obj) {
31063         LDKDataLossProtect this_obj_conv;
31064         this_obj_conv.inner = untag_ptr(this_obj);
31065         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31067         DataLossProtect_free(this_obj_conv);
31068 }
31069
31070 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) {
31071         LDKDataLossProtect this_ptr_conv;
31072         this_ptr_conv.inner = untag_ptr(this_ptr);
31073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31075         this_ptr_conv.is_owned = false;
31076         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31077         memcpy(ret_arr->elems, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
31078         return ret_arr;
31079 }
31080
31081 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) {
31082         LDKDataLossProtect this_ptr_conv;
31083         this_ptr_conv.inner = untag_ptr(this_ptr);
31084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31086         this_ptr_conv.is_owned = false;
31087         LDKThirtyTwoBytes val_ref;
31088         CHECK(val->arr_len == 32);
31089         memcpy(val_ref.data, val->elems, 32); FREE(val);
31090         DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
31091 }
31092
31093 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) {
31094         LDKDataLossProtect this_ptr_conv;
31095         this_ptr_conv.inner = untag_ptr(this_ptr);
31096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31098         this_ptr_conv.is_owned = false;
31099         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31100         memcpy(ret_arr->elems, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
31101         return ret_arr;
31102 }
31103
31104 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) {
31105         LDKDataLossProtect this_ptr_conv;
31106         this_ptr_conv.inner = untag_ptr(this_ptr);
31107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31109         this_ptr_conv.is_owned = false;
31110         LDKPublicKey val_ref;
31111         CHECK(val->arr_len == 33);
31112         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31113         DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
31114 }
31115
31116 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) {
31117         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
31118         CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
31119         memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
31120         LDKPublicKey my_current_per_commitment_point_arg_ref;
31121         CHECK(my_current_per_commitment_point_arg->arr_len == 33);
31122         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);
31123         LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
31124         uint64_t ret_ref = 0;
31125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31127         return ret_ref;
31128 }
31129
31130 static inline uint64_t DataLossProtect_clone_ptr(LDKDataLossProtect *NONNULL_PTR arg) {
31131         LDKDataLossProtect ret_var = DataLossProtect_clone(arg);
31132         uint64_t ret_ref = 0;
31133         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31134         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31135         return ret_ref;
31136 }
31137 int64_t  __attribute__((export_name("TS_DataLossProtect_clone_ptr"))) TS_DataLossProtect_clone_ptr(uint64_t arg) {
31138         LDKDataLossProtect arg_conv;
31139         arg_conv.inner = untag_ptr(arg);
31140         arg_conv.is_owned = ptr_is_owned(arg);
31141         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31142         arg_conv.is_owned = false;
31143         int64_t ret_conv = DataLossProtect_clone_ptr(&arg_conv);
31144         return ret_conv;
31145 }
31146
31147 uint64_t  __attribute__((export_name("TS_DataLossProtect_clone"))) TS_DataLossProtect_clone(uint64_t orig) {
31148         LDKDataLossProtect orig_conv;
31149         orig_conv.inner = untag_ptr(orig);
31150         orig_conv.is_owned = ptr_is_owned(orig);
31151         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31152         orig_conv.is_owned = false;
31153         LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
31154         uint64_t ret_ref = 0;
31155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31157         return ret_ref;
31158 }
31159
31160 void  __attribute__((export_name("TS_ChannelReestablish_free"))) TS_ChannelReestablish_free(uint64_t this_obj) {
31161         LDKChannelReestablish this_obj_conv;
31162         this_obj_conv.inner = untag_ptr(this_obj);
31163         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31165         ChannelReestablish_free(this_obj_conv);
31166 }
31167
31168 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_get_channel_id"))) TS_ChannelReestablish_get_channel_id(uint64_t this_ptr) {
31169         LDKChannelReestablish this_ptr_conv;
31170         this_ptr_conv.inner = untag_ptr(this_ptr);
31171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31173         this_ptr_conv.is_owned = false;
31174         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31175         memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
31176         return ret_arr;
31177 }
31178
31179 void  __attribute__((export_name("TS_ChannelReestablish_set_channel_id"))) TS_ChannelReestablish_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31180         LDKChannelReestablish this_ptr_conv;
31181         this_ptr_conv.inner = untag_ptr(this_ptr);
31182         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31184         this_ptr_conv.is_owned = false;
31185         LDKThirtyTwoBytes val_ref;
31186         CHECK(val->arr_len == 32);
31187         memcpy(val_ref.data, val->elems, 32); FREE(val);
31188         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
31189 }
31190
31191 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_local_commitment_number"))) TS_ChannelReestablish_get_next_local_commitment_number(uint64_t this_ptr) {
31192         LDKChannelReestablish this_ptr_conv;
31193         this_ptr_conv.inner = untag_ptr(this_ptr);
31194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31196         this_ptr_conv.is_owned = false;
31197         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
31198         return ret_conv;
31199 }
31200
31201 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) {
31202         LDKChannelReestablish this_ptr_conv;
31203         this_ptr_conv.inner = untag_ptr(this_ptr);
31204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31206         this_ptr_conv.is_owned = false;
31207         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
31208 }
31209
31210 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_remote_commitment_number"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint64_t this_ptr) {
31211         LDKChannelReestablish this_ptr_conv;
31212         this_ptr_conv.inner = untag_ptr(this_ptr);
31213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31215         this_ptr_conv.is_owned = false;
31216         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
31217         return ret_conv;
31218 }
31219
31220 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) {
31221         LDKChannelReestablish this_ptr_conv;
31222         this_ptr_conv.inner = untag_ptr(this_ptr);
31223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31225         this_ptr_conv.is_owned = false;
31226         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
31227 }
31228
31229 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
31230         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
31231         uint64_t ret_ref = 0;
31232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31234         return ret_ref;
31235 }
31236 int64_t  __attribute__((export_name("TS_ChannelReestablish_clone_ptr"))) TS_ChannelReestablish_clone_ptr(uint64_t arg) {
31237         LDKChannelReestablish arg_conv;
31238         arg_conv.inner = untag_ptr(arg);
31239         arg_conv.is_owned = ptr_is_owned(arg);
31240         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31241         arg_conv.is_owned = false;
31242         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
31243         return ret_conv;
31244 }
31245
31246 uint64_t  __attribute__((export_name("TS_ChannelReestablish_clone"))) TS_ChannelReestablish_clone(uint64_t orig) {
31247         LDKChannelReestablish orig_conv;
31248         orig_conv.inner = untag_ptr(orig);
31249         orig_conv.is_owned = ptr_is_owned(orig);
31250         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31251         orig_conv.is_owned = false;
31252         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
31253         uint64_t ret_ref = 0;
31254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31256         return ret_ref;
31257 }
31258
31259 void  __attribute__((export_name("TS_AnnouncementSignatures_free"))) TS_AnnouncementSignatures_free(uint64_t this_obj) {
31260         LDKAnnouncementSignatures this_obj_conv;
31261         this_obj_conv.inner = untag_ptr(this_obj);
31262         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31264         AnnouncementSignatures_free(this_obj_conv);
31265 }
31266
31267 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_channel_id"))) TS_AnnouncementSignatures_get_channel_id(uint64_t this_ptr) {
31268         LDKAnnouncementSignatures this_ptr_conv;
31269         this_ptr_conv.inner = untag_ptr(this_ptr);
31270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31272         this_ptr_conv.is_owned = false;
31273         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31274         memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
31275         return ret_arr;
31276 }
31277
31278 void  __attribute__((export_name("TS_AnnouncementSignatures_set_channel_id"))) TS_AnnouncementSignatures_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31279         LDKAnnouncementSignatures this_ptr_conv;
31280         this_ptr_conv.inner = untag_ptr(this_ptr);
31281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31283         this_ptr_conv.is_owned = false;
31284         LDKThirtyTwoBytes val_ref;
31285         CHECK(val->arr_len == 32);
31286         memcpy(val_ref.data, val->elems, 32); FREE(val);
31287         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
31288 }
31289
31290 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_get_short_channel_id"))) TS_AnnouncementSignatures_get_short_channel_id(uint64_t this_ptr) {
31291         LDKAnnouncementSignatures this_ptr_conv;
31292         this_ptr_conv.inner = untag_ptr(this_ptr);
31293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31295         this_ptr_conv.is_owned = false;
31296         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
31297         return ret_conv;
31298 }
31299
31300 void  __attribute__((export_name("TS_AnnouncementSignatures_set_short_channel_id"))) TS_AnnouncementSignatures_set_short_channel_id(uint64_t this_ptr, int64_t val) {
31301         LDKAnnouncementSignatures this_ptr_conv;
31302         this_ptr_conv.inner = untag_ptr(this_ptr);
31303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31305         this_ptr_conv.is_owned = false;
31306         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
31307 }
31308
31309 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_node_signature"))) TS_AnnouncementSignatures_get_node_signature(uint64_t this_ptr) {
31310         LDKAnnouncementSignatures this_ptr_conv;
31311         this_ptr_conv.inner = untag_ptr(this_ptr);
31312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31314         this_ptr_conv.is_owned = false;
31315         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31316         memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
31317         return ret_arr;
31318 }
31319
31320 void  __attribute__((export_name("TS_AnnouncementSignatures_set_node_signature"))) TS_AnnouncementSignatures_set_node_signature(uint64_t this_ptr, int8_tArray val) {
31321         LDKAnnouncementSignatures this_ptr_conv;
31322         this_ptr_conv.inner = untag_ptr(this_ptr);
31323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31325         this_ptr_conv.is_owned = false;
31326         LDKSignature val_ref;
31327         CHECK(val->arr_len == 64);
31328         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31329         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
31330 }
31331
31332 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_bitcoin_signature"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint64_t this_ptr) {
31333         LDKAnnouncementSignatures this_ptr_conv;
31334         this_ptr_conv.inner = untag_ptr(this_ptr);
31335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31337         this_ptr_conv.is_owned = false;
31338         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31339         memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
31340         return ret_arr;
31341 }
31342
31343 void  __attribute__((export_name("TS_AnnouncementSignatures_set_bitcoin_signature"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint64_t this_ptr, int8_tArray val) {
31344         LDKAnnouncementSignatures this_ptr_conv;
31345         this_ptr_conv.inner = untag_ptr(this_ptr);
31346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31348         this_ptr_conv.is_owned = false;
31349         LDKSignature val_ref;
31350         CHECK(val->arr_len == 64);
31351         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31352         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
31353 }
31354
31355 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) {
31356         LDKThirtyTwoBytes channel_id_arg_ref;
31357         CHECK(channel_id_arg->arr_len == 32);
31358         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
31359         LDKSignature node_signature_arg_ref;
31360         CHECK(node_signature_arg->arr_len == 64);
31361         memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
31362         LDKSignature bitcoin_signature_arg_ref;
31363         CHECK(bitcoin_signature_arg->arr_len == 64);
31364         memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
31365         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
31366         uint64_t ret_ref = 0;
31367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31369         return ret_ref;
31370 }
31371
31372 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
31373         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
31374         uint64_t ret_ref = 0;
31375         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31376         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31377         return ret_ref;
31378 }
31379 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone_ptr"))) TS_AnnouncementSignatures_clone_ptr(uint64_t arg) {
31380         LDKAnnouncementSignatures arg_conv;
31381         arg_conv.inner = untag_ptr(arg);
31382         arg_conv.is_owned = ptr_is_owned(arg);
31383         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31384         arg_conv.is_owned = false;
31385         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
31386         return ret_conv;
31387 }
31388
31389 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone"))) TS_AnnouncementSignatures_clone(uint64_t orig) {
31390         LDKAnnouncementSignatures orig_conv;
31391         orig_conv.inner = untag_ptr(orig);
31392         orig_conv.is_owned = ptr_is_owned(orig);
31393         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31394         orig_conv.is_owned = false;
31395         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
31396         uint64_t ret_ref = 0;
31397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31399         return ret_ref;
31400 }
31401
31402 void  __attribute__((export_name("TS_NetAddress_free"))) TS_NetAddress_free(uint64_t this_ptr) {
31403         if (!ptr_is_owned(this_ptr)) return;
31404         void* this_ptr_ptr = untag_ptr(this_ptr);
31405         CHECK_ACCESS(this_ptr_ptr);
31406         LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
31407         FREE(untag_ptr(this_ptr));
31408         NetAddress_free(this_ptr_conv);
31409 }
31410
31411 static inline uint64_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
31412         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
31413         *ret_copy = NetAddress_clone(arg);
31414         uint64_t ret_ref = tag_ptr(ret_copy, true);
31415         return ret_ref;
31416 }
31417 int64_t  __attribute__((export_name("TS_NetAddress_clone_ptr"))) TS_NetAddress_clone_ptr(uint64_t arg) {
31418         LDKNetAddress* arg_conv = (LDKNetAddress*)untag_ptr(arg);
31419         int64_t ret_conv = NetAddress_clone_ptr(arg_conv);
31420         return ret_conv;
31421 }
31422
31423 uint64_t  __attribute__((export_name("TS_NetAddress_clone"))) TS_NetAddress_clone(uint64_t orig) {
31424         LDKNetAddress* orig_conv = (LDKNetAddress*)untag_ptr(orig);
31425         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
31426         *ret_copy = NetAddress_clone(orig_conv);
31427         uint64_t ret_ref = tag_ptr(ret_copy, true);
31428         return ret_ref;
31429 }
31430
31431 uint64_t  __attribute__((export_name("TS_NetAddress_ipv4"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
31432         LDKFourBytes addr_ref;
31433         CHECK(addr->arr_len == 4);
31434         memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
31435         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
31436         *ret_copy = NetAddress_ipv4(addr_ref, port);
31437         uint64_t ret_ref = tag_ptr(ret_copy, true);
31438         return ret_ref;
31439 }
31440
31441 uint64_t  __attribute__((export_name("TS_NetAddress_ipv6"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
31442         LDKSixteenBytes addr_ref;
31443         CHECK(addr->arr_len == 16);
31444         memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
31445         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
31446         *ret_copy = NetAddress_ipv6(addr_ref, port);
31447         uint64_t ret_ref = tag_ptr(ret_copy, true);
31448         return ret_ref;
31449 }
31450
31451 uint64_t  __attribute__((export_name("TS_NetAddress_onion_v2"))) TS_NetAddress_onion_v2(int8_tArray a) {
31452         LDKTwelveBytes a_ref;
31453         CHECK(a->arr_len == 12);
31454         memcpy(a_ref.data, a->elems, 12); FREE(a);
31455         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
31456         *ret_copy = NetAddress_onion_v2(a_ref);
31457         uint64_t ret_ref = tag_ptr(ret_copy, true);
31458         return ret_ref;
31459 }
31460
31461 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) {
31462         LDKThirtyTwoBytes ed25519_pubkey_ref;
31463         CHECK(ed25519_pubkey->arr_len == 32);
31464         memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
31465         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
31466         *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
31467         uint64_t ret_ref = tag_ptr(ret_copy, true);
31468         return ret_ref;
31469 }
31470
31471 uint64_t  __attribute__((export_name("TS_NetAddress_hostname"))) TS_NetAddress_hostname(uint64_t hostname, int16_t port) {
31472         LDKHostname hostname_conv;
31473         hostname_conv.inner = untag_ptr(hostname);
31474         hostname_conv.is_owned = ptr_is_owned(hostname);
31475         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
31476         hostname_conv = Hostname_clone(&hostname_conv);
31477         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
31478         *ret_copy = NetAddress_hostname(hostname_conv, port);
31479         uint64_t ret_ref = tag_ptr(ret_copy, true);
31480         return ret_ref;
31481 }
31482
31483 int8_tArray  __attribute__((export_name("TS_NetAddress_write"))) TS_NetAddress_write(uint64_t obj) {
31484         LDKNetAddress* obj_conv = (LDKNetAddress*)untag_ptr(obj);
31485         LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
31486         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31487         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31488         CVec_u8Z_free(ret_var);
31489         return ret_arr;
31490 }
31491
31492 uint64_t  __attribute__((export_name("TS_NetAddress_read"))) TS_NetAddress_read(int8_tArray ser) {
31493         LDKu8slice ser_ref;
31494         ser_ref.datalen = ser->arr_len;
31495         ser_ref.data = ser->elems;
31496         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
31497         *ret_conv = NetAddress_read(ser_ref);
31498         FREE(ser);
31499         return tag_ptr(ret_conv, true);
31500 }
31501
31502 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint64_t this_obj) {
31503         LDKUnsignedNodeAnnouncement this_obj_conv;
31504         this_obj_conv.inner = untag_ptr(this_obj);
31505         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31507         UnsignedNodeAnnouncement_free(this_obj_conv);
31508 }
31509
31510 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_features"))) TS_UnsignedNodeAnnouncement_get_features(uint64_t this_ptr) {
31511         LDKUnsignedNodeAnnouncement this_ptr_conv;
31512         this_ptr_conv.inner = untag_ptr(this_ptr);
31513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31515         this_ptr_conv.is_owned = false;
31516         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
31517         uint64_t ret_ref = 0;
31518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31520         return ret_ref;
31521 }
31522
31523 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_features"))) TS_UnsignedNodeAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
31524         LDKUnsignedNodeAnnouncement this_ptr_conv;
31525         this_ptr_conv.inner = untag_ptr(this_ptr);
31526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31528         this_ptr_conv.is_owned = false;
31529         LDKNodeFeatures val_conv;
31530         val_conv.inner = untag_ptr(val);
31531         val_conv.is_owned = ptr_is_owned(val);
31532         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31533         val_conv = NodeFeatures_clone(&val_conv);
31534         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
31535 }
31536
31537 int32_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_timestamp"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint64_t this_ptr) {
31538         LDKUnsignedNodeAnnouncement this_ptr_conv;
31539         this_ptr_conv.inner = untag_ptr(this_ptr);
31540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31542         this_ptr_conv.is_owned = false;
31543         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
31544         return ret_conv;
31545 }
31546
31547 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint64_t this_ptr, int32_t val) {
31548         LDKUnsignedNodeAnnouncement this_ptr_conv;
31549         this_ptr_conv.inner = untag_ptr(this_ptr);
31550         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31552         this_ptr_conv.is_owned = false;
31553         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
31554 }
31555
31556 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint64_t this_ptr) {
31557         LDKUnsignedNodeAnnouncement this_ptr_conv;
31558         this_ptr_conv.inner = untag_ptr(this_ptr);
31559         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31561         this_ptr_conv.is_owned = false;
31562         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31563         memcpy(ret_arr->elems, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33);
31564         return ret_arr;
31565 }
31566
31567 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint64_t this_ptr, int8_tArray val) {
31568         LDKUnsignedNodeAnnouncement this_ptr_conv;
31569         this_ptr_conv.inner = untag_ptr(this_ptr);
31570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31572         this_ptr_conv.is_owned = false;
31573         LDKPublicKey val_ref;
31574         CHECK(val->arr_len == 33);
31575         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31576         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
31577 }
31578
31579 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint64_t this_ptr) {
31580         LDKUnsignedNodeAnnouncement this_ptr_conv;
31581         this_ptr_conv.inner = untag_ptr(this_ptr);
31582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31584         this_ptr_conv.is_owned = false;
31585         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
31586         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
31587         return ret_arr;
31588 }
31589
31590 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_rgb"))) TS_UnsignedNodeAnnouncement_set_rgb(uint64_t this_ptr, int8_tArray val) {
31591         LDKUnsignedNodeAnnouncement this_ptr_conv;
31592         this_ptr_conv.inner = untag_ptr(this_ptr);
31593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31595         this_ptr_conv.is_owned = false;
31596         LDKThreeBytes val_ref;
31597         CHECK(val->arr_len == 3);
31598         memcpy(val_ref.data, val->elems, 3); FREE(val);
31599         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
31600 }
31601
31602 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_alias"))) TS_UnsignedNodeAnnouncement_get_alias(uint64_t this_ptr) {
31603         LDKUnsignedNodeAnnouncement this_ptr_conv;
31604         this_ptr_conv.inner = untag_ptr(this_ptr);
31605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31607         this_ptr_conv.is_owned = false;
31608         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31609         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv), 32);
31610         return ret_arr;
31611 }
31612
31613 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_alias"))) TS_UnsignedNodeAnnouncement_set_alias(uint64_t this_ptr, int8_tArray val) {
31614         LDKUnsignedNodeAnnouncement 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         LDKThirtyTwoBytes val_ref;
31620         CHECK(val->arr_len == 32);
31621         memcpy(val_ref.data, val->elems, 32); FREE(val);
31622         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
31623 }
31624
31625 uint64_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_addresses"))) TS_UnsignedNodeAnnouncement_get_addresses(uint64_t this_ptr) {
31626         LDKUnsignedNodeAnnouncement this_ptr_conv;
31627         this_ptr_conv.inner = untag_ptr(this_ptr);
31628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31630         this_ptr_conv.is_owned = false;
31631         LDKCVec_NetAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
31632         uint64_tArray ret_arr = NULL;
31633         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
31634         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
31635         for (size_t m = 0; m < ret_var.datalen; m++) {
31636                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
31637                 *ret_conv_12_copy = ret_var.data[m];
31638                 uint64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
31639                 ret_arr_ptr[m] = ret_conv_12_ref;
31640         }
31641         
31642         FREE(ret_var.data);
31643         return ret_arr;
31644 }
31645
31646 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_addresses"))) TS_UnsignedNodeAnnouncement_set_addresses(uint64_t this_ptr, uint64_tArray val) {
31647         LDKUnsignedNodeAnnouncement this_ptr_conv;
31648         this_ptr_conv.inner = untag_ptr(this_ptr);
31649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31651         this_ptr_conv.is_owned = false;
31652         LDKCVec_NetAddressZ val_constr;
31653         val_constr.datalen = val->arr_len;
31654         if (val_constr.datalen > 0)
31655                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
31656         else
31657                 val_constr.data = NULL;
31658         uint64_t* val_vals = val->elems;
31659         for (size_t m = 0; m < val_constr.datalen; m++) {
31660                 uint64_t val_conv_12 = val_vals[m];
31661                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
31662                 CHECK_ACCESS(val_conv_12_ptr);
31663                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
31664                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
31665                 val_constr.data[m] = val_conv_12_conv;
31666         }
31667         FREE(val);
31668         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
31669 }
31670
31671 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
31672         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
31673         uint64_t ret_ref = 0;
31674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31676         return ret_ref;
31677 }
31678 int64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone_ptr"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint64_t arg) {
31679         LDKUnsignedNodeAnnouncement arg_conv;
31680         arg_conv.inner = untag_ptr(arg);
31681         arg_conv.is_owned = ptr_is_owned(arg);
31682         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31683         arg_conv.is_owned = false;
31684         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
31685         return ret_conv;
31686 }
31687
31688 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone"))) TS_UnsignedNodeAnnouncement_clone(uint64_t orig) {
31689         LDKUnsignedNodeAnnouncement orig_conv;
31690         orig_conv.inner = untag_ptr(orig);
31691         orig_conv.is_owned = ptr_is_owned(orig);
31692         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31693         orig_conv.is_owned = false;
31694         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
31695         uint64_t ret_ref = 0;
31696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31698         return ret_ref;
31699 }
31700
31701 void  __attribute__((export_name("TS_NodeAnnouncement_free"))) TS_NodeAnnouncement_free(uint64_t this_obj) {
31702         LDKNodeAnnouncement this_obj_conv;
31703         this_obj_conv.inner = untag_ptr(this_obj);
31704         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31706         NodeAnnouncement_free(this_obj_conv);
31707 }
31708
31709 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_get_signature"))) TS_NodeAnnouncement_get_signature(uint64_t this_ptr) {
31710         LDKNodeAnnouncement this_ptr_conv;
31711         this_ptr_conv.inner = untag_ptr(this_ptr);
31712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31714         this_ptr_conv.is_owned = false;
31715         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
31716         memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
31717         return ret_arr;
31718 }
31719
31720 void  __attribute__((export_name("TS_NodeAnnouncement_set_signature"))) TS_NodeAnnouncement_set_signature(uint64_t this_ptr, int8_tArray val) {
31721         LDKNodeAnnouncement this_ptr_conv;
31722         this_ptr_conv.inner = untag_ptr(this_ptr);
31723         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31725         this_ptr_conv.is_owned = false;
31726         LDKSignature val_ref;
31727         CHECK(val->arr_len == 64);
31728         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
31729         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
31730 }
31731
31732 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_get_contents"))) TS_NodeAnnouncement_get_contents(uint64_t this_ptr) {
31733         LDKNodeAnnouncement this_ptr_conv;
31734         this_ptr_conv.inner = untag_ptr(this_ptr);
31735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31737         this_ptr_conv.is_owned = false;
31738         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
31739         uint64_t ret_ref = 0;
31740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31742         return ret_ref;
31743 }
31744
31745 void  __attribute__((export_name("TS_NodeAnnouncement_set_contents"))) TS_NodeAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
31746         LDKNodeAnnouncement this_ptr_conv;
31747         this_ptr_conv.inner = untag_ptr(this_ptr);
31748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31750         this_ptr_conv.is_owned = false;
31751         LDKUnsignedNodeAnnouncement val_conv;
31752         val_conv.inner = untag_ptr(val);
31753         val_conv.is_owned = ptr_is_owned(val);
31754         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31755         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
31756         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
31757 }
31758
31759 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_new"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint64_t contents_arg) {
31760         LDKSignature signature_arg_ref;
31761         CHECK(signature_arg->arr_len == 64);
31762         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
31763         LDKUnsignedNodeAnnouncement contents_arg_conv;
31764         contents_arg_conv.inner = untag_ptr(contents_arg);
31765         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
31766         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
31767         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
31768         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
31769         uint64_t ret_ref = 0;
31770         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31771         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31772         return ret_ref;
31773 }
31774
31775 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
31776         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
31777         uint64_t ret_ref = 0;
31778         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31779         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31780         return ret_ref;
31781 }
31782 int64_t  __attribute__((export_name("TS_NodeAnnouncement_clone_ptr"))) TS_NodeAnnouncement_clone_ptr(uint64_t arg) {
31783         LDKNodeAnnouncement arg_conv;
31784         arg_conv.inner = untag_ptr(arg);
31785         arg_conv.is_owned = ptr_is_owned(arg);
31786         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31787         arg_conv.is_owned = false;
31788         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
31789         return ret_conv;
31790 }
31791
31792 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_clone"))) TS_NodeAnnouncement_clone(uint64_t orig) {
31793         LDKNodeAnnouncement orig_conv;
31794         orig_conv.inner = untag_ptr(orig);
31795         orig_conv.is_owned = ptr_is_owned(orig);
31796         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31797         orig_conv.is_owned = false;
31798         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
31799         uint64_t ret_ref = 0;
31800         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31801         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31802         return ret_ref;
31803 }
31804
31805 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_free"))) TS_UnsignedChannelAnnouncement_free(uint64_t this_obj) {
31806         LDKUnsignedChannelAnnouncement this_obj_conv;
31807         this_obj_conv.inner = untag_ptr(this_obj);
31808         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31810         UnsignedChannelAnnouncement_free(this_obj_conv);
31811 }
31812
31813 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_features"))) TS_UnsignedChannelAnnouncement_get_features(uint64_t this_ptr) {
31814         LDKUnsignedChannelAnnouncement this_ptr_conv;
31815         this_ptr_conv.inner = untag_ptr(this_ptr);
31816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31818         this_ptr_conv.is_owned = false;
31819         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
31820         uint64_t ret_ref = 0;
31821         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31822         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31823         return ret_ref;
31824 }
31825
31826 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_features"))) TS_UnsignedChannelAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
31827         LDKUnsignedChannelAnnouncement this_ptr_conv;
31828         this_ptr_conv.inner = untag_ptr(this_ptr);
31829         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31831         this_ptr_conv.is_owned = false;
31832         LDKChannelFeatures val_conv;
31833         val_conv.inner = untag_ptr(val);
31834         val_conv.is_owned = ptr_is_owned(val);
31835         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31836         val_conv = ChannelFeatures_clone(&val_conv);
31837         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
31838 }
31839
31840 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_chain_hash"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint64_t this_ptr) {
31841         LDKUnsignedChannelAnnouncement this_ptr_conv;
31842         this_ptr_conv.inner = untag_ptr(this_ptr);
31843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31845         this_ptr_conv.is_owned = false;
31846         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31847         memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
31848         return ret_arr;
31849 }
31850
31851 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_chain_hash"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
31852         LDKUnsignedChannelAnnouncement this_ptr_conv;
31853         this_ptr_conv.inner = untag_ptr(this_ptr);
31854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31856         this_ptr_conv.is_owned = false;
31857         LDKThirtyTwoBytes val_ref;
31858         CHECK(val->arr_len == 32);
31859         memcpy(val_ref.data, val->elems, 32); FREE(val);
31860         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
31861 }
31862
31863 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_short_channel_id"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint64_t this_ptr) {
31864         LDKUnsignedChannelAnnouncement this_ptr_conv;
31865         this_ptr_conv.inner = untag_ptr(this_ptr);
31866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31868         this_ptr_conv.is_owned = false;
31869         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
31870         return ret_conv;
31871 }
31872
31873 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_channel_id"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint64_t this_ptr, int64_t val) {
31874         LDKUnsignedChannelAnnouncement this_ptr_conv;
31875         this_ptr_conv.inner = untag_ptr(this_ptr);
31876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31878         this_ptr_conv.is_owned = false;
31879         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
31880 }
31881
31882 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint64_t this_ptr) {
31883         LDKUnsignedChannelAnnouncement this_ptr_conv;
31884         this_ptr_conv.inner = untag_ptr(this_ptr);
31885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31887         this_ptr_conv.is_owned = false;
31888         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31889         memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33);
31890         return ret_arr;
31891 }
31892
31893 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint64_t this_ptr, int8_tArray val) {
31894         LDKUnsignedChannelAnnouncement this_ptr_conv;
31895         this_ptr_conv.inner = untag_ptr(this_ptr);
31896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31898         this_ptr_conv.is_owned = false;
31899         LDKPublicKey val_ref;
31900         CHECK(val->arr_len == 33);
31901         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31902         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
31903 }
31904
31905 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint64_t this_ptr) {
31906         LDKUnsignedChannelAnnouncement this_ptr_conv;
31907         this_ptr_conv.inner = untag_ptr(this_ptr);
31908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31910         this_ptr_conv.is_owned = false;
31911         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31912         memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33);
31913         return ret_arr;
31914 }
31915
31916 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint64_t this_ptr, int8_tArray val) {
31917         LDKUnsignedChannelAnnouncement this_ptr_conv;
31918         this_ptr_conv.inner = untag_ptr(this_ptr);
31919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31921         this_ptr_conv.is_owned = false;
31922         LDKPublicKey val_ref;
31923         CHECK(val->arr_len == 33);
31924         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31925         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
31926 }
31927
31928 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint64_t this_ptr) {
31929         LDKUnsignedChannelAnnouncement this_ptr_conv;
31930         this_ptr_conv.inner = untag_ptr(this_ptr);
31931         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31933         this_ptr_conv.is_owned = false;
31934         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31935         memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33);
31936         return ret_arr;
31937 }
31938
31939 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint64_t this_ptr, int8_tArray val) {
31940         LDKUnsignedChannelAnnouncement this_ptr_conv;
31941         this_ptr_conv.inner = untag_ptr(this_ptr);
31942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31944         this_ptr_conv.is_owned = false;
31945         LDKPublicKey val_ref;
31946         CHECK(val->arr_len == 33);
31947         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31948         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
31949 }
31950
31951 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint64_t this_ptr) {
31952         LDKUnsignedChannelAnnouncement this_ptr_conv;
31953         this_ptr_conv.inner = untag_ptr(this_ptr);
31954         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31956         this_ptr_conv.is_owned = false;
31957         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31958         memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33);
31959         return ret_arr;
31960 }
31961
31962 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint64_t this_ptr, int8_tArray val) {
31963         LDKUnsignedChannelAnnouncement this_ptr_conv;
31964         this_ptr_conv.inner = untag_ptr(this_ptr);
31965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31967         this_ptr_conv.is_owned = false;
31968         LDKPublicKey val_ref;
31969         CHECK(val->arr_len == 33);
31970         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31971         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
31972 }
31973
31974 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
31975         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
31976         uint64_t ret_ref = 0;
31977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31979         return ret_ref;
31980 }
31981 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone_ptr"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint64_t arg) {
31982         LDKUnsignedChannelAnnouncement arg_conv;
31983         arg_conv.inner = untag_ptr(arg);
31984         arg_conv.is_owned = ptr_is_owned(arg);
31985         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31986         arg_conv.is_owned = false;
31987         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
31988         return ret_conv;
31989 }
31990
31991 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone"))) TS_UnsignedChannelAnnouncement_clone(uint64_t orig) {
31992         LDKUnsignedChannelAnnouncement orig_conv;
31993         orig_conv.inner = untag_ptr(orig);
31994         orig_conv.is_owned = ptr_is_owned(orig);
31995         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31996         orig_conv.is_owned = false;
31997         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
31998         uint64_t ret_ref = 0;
31999         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32000         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32001         return ret_ref;
32002 }
32003
32004 void  __attribute__((export_name("TS_ChannelAnnouncement_free"))) TS_ChannelAnnouncement_free(uint64_t this_obj) {
32005         LDKChannelAnnouncement this_obj_conv;
32006         this_obj_conv.inner = untag_ptr(this_obj);
32007         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32009         ChannelAnnouncement_free(this_obj_conv);
32010 }
32011
32012 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_1"))) TS_ChannelAnnouncement_get_node_signature_1(uint64_t this_ptr) {
32013         LDKChannelAnnouncement this_ptr_conv;
32014         this_ptr_conv.inner = untag_ptr(this_ptr);
32015         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32017         this_ptr_conv.is_owned = false;
32018         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32019         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
32020         return ret_arr;
32021 }
32022
32023 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_1"))) TS_ChannelAnnouncement_set_node_signature_1(uint64_t this_ptr, int8_tArray val) {
32024         LDKChannelAnnouncement this_ptr_conv;
32025         this_ptr_conv.inner = untag_ptr(this_ptr);
32026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32028         this_ptr_conv.is_owned = false;
32029         LDKSignature val_ref;
32030         CHECK(val->arr_len == 64);
32031         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32032         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
32033 }
32034
32035 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_2"))) TS_ChannelAnnouncement_get_node_signature_2(uint64_t this_ptr) {
32036         LDKChannelAnnouncement this_ptr_conv;
32037         this_ptr_conv.inner = untag_ptr(this_ptr);
32038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32040         this_ptr_conv.is_owned = false;
32041         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32042         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
32043         return ret_arr;
32044 }
32045
32046 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_2"))) TS_ChannelAnnouncement_set_node_signature_2(uint64_t this_ptr, int8_tArray val) {
32047         LDKChannelAnnouncement this_ptr_conv;
32048         this_ptr_conv.inner = untag_ptr(this_ptr);
32049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32051         this_ptr_conv.is_owned = false;
32052         LDKSignature val_ref;
32053         CHECK(val->arr_len == 64);
32054         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32055         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
32056 }
32057
32058 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_1"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint64_t this_ptr) {
32059         LDKChannelAnnouncement this_ptr_conv;
32060         this_ptr_conv.inner = untag_ptr(this_ptr);
32061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32063         this_ptr_conv.is_owned = false;
32064         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32065         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
32066         return ret_arr;
32067 }
32068
32069 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_1"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint64_t this_ptr, int8_tArray val) {
32070         LDKChannelAnnouncement this_ptr_conv;
32071         this_ptr_conv.inner = untag_ptr(this_ptr);
32072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32074         this_ptr_conv.is_owned = false;
32075         LDKSignature val_ref;
32076         CHECK(val->arr_len == 64);
32077         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32078         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
32079 }
32080
32081 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_2"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint64_t this_ptr) {
32082         LDKChannelAnnouncement this_ptr_conv;
32083         this_ptr_conv.inner = untag_ptr(this_ptr);
32084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32086         this_ptr_conv.is_owned = false;
32087         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32088         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
32089         return ret_arr;
32090 }
32091
32092 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_2"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint64_t this_ptr, int8_tArray val) {
32093         LDKChannelAnnouncement this_ptr_conv;
32094         this_ptr_conv.inner = untag_ptr(this_ptr);
32095         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32097         this_ptr_conv.is_owned = false;
32098         LDKSignature val_ref;
32099         CHECK(val->arr_len == 64);
32100         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32101         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
32102 }
32103
32104 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_get_contents"))) TS_ChannelAnnouncement_get_contents(uint64_t this_ptr) {
32105         LDKChannelAnnouncement this_ptr_conv;
32106         this_ptr_conv.inner = untag_ptr(this_ptr);
32107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32109         this_ptr_conv.is_owned = false;
32110         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
32111         uint64_t ret_ref = 0;
32112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32114         return ret_ref;
32115 }
32116
32117 void  __attribute__((export_name("TS_ChannelAnnouncement_set_contents"))) TS_ChannelAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
32118         LDKChannelAnnouncement this_ptr_conv;
32119         this_ptr_conv.inner = untag_ptr(this_ptr);
32120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32122         this_ptr_conv.is_owned = false;
32123         LDKUnsignedChannelAnnouncement val_conv;
32124         val_conv.inner = untag_ptr(val);
32125         val_conv.is_owned = ptr_is_owned(val);
32126         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32127         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
32128         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
32129 }
32130
32131 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) {
32132         LDKSignature node_signature_1_arg_ref;
32133         CHECK(node_signature_1_arg->arr_len == 64);
32134         memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
32135         LDKSignature node_signature_2_arg_ref;
32136         CHECK(node_signature_2_arg->arr_len == 64);
32137         memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
32138         LDKSignature bitcoin_signature_1_arg_ref;
32139         CHECK(bitcoin_signature_1_arg->arr_len == 64);
32140         memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
32141         LDKSignature bitcoin_signature_2_arg_ref;
32142         CHECK(bitcoin_signature_2_arg->arr_len == 64);
32143         memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
32144         LDKUnsignedChannelAnnouncement contents_arg_conv;
32145         contents_arg_conv.inner = untag_ptr(contents_arg);
32146         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
32147         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
32148         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
32149         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);
32150         uint64_t ret_ref = 0;
32151         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32152         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32153         return ret_ref;
32154 }
32155
32156 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
32157         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
32158         uint64_t ret_ref = 0;
32159         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32160         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32161         return ret_ref;
32162 }
32163 int64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone_ptr"))) TS_ChannelAnnouncement_clone_ptr(uint64_t arg) {
32164         LDKChannelAnnouncement arg_conv;
32165         arg_conv.inner = untag_ptr(arg);
32166         arg_conv.is_owned = ptr_is_owned(arg);
32167         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32168         arg_conv.is_owned = false;
32169         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
32170         return ret_conv;
32171 }
32172
32173 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone"))) TS_ChannelAnnouncement_clone(uint64_t orig) {
32174         LDKChannelAnnouncement orig_conv;
32175         orig_conv.inner = untag_ptr(orig);
32176         orig_conv.is_owned = ptr_is_owned(orig);
32177         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32178         orig_conv.is_owned = false;
32179         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
32180         uint64_t ret_ref = 0;
32181         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32182         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32183         return ret_ref;
32184 }
32185
32186 void  __attribute__((export_name("TS_UnsignedChannelUpdate_free"))) TS_UnsignedChannelUpdate_free(uint64_t this_obj) {
32187         LDKUnsignedChannelUpdate 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         UnsignedChannelUpdate_free(this_obj_conv);
32192 }
32193
32194 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_chain_hash"))) TS_UnsignedChannelUpdate_get_chain_hash(uint64_t this_ptr) {
32195         LDKUnsignedChannelUpdate 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, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
32202         return ret_arr;
32203 }
32204
32205 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_chain_hash"))) TS_UnsignedChannelUpdate_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
32206         LDKUnsignedChannelUpdate 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         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
32215 }
32216
32217 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_short_channel_id"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint64_t this_ptr) {
32218         LDKUnsignedChannelUpdate 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 = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
32224         return ret_conv;
32225 }
32226
32227 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_short_channel_id"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint64_t this_ptr, int64_t val) {
32228         LDKUnsignedChannelUpdate 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         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
32234 }
32235
32236 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_timestamp"))) TS_UnsignedChannelUpdate_get_timestamp(uint64_t this_ptr) {
32237         LDKUnsignedChannelUpdate 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         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
32243         return ret_conv;
32244 }
32245
32246 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_timestamp"))) TS_UnsignedChannelUpdate_set_timestamp(uint64_t this_ptr, int32_t val) {
32247         LDKUnsignedChannelUpdate 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         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
32253 }
32254
32255 int8_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_flags"))) TS_UnsignedChannelUpdate_get_flags(uint64_t this_ptr) {
32256         LDKUnsignedChannelUpdate this_ptr_conv;
32257         this_ptr_conv.inner = untag_ptr(this_ptr);
32258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32260         this_ptr_conv.is_owned = false;
32261         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
32262         return ret_conv;
32263 }
32264
32265 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_flags"))) TS_UnsignedChannelUpdate_set_flags(uint64_t this_ptr, int8_t val) {
32266         LDKUnsignedChannelUpdate this_ptr_conv;
32267         this_ptr_conv.inner = untag_ptr(this_ptr);
32268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32270         this_ptr_conv.is_owned = false;
32271         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
32272 }
32273
32274 int16_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
32275         LDKUnsignedChannelUpdate this_ptr_conv;
32276         this_ptr_conv.inner = untag_ptr(this_ptr);
32277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32279         this_ptr_conv.is_owned = false;
32280         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
32281         return ret_conv;
32282 }
32283
32284 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
32285         LDKUnsignedChannelUpdate this_ptr_conv;
32286         this_ptr_conv.inner = untag_ptr(this_ptr);
32287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32289         this_ptr_conv.is_owned = false;
32290         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
32291 }
32292
32293 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint64_t this_ptr) {
32294         LDKUnsignedChannelUpdate this_ptr_conv;
32295         this_ptr_conv.inner = untag_ptr(this_ptr);
32296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32298         this_ptr_conv.is_owned = false;
32299         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
32300         return ret_conv;
32301 }
32302
32303 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
32304         LDKUnsignedChannelUpdate this_ptr_conv;
32305         this_ptr_conv.inner = untag_ptr(this_ptr);
32306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32308         this_ptr_conv.is_owned = false;
32309         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
32310 }
32311
32312 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_get_htlc_maximum_msat(uint64_t this_ptr) {
32313         LDKUnsignedChannelUpdate this_ptr_conv;
32314         this_ptr_conv.inner = untag_ptr(this_ptr);
32315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32317         this_ptr_conv.is_owned = false;
32318         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
32319         return ret_conv;
32320 }
32321
32322 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
32323         LDKUnsignedChannelUpdate this_ptr_conv;
32324         this_ptr_conv.inner = untag_ptr(this_ptr);
32325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32327         this_ptr_conv.is_owned = false;
32328         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
32329 }
32330
32331 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_base_msat"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint64_t this_ptr) {
32332         LDKUnsignedChannelUpdate 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         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
32338         return ret_conv;
32339 }
32340
32341 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_base_msat"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
32342         LDKUnsignedChannelUpdate this_ptr_conv;
32343         this_ptr_conv.inner = untag_ptr(this_ptr);
32344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32346         this_ptr_conv.is_owned = false;
32347         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
32348 }
32349
32350 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint64_t this_ptr) {
32351         LDKUnsignedChannelUpdate this_ptr_conv;
32352         this_ptr_conv.inner = untag_ptr(this_ptr);
32353         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32355         this_ptr_conv.is_owned = false;
32356         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
32357         return ret_conv;
32358 }
32359
32360 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
32361         LDKUnsignedChannelUpdate this_ptr_conv;
32362         this_ptr_conv.inner = untag_ptr(this_ptr);
32363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32365         this_ptr_conv.is_owned = false;
32366         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
32367 }
32368
32369 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_excess_data"))) TS_UnsignedChannelUpdate_get_excess_data(uint64_t this_ptr) {
32370         LDKUnsignedChannelUpdate this_ptr_conv;
32371         this_ptr_conv.inner = untag_ptr(this_ptr);
32372         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32374         this_ptr_conv.is_owned = false;
32375         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
32376         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
32377         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
32378         CVec_u8Z_free(ret_var);
32379         return ret_arr;
32380 }
32381
32382 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_excess_data"))) TS_UnsignedChannelUpdate_set_excess_data(uint64_t this_ptr, int8_tArray val) {
32383         LDKUnsignedChannelUpdate this_ptr_conv;
32384         this_ptr_conv.inner = untag_ptr(this_ptr);
32385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32387         this_ptr_conv.is_owned = false;
32388         LDKCVec_u8Z val_ref;
32389         val_ref.datalen = val->arr_len;
32390         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
32391         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
32392         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
32393 }
32394
32395 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) {
32396         LDKThirtyTwoBytes chain_hash_arg_ref;
32397         CHECK(chain_hash_arg->arr_len == 32);
32398         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
32399         LDKCVec_u8Z excess_data_arg_ref;
32400         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
32401         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
32402         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
32403         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);
32404         uint64_t ret_ref = 0;
32405         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32406         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32407         return ret_ref;
32408 }
32409
32410 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
32411         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
32412         uint64_t ret_ref = 0;
32413         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32414         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32415         return ret_ref;
32416 }
32417 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone_ptr"))) TS_UnsignedChannelUpdate_clone_ptr(uint64_t arg) {
32418         LDKUnsignedChannelUpdate arg_conv;
32419         arg_conv.inner = untag_ptr(arg);
32420         arg_conv.is_owned = ptr_is_owned(arg);
32421         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32422         arg_conv.is_owned = false;
32423         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
32424         return ret_conv;
32425 }
32426
32427 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone"))) TS_UnsignedChannelUpdate_clone(uint64_t orig) {
32428         LDKUnsignedChannelUpdate orig_conv;
32429         orig_conv.inner = untag_ptr(orig);
32430         orig_conv.is_owned = ptr_is_owned(orig);
32431         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32432         orig_conv.is_owned = false;
32433         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
32434         uint64_t ret_ref = 0;
32435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32437         return ret_ref;
32438 }
32439
32440 void  __attribute__((export_name("TS_ChannelUpdate_free"))) TS_ChannelUpdate_free(uint64_t this_obj) {
32441         LDKChannelUpdate this_obj_conv;
32442         this_obj_conv.inner = untag_ptr(this_obj);
32443         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32445         ChannelUpdate_free(this_obj_conv);
32446 }
32447
32448 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_get_signature"))) TS_ChannelUpdate_get_signature(uint64_t this_ptr) {
32449         LDKChannelUpdate this_ptr_conv;
32450         this_ptr_conv.inner = untag_ptr(this_ptr);
32451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32453         this_ptr_conv.is_owned = false;
32454         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
32455         memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
32456         return ret_arr;
32457 }
32458
32459 void  __attribute__((export_name("TS_ChannelUpdate_set_signature"))) TS_ChannelUpdate_set_signature(uint64_t this_ptr, int8_tArray val) {
32460         LDKChannelUpdate this_ptr_conv;
32461         this_ptr_conv.inner = untag_ptr(this_ptr);
32462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32464         this_ptr_conv.is_owned = false;
32465         LDKSignature val_ref;
32466         CHECK(val->arr_len == 64);
32467         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
32468         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
32469 }
32470
32471 uint64_t  __attribute__((export_name("TS_ChannelUpdate_get_contents"))) TS_ChannelUpdate_get_contents(uint64_t this_ptr) {
32472         LDKChannelUpdate this_ptr_conv;
32473         this_ptr_conv.inner = untag_ptr(this_ptr);
32474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32476         this_ptr_conv.is_owned = false;
32477         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
32478         uint64_t ret_ref = 0;
32479         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32480         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32481         return ret_ref;
32482 }
32483
32484 void  __attribute__((export_name("TS_ChannelUpdate_set_contents"))) TS_ChannelUpdate_set_contents(uint64_t this_ptr, uint64_t val) {
32485         LDKChannelUpdate this_ptr_conv;
32486         this_ptr_conv.inner = untag_ptr(this_ptr);
32487         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32489         this_ptr_conv.is_owned = false;
32490         LDKUnsignedChannelUpdate val_conv;
32491         val_conv.inner = untag_ptr(val);
32492         val_conv.is_owned = ptr_is_owned(val);
32493         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32494         val_conv = UnsignedChannelUpdate_clone(&val_conv);
32495         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
32496 }
32497
32498 uint64_t  __attribute__((export_name("TS_ChannelUpdate_new"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint64_t contents_arg) {
32499         LDKSignature signature_arg_ref;
32500         CHECK(signature_arg->arr_len == 64);
32501         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
32502         LDKUnsignedChannelUpdate contents_arg_conv;
32503         contents_arg_conv.inner = untag_ptr(contents_arg);
32504         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
32505         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
32506         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
32507         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
32508         uint64_t ret_ref = 0;
32509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32511         return ret_ref;
32512 }
32513
32514 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
32515         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
32516         uint64_t ret_ref = 0;
32517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32519         return ret_ref;
32520 }
32521 int64_t  __attribute__((export_name("TS_ChannelUpdate_clone_ptr"))) TS_ChannelUpdate_clone_ptr(uint64_t arg) {
32522         LDKChannelUpdate arg_conv;
32523         arg_conv.inner = untag_ptr(arg);
32524         arg_conv.is_owned = ptr_is_owned(arg);
32525         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32526         arg_conv.is_owned = false;
32527         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
32528         return ret_conv;
32529 }
32530
32531 uint64_t  __attribute__((export_name("TS_ChannelUpdate_clone"))) TS_ChannelUpdate_clone(uint64_t orig) {
32532         LDKChannelUpdate orig_conv;
32533         orig_conv.inner = untag_ptr(orig);
32534         orig_conv.is_owned = ptr_is_owned(orig);
32535         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32536         orig_conv.is_owned = false;
32537         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
32538         uint64_t ret_ref = 0;
32539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32541         return ret_ref;
32542 }
32543
32544 void  __attribute__((export_name("TS_QueryChannelRange_free"))) TS_QueryChannelRange_free(uint64_t this_obj) {
32545         LDKQueryChannelRange this_obj_conv;
32546         this_obj_conv.inner = untag_ptr(this_obj);
32547         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32549         QueryChannelRange_free(this_obj_conv);
32550 }
32551
32552 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_get_chain_hash"))) TS_QueryChannelRange_get_chain_hash(uint64_t this_ptr) {
32553         LDKQueryChannelRange this_ptr_conv;
32554         this_ptr_conv.inner = untag_ptr(this_ptr);
32555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32557         this_ptr_conv.is_owned = false;
32558         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32559         memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
32560         return ret_arr;
32561 }
32562
32563 void  __attribute__((export_name("TS_QueryChannelRange_set_chain_hash"))) TS_QueryChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
32564         LDKQueryChannelRange this_ptr_conv;
32565         this_ptr_conv.inner = untag_ptr(this_ptr);
32566         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32568         this_ptr_conv.is_owned = false;
32569         LDKThirtyTwoBytes val_ref;
32570         CHECK(val->arr_len == 32);
32571         memcpy(val_ref.data, val->elems, 32); FREE(val);
32572         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
32573 }
32574
32575 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_first_blocknum"))) TS_QueryChannelRange_get_first_blocknum(uint64_t this_ptr) {
32576         LDKQueryChannelRange this_ptr_conv;
32577         this_ptr_conv.inner = untag_ptr(this_ptr);
32578         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32580         this_ptr_conv.is_owned = false;
32581         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
32582         return ret_conv;
32583 }
32584
32585 void  __attribute__((export_name("TS_QueryChannelRange_set_first_blocknum"))) TS_QueryChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
32586         LDKQueryChannelRange this_ptr_conv;
32587         this_ptr_conv.inner = untag_ptr(this_ptr);
32588         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32590         this_ptr_conv.is_owned = false;
32591         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
32592 }
32593
32594 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_number_of_blocks"))) TS_QueryChannelRange_get_number_of_blocks(uint64_t this_ptr) {
32595         LDKQueryChannelRange this_ptr_conv;
32596         this_ptr_conv.inner = untag_ptr(this_ptr);
32597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32599         this_ptr_conv.is_owned = false;
32600         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
32601         return ret_conv;
32602 }
32603
32604 void  __attribute__((export_name("TS_QueryChannelRange_set_number_of_blocks"))) TS_QueryChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
32605         LDKQueryChannelRange this_ptr_conv;
32606         this_ptr_conv.inner = untag_ptr(this_ptr);
32607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32609         this_ptr_conv.is_owned = false;
32610         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
32611 }
32612
32613 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) {
32614         LDKThirtyTwoBytes chain_hash_arg_ref;
32615         CHECK(chain_hash_arg->arr_len == 32);
32616         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
32617         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
32618         uint64_t ret_ref = 0;
32619         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32620         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32621         return ret_ref;
32622 }
32623
32624 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
32625         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
32626         uint64_t ret_ref = 0;
32627         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32628         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32629         return ret_ref;
32630 }
32631 int64_t  __attribute__((export_name("TS_QueryChannelRange_clone_ptr"))) TS_QueryChannelRange_clone_ptr(uint64_t arg) {
32632         LDKQueryChannelRange arg_conv;
32633         arg_conv.inner = untag_ptr(arg);
32634         arg_conv.is_owned = ptr_is_owned(arg);
32635         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32636         arg_conv.is_owned = false;
32637         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
32638         return ret_conv;
32639 }
32640
32641 uint64_t  __attribute__((export_name("TS_QueryChannelRange_clone"))) TS_QueryChannelRange_clone(uint64_t orig) {
32642         LDKQueryChannelRange orig_conv;
32643         orig_conv.inner = untag_ptr(orig);
32644         orig_conv.is_owned = ptr_is_owned(orig);
32645         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32646         orig_conv.is_owned = false;
32647         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
32648         uint64_t ret_ref = 0;
32649         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32650         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32651         return ret_ref;
32652 }
32653
32654 void  __attribute__((export_name("TS_ReplyChannelRange_free"))) TS_ReplyChannelRange_free(uint64_t this_obj) {
32655         LDKReplyChannelRange this_obj_conv;
32656         this_obj_conv.inner = untag_ptr(this_obj);
32657         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32659         ReplyChannelRange_free(this_obj_conv);
32660 }
32661
32662 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_chain_hash"))) TS_ReplyChannelRange_get_chain_hash(uint64_t this_ptr) {
32663         LDKReplyChannelRange this_ptr_conv;
32664         this_ptr_conv.inner = untag_ptr(this_ptr);
32665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32667         this_ptr_conv.is_owned = false;
32668         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32669         memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
32670         return ret_arr;
32671 }
32672
32673 void  __attribute__((export_name("TS_ReplyChannelRange_set_chain_hash"))) TS_ReplyChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
32674         LDKReplyChannelRange this_ptr_conv;
32675         this_ptr_conv.inner = untag_ptr(this_ptr);
32676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32678         this_ptr_conv.is_owned = false;
32679         LDKThirtyTwoBytes val_ref;
32680         CHECK(val->arr_len == 32);
32681         memcpy(val_ref.data, val->elems, 32); FREE(val);
32682         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
32683 }
32684
32685 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_first_blocknum"))) TS_ReplyChannelRange_get_first_blocknum(uint64_t this_ptr) {
32686         LDKReplyChannelRange this_ptr_conv;
32687         this_ptr_conv.inner = untag_ptr(this_ptr);
32688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32690         this_ptr_conv.is_owned = false;
32691         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
32692         return ret_conv;
32693 }
32694
32695 void  __attribute__((export_name("TS_ReplyChannelRange_set_first_blocknum"))) TS_ReplyChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
32696         LDKReplyChannelRange this_ptr_conv;
32697         this_ptr_conv.inner = untag_ptr(this_ptr);
32698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32700         this_ptr_conv.is_owned = false;
32701         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
32702 }
32703
32704 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_number_of_blocks"))) TS_ReplyChannelRange_get_number_of_blocks(uint64_t this_ptr) {
32705         LDKReplyChannelRange this_ptr_conv;
32706         this_ptr_conv.inner = untag_ptr(this_ptr);
32707         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32709         this_ptr_conv.is_owned = false;
32710         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
32711         return ret_conv;
32712 }
32713
32714 void  __attribute__((export_name("TS_ReplyChannelRange_set_number_of_blocks"))) TS_ReplyChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
32715         LDKReplyChannelRange this_ptr_conv;
32716         this_ptr_conv.inner = untag_ptr(this_ptr);
32717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32719         this_ptr_conv.is_owned = false;
32720         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
32721 }
32722
32723 jboolean  __attribute__((export_name("TS_ReplyChannelRange_get_sync_complete"))) TS_ReplyChannelRange_get_sync_complete(uint64_t this_ptr) {
32724         LDKReplyChannelRange this_ptr_conv;
32725         this_ptr_conv.inner = untag_ptr(this_ptr);
32726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32728         this_ptr_conv.is_owned = false;
32729         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
32730         return ret_conv;
32731 }
32732
32733 void  __attribute__((export_name("TS_ReplyChannelRange_set_sync_complete"))) TS_ReplyChannelRange_set_sync_complete(uint64_t this_ptr, jboolean val) {
32734         LDKReplyChannelRange this_ptr_conv;
32735         this_ptr_conv.inner = untag_ptr(this_ptr);
32736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32738         this_ptr_conv.is_owned = false;
32739         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
32740 }
32741
32742 int64_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_short_channel_ids"))) TS_ReplyChannelRange_get_short_channel_ids(uint64_t this_ptr) {
32743         LDKReplyChannelRange this_ptr_conv;
32744         this_ptr_conv.inner = untag_ptr(this_ptr);
32745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32747         this_ptr_conv.is_owned = false;
32748         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
32749         int64_tArray ret_arr = NULL;
32750         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
32751         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
32752         for (size_t i = 0; i < ret_var.datalen; i++) {
32753                 int64_t ret_conv_8_conv = ret_var.data[i];
32754                 ret_arr_ptr[i] = ret_conv_8_conv;
32755         }
32756         
32757         FREE(ret_var.data);
32758         return ret_arr;
32759 }
32760
32761 void  __attribute__((export_name("TS_ReplyChannelRange_set_short_channel_ids"))) TS_ReplyChannelRange_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
32762         LDKReplyChannelRange this_ptr_conv;
32763         this_ptr_conv.inner = untag_ptr(this_ptr);
32764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32766         this_ptr_conv.is_owned = false;
32767         LDKCVec_u64Z val_constr;
32768         val_constr.datalen = val->arr_len;
32769         if (val_constr.datalen > 0)
32770                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
32771         else
32772                 val_constr.data = NULL;
32773         int64_t* val_vals = val->elems;
32774         for (size_t i = 0; i < val_constr.datalen; i++) {
32775                 int64_t val_conv_8 = val_vals[i];
32776                 val_constr.data[i] = val_conv_8;
32777         }
32778         FREE(val);
32779         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
32780 }
32781
32782 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) {
32783         LDKThirtyTwoBytes chain_hash_arg_ref;
32784         CHECK(chain_hash_arg->arr_len == 32);
32785         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
32786         LDKCVec_u64Z short_channel_ids_arg_constr;
32787         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
32788         if (short_channel_ids_arg_constr.datalen > 0)
32789                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
32790         else
32791                 short_channel_ids_arg_constr.data = NULL;
32792         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
32793         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
32794                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
32795                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
32796         }
32797         FREE(short_channel_ids_arg);
32798         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
32799         uint64_t ret_ref = 0;
32800         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32801         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32802         return ret_ref;
32803 }
32804
32805 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
32806         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
32807         uint64_t ret_ref = 0;
32808         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32809         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32810         return ret_ref;
32811 }
32812 int64_t  __attribute__((export_name("TS_ReplyChannelRange_clone_ptr"))) TS_ReplyChannelRange_clone_ptr(uint64_t arg) {
32813         LDKReplyChannelRange arg_conv;
32814         arg_conv.inner = untag_ptr(arg);
32815         arg_conv.is_owned = ptr_is_owned(arg);
32816         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32817         arg_conv.is_owned = false;
32818         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
32819         return ret_conv;
32820 }
32821
32822 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_clone"))) TS_ReplyChannelRange_clone(uint64_t orig) {
32823         LDKReplyChannelRange orig_conv;
32824         orig_conv.inner = untag_ptr(orig);
32825         orig_conv.is_owned = ptr_is_owned(orig);
32826         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32827         orig_conv.is_owned = false;
32828         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
32829         uint64_t ret_ref = 0;
32830         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32831         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32832         return ret_ref;
32833 }
32834
32835 void  __attribute__((export_name("TS_QueryShortChannelIds_free"))) TS_QueryShortChannelIds_free(uint64_t this_obj) {
32836         LDKQueryShortChannelIds this_obj_conv;
32837         this_obj_conv.inner = untag_ptr(this_obj);
32838         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32840         QueryShortChannelIds_free(this_obj_conv);
32841 }
32842
32843 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_chain_hash"))) TS_QueryShortChannelIds_get_chain_hash(uint64_t this_ptr) {
32844         LDKQueryShortChannelIds this_ptr_conv;
32845         this_ptr_conv.inner = untag_ptr(this_ptr);
32846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32848         this_ptr_conv.is_owned = false;
32849         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32850         memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
32851         return ret_arr;
32852 }
32853
32854 void  __attribute__((export_name("TS_QueryShortChannelIds_set_chain_hash"))) TS_QueryShortChannelIds_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
32855         LDKQueryShortChannelIds this_ptr_conv;
32856         this_ptr_conv.inner = untag_ptr(this_ptr);
32857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32859         this_ptr_conv.is_owned = false;
32860         LDKThirtyTwoBytes val_ref;
32861         CHECK(val->arr_len == 32);
32862         memcpy(val_ref.data, val->elems, 32); FREE(val);
32863         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
32864 }
32865
32866 int64_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_short_channel_ids"))) TS_QueryShortChannelIds_get_short_channel_ids(uint64_t this_ptr) {
32867         LDKQueryShortChannelIds this_ptr_conv;
32868         this_ptr_conv.inner = untag_ptr(this_ptr);
32869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32871         this_ptr_conv.is_owned = false;
32872         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
32873         int64_tArray ret_arr = NULL;
32874         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
32875         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
32876         for (size_t i = 0; i < ret_var.datalen; i++) {
32877                 int64_t ret_conv_8_conv = ret_var.data[i];
32878                 ret_arr_ptr[i] = ret_conv_8_conv;
32879         }
32880         
32881         FREE(ret_var.data);
32882         return ret_arr;
32883 }
32884
32885 void  __attribute__((export_name("TS_QueryShortChannelIds_set_short_channel_ids"))) TS_QueryShortChannelIds_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
32886         LDKQueryShortChannelIds this_ptr_conv;
32887         this_ptr_conv.inner = untag_ptr(this_ptr);
32888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32890         this_ptr_conv.is_owned = false;
32891         LDKCVec_u64Z val_constr;
32892         val_constr.datalen = val->arr_len;
32893         if (val_constr.datalen > 0)
32894                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
32895         else
32896                 val_constr.data = NULL;
32897         int64_t* val_vals = val->elems;
32898         for (size_t i = 0; i < val_constr.datalen; i++) {
32899                 int64_t val_conv_8 = val_vals[i];
32900                 val_constr.data[i] = val_conv_8;
32901         }
32902         FREE(val);
32903         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
32904 }
32905
32906 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_new"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
32907         LDKThirtyTwoBytes chain_hash_arg_ref;
32908         CHECK(chain_hash_arg->arr_len == 32);
32909         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
32910         LDKCVec_u64Z short_channel_ids_arg_constr;
32911         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
32912         if (short_channel_ids_arg_constr.datalen > 0)
32913                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
32914         else
32915                 short_channel_ids_arg_constr.data = NULL;
32916         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
32917         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
32918                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
32919                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
32920         }
32921         FREE(short_channel_ids_arg);
32922         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
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 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
32930         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
32931         uint64_t ret_ref = 0;
32932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32934         return ret_ref;
32935 }
32936 int64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone_ptr"))) TS_QueryShortChannelIds_clone_ptr(uint64_t arg) {
32937         LDKQueryShortChannelIds arg_conv;
32938         arg_conv.inner = untag_ptr(arg);
32939         arg_conv.is_owned = ptr_is_owned(arg);
32940         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32941         arg_conv.is_owned = false;
32942         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
32943         return ret_conv;
32944 }
32945
32946 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone"))) TS_QueryShortChannelIds_clone(uint64_t orig) {
32947         LDKQueryShortChannelIds orig_conv;
32948         orig_conv.inner = untag_ptr(orig);
32949         orig_conv.is_owned = ptr_is_owned(orig);
32950         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32951         orig_conv.is_owned = false;
32952         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
32953         uint64_t ret_ref = 0;
32954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32955         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32956         return ret_ref;
32957 }
32958
32959 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_free"))) TS_ReplyShortChannelIdsEnd_free(uint64_t this_obj) {
32960         LDKReplyShortChannelIdsEnd this_obj_conv;
32961         this_obj_conv.inner = untag_ptr(this_obj);
32962         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32964         ReplyShortChannelIdsEnd_free(this_obj_conv);
32965 }
32966
32967 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_chain_hash"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint64_t this_ptr) {
32968         LDKReplyShortChannelIdsEnd this_ptr_conv;
32969         this_ptr_conv.inner = untag_ptr(this_ptr);
32970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32972         this_ptr_conv.is_owned = false;
32973         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
32974         memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
32975         return ret_arr;
32976 }
32977
32978 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_chain_hash"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
32979         LDKReplyShortChannelIdsEnd this_ptr_conv;
32980         this_ptr_conv.inner = untag_ptr(this_ptr);
32981         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32983         this_ptr_conv.is_owned = false;
32984         LDKThirtyTwoBytes val_ref;
32985         CHECK(val->arr_len == 32);
32986         memcpy(val_ref.data, val->elems, 32); FREE(val);
32987         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
32988 }
32989
32990 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_full_information"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint64_t this_ptr) {
32991         LDKReplyShortChannelIdsEnd this_ptr_conv;
32992         this_ptr_conv.inner = untag_ptr(this_ptr);
32993         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32995         this_ptr_conv.is_owned = false;
32996         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
32997         return ret_conv;
32998 }
32999
33000 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_full_information"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint64_t this_ptr, jboolean val) {
33001         LDKReplyShortChannelIdsEnd this_ptr_conv;
33002         this_ptr_conv.inner = untag_ptr(this_ptr);
33003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33005         this_ptr_conv.is_owned = false;
33006         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
33007 }
33008
33009 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_new"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
33010         LDKThirtyTwoBytes chain_hash_arg_ref;
33011         CHECK(chain_hash_arg->arr_len == 32);
33012         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
33013         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
33014         uint64_t ret_ref = 0;
33015         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33016         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33017         return ret_ref;
33018 }
33019
33020 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
33021         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
33022         uint64_t ret_ref = 0;
33023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33024         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33025         return ret_ref;
33026 }
33027 int64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone_ptr"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint64_t arg) {
33028         LDKReplyShortChannelIdsEnd arg_conv;
33029         arg_conv.inner = untag_ptr(arg);
33030         arg_conv.is_owned = ptr_is_owned(arg);
33031         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33032         arg_conv.is_owned = false;
33033         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
33034         return ret_conv;
33035 }
33036
33037 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone"))) TS_ReplyShortChannelIdsEnd_clone(uint64_t orig) {
33038         LDKReplyShortChannelIdsEnd orig_conv;
33039         orig_conv.inner = untag_ptr(orig);
33040         orig_conv.is_owned = ptr_is_owned(orig);
33041         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33042         orig_conv.is_owned = false;
33043         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
33044         uint64_t ret_ref = 0;
33045         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33046         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33047         return ret_ref;
33048 }
33049
33050 void  __attribute__((export_name("TS_GossipTimestampFilter_free"))) TS_GossipTimestampFilter_free(uint64_t this_obj) {
33051         LDKGossipTimestampFilter this_obj_conv;
33052         this_obj_conv.inner = untag_ptr(this_obj);
33053         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33055         GossipTimestampFilter_free(this_obj_conv);
33056 }
33057
33058 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_get_chain_hash"))) TS_GossipTimestampFilter_get_chain_hash(uint64_t this_ptr) {
33059         LDKGossipTimestampFilter this_ptr_conv;
33060         this_ptr_conv.inner = untag_ptr(this_ptr);
33061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33063         this_ptr_conv.is_owned = false;
33064         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
33065         memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
33066         return ret_arr;
33067 }
33068
33069 void  __attribute__((export_name("TS_GossipTimestampFilter_set_chain_hash"))) TS_GossipTimestampFilter_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
33070         LDKGossipTimestampFilter this_ptr_conv;
33071         this_ptr_conv.inner = untag_ptr(this_ptr);
33072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33074         this_ptr_conv.is_owned = false;
33075         LDKThirtyTwoBytes val_ref;
33076         CHECK(val->arr_len == 32);
33077         memcpy(val_ref.data, val->elems, 32); FREE(val);
33078         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
33079 }
33080
33081 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_first_timestamp"))) TS_GossipTimestampFilter_get_first_timestamp(uint64_t this_ptr) {
33082         LDKGossipTimestampFilter this_ptr_conv;
33083         this_ptr_conv.inner = untag_ptr(this_ptr);
33084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33086         this_ptr_conv.is_owned = false;
33087         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
33088         return ret_conv;
33089 }
33090
33091 void  __attribute__((export_name("TS_GossipTimestampFilter_set_first_timestamp"))) TS_GossipTimestampFilter_set_first_timestamp(uint64_t this_ptr, int32_t val) {
33092         LDKGossipTimestampFilter this_ptr_conv;
33093         this_ptr_conv.inner = untag_ptr(this_ptr);
33094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33096         this_ptr_conv.is_owned = false;
33097         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
33098 }
33099
33100 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_timestamp_range"))) TS_GossipTimestampFilter_get_timestamp_range(uint64_t this_ptr) {
33101         LDKGossipTimestampFilter this_ptr_conv;
33102         this_ptr_conv.inner = untag_ptr(this_ptr);
33103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33105         this_ptr_conv.is_owned = false;
33106         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
33107         return ret_conv;
33108 }
33109
33110 void  __attribute__((export_name("TS_GossipTimestampFilter_set_timestamp_range"))) TS_GossipTimestampFilter_set_timestamp_range(uint64_t this_ptr, int32_t val) {
33111         LDKGossipTimestampFilter this_ptr_conv;
33112         this_ptr_conv.inner = untag_ptr(this_ptr);
33113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33115         this_ptr_conv.is_owned = false;
33116         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
33117 }
33118
33119 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) {
33120         LDKThirtyTwoBytes chain_hash_arg_ref;
33121         CHECK(chain_hash_arg->arr_len == 32);
33122         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
33123         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
33124         uint64_t ret_ref = 0;
33125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33127         return ret_ref;
33128 }
33129
33130 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
33131         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
33132         uint64_t ret_ref = 0;
33133         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33134         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33135         return ret_ref;
33136 }
33137 int64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone_ptr"))) TS_GossipTimestampFilter_clone_ptr(uint64_t arg) {
33138         LDKGossipTimestampFilter arg_conv;
33139         arg_conv.inner = untag_ptr(arg);
33140         arg_conv.is_owned = ptr_is_owned(arg);
33141         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33142         arg_conv.is_owned = false;
33143         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
33144         return ret_conv;
33145 }
33146
33147 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone"))) TS_GossipTimestampFilter_clone(uint64_t orig) {
33148         LDKGossipTimestampFilter orig_conv;
33149         orig_conv.inner = untag_ptr(orig);
33150         orig_conv.is_owned = ptr_is_owned(orig);
33151         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33152         orig_conv.is_owned = false;
33153         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
33154         uint64_t ret_ref = 0;
33155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33157         return ret_ref;
33158 }
33159
33160 void  __attribute__((export_name("TS_ErrorAction_free"))) TS_ErrorAction_free(uint64_t this_ptr) {
33161         if (!ptr_is_owned(this_ptr)) return;
33162         void* this_ptr_ptr = untag_ptr(this_ptr);
33163         CHECK_ACCESS(this_ptr_ptr);
33164         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
33165         FREE(untag_ptr(this_ptr));
33166         ErrorAction_free(this_ptr_conv);
33167 }
33168
33169 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
33170         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
33171         *ret_copy = ErrorAction_clone(arg);
33172         uint64_t ret_ref = tag_ptr(ret_copy, true);
33173         return ret_ref;
33174 }
33175 int64_t  __attribute__((export_name("TS_ErrorAction_clone_ptr"))) TS_ErrorAction_clone_ptr(uint64_t arg) {
33176         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
33177         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
33178         return ret_conv;
33179 }
33180
33181 uint64_t  __attribute__((export_name("TS_ErrorAction_clone"))) TS_ErrorAction_clone(uint64_t orig) {
33182         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
33183         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
33184         *ret_copy = ErrorAction_clone(orig_conv);
33185         uint64_t ret_ref = tag_ptr(ret_copy, true);
33186         return ret_ref;
33187 }
33188
33189 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer"))) TS_ErrorAction_disconnect_peer(uint64_t msg) {
33190         LDKErrorMessage msg_conv;
33191         msg_conv.inner = untag_ptr(msg);
33192         msg_conv.is_owned = ptr_is_owned(msg);
33193         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
33194         msg_conv = ErrorMessage_clone(&msg_conv);
33195         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
33196         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
33197         uint64_t ret_ref = tag_ptr(ret_copy, true);
33198         return ret_ref;
33199 }
33200
33201 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_error"))) TS_ErrorAction_ignore_error() {
33202         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
33203         *ret_copy = ErrorAction_ignore_error();
33204         uint64_t ret_ref = tag_ptr(ret_copy, true);
33205         return ret_ref;
33206 }
33207
33208 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_and_log"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
33209         LDKLevel a_conv = LDKLevel_from_js(a);
33210         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
33211         *ret_copy = ErrorAction_ignore_and_log(a_conv);
33212         uint64_t ret_ref = tag_ptr(ret_copy, true);
33213         return ret_ref;
33214 }
33215
33216 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_duplicate_gossip"))) TS_ErrorAction_ignore_duplicate_gossip() {
33217         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
33218         *ret_copy = ErrorAction_ignore_duplicate_gossip();
33219         uint64_t ret_ref = tag_ptr(ret_copy, true);
33220         return ret_ref;
33221 }
33222
33223 uint64_t  __attribute__((export_name("TS_ErrorAction_send_error_message"))) TS_ErrorAction_send_error_message(uint64_t msg) {
33224         LDKErrorMessage msg_conv;
33225         msg_conv.inner = untag_ptr(msg);
33226         msg_conv.is_owned = ptr_is_owned(msg);
33227         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
33228         msg_conv = ErrorMessage_clone(&msg_conv);
33229         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
33230         *ret_copy = ErrorAction_send_error_message(msg_conv);
33231         uint64_t ret_ref = tag_ptr(ret_copy, true);
33232         return ret_ref;
33233 }
33234
33235 uint64_t  __attribute__((export_name("TS_ErrorAction_send_warning_message"))) TS_ErrorAction_send_warning_message(uint64_t msg, uint32_t log_level) {
33236         LDKWarningMessage msg_conv;
33237         msg_conv.inner = untag_ptr(msg);
33238         msg_conv.is_owned = ptr_is_owned(msg);
33239         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
33240         msg_conv = WarningMessage_clone(&msg_conv);
33241         LDKLevel log_level_conv = LDKLevel_from_js(log_level);
33242         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
33243         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
33244         uint64_t ret_ref = tag_ptr(ret_copy, true);
33245         return ret_ref;
33246 }
33247
33248 void  __attribute__((export_name("TS_LightningError_free"))) TS_LightningError_free(uint64_t this_obj) {
33249         LDKLightningError this_obj_conv;
33250         this_obj_conv.inner = untag_ptr(this_obj);
33251         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33253         LightningError_free(this_obj_conv);
33254 }
33255
33256 jstring  __attribute__((export_name("TS_LightningError_get_err"))) TS_LightningError_get_err(uint64_t this_ptr) {
33257         LDKLightningError this_ptr_conv;
33258         this_ptr_conv.inner = untag_ptr(this_ptr);
33259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33261         this_ptr_conv.is_owned = false;
33262         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
33263         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
33264         Str_free(ret_str);
33265         return ret_conv;
33266 }
33267
33268 void  __attribute__((export_name("TS_LightningError_set_err"))) TS_LightningError_set_err(uint64_t this_ptr, jstring val) {
33269         LDKLightningError this_ptr_conv;
33270         this_ptr_conv.inner = untag_ptr(this_ptr);
33271         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33273         this_ptr_conv.is_owned = false;
33274         LDKStr val_conv = str_ref_to_owned_c(val);
33275         LightningError_set_err(&this_ptr_conv, val_conv);
33276 }
33277
33278 uint64_t  __attribute__((export_name("TS_LightningError_get_action"))) TS_LightningError_get_action(uint64_t this_ptr) {
33279         LDKLightningError this_ptr_conv;
33280         this_ptr_conv.inner = untag_ptr(this_ptr);
33281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33283         this_ptr_conv.is_owned = false;
33284         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
33285         *ret_copy = LightningError_get_action(&this_ptr_conv);
33286         uint64_t ret_ref = tag_ptr(ret_copy, true);
33287         return ret_ref;
33288 }
33289
33290 void  __attribute__((export_name("TS_LightningError_set_action"))) TS_LightningError_set_action(uint64_t this_ptr, uint64_t val) {
33291         LDKLightningError this_ptr_conv;
33292         this_ptr_conv.inner = untag_ptr(this_ptr);
33293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33295         this_ptr_conv.is_owned = false;
33296         void* val_ptr = untag_ptr(val);
33297         CHECK_ACCESS(val_ptr);
33298         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
33299         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
33300         LightningError_set_action(&this_ptr_conv, val_conv);
33301 }
33302
33303 uint64_t  __attribute__((export_name("TS_LightningError_new"))) TS_LightningError_new(jstring err_arg, uint64_t action_arg) {
33304         LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
33305         void* action_arg_ptr = untag_ptr(action_arg);
33306         CHECK_ACCESS(action_arg_ptr);
33307         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
33308         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
33309         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
33310         uint64_t ret_ref = 0;
33311         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33312         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33313         return ret_ref;
33314 }
33315
33316 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
33317         LDKLightningError ret_var = LightningError_clone(arg);
33318         uint64_t ret_ref = 0;
33319         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33320         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33321         return ret_ref;
33322 }
33323 int64_t  __attribute__((export_name("TS_LightningError_clone_ptr"))) TS_LightningError_clone_ptr(uint64_t arg) {
33324         LDKLightningError arg_conv;
33325         arg_conv.inner = untag_ptr(arg);
33326         arg_conv.is_owned = ptr_is_owned(arg);
33327         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33328         arg_conv.is_owned = false;
33329         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
33330         return ret_conv;
33331 }
33332
33333 uint64_t  __attribute__((export_name("TS_LightningError_clone"))) TS_LightningError_clone(uint64_t orig) {
33334         LDKLightningError orig_conv;
33335         orig_conv.inner = untag_ptr(orig);
33336         orig_conv.is_owned = ptr_is_owned(orig);
33337         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33338         orig_conv.is_owned = false;
33339         LDKLightningError ret_var = LightningError_clone(&orig_conv);
33340         uint64_t ret_ref = 0;
33341         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33342         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33343         return ret_ref;
33344 }
33345
33346 void  __attribute__((export_name("TS_CommitmentUpdate_free"))) TS_CommitmentUpdate_free(uint64_t this_obj) {
33347         LDKCommitmentUpdate this_obj_conv;
33348         this_obj_conv.inner = untag_ptr(this_obj);
33349         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33351         CommitmentUpdate_free(this_obj_conv);
33352 }
33353
33354 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_add_htlcs"))) TS_CommitmentUpdate_get_update_add_htlcs(uint64_t this_ptr) {
33355         LDKCommitmentUpdate this_ptr_conv;
33356         this_ptr_conv.inner = untag_ptr(this_ptr);
33357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33359         this_ptr_conv.is_owned = false;
33360         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
33361         uint64_tArray ret_arr = NULL;
33362         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
33363         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
33364         for (size_t p = 0; p < ret_var.datalen; p++) {
33365                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
33366                 uint64_t ret_conv_15_ref = 0;
33367                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
33368                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
33369                 ret_arr_ptr[p] = ret_conv_15_ref;
33370         }
33371         
33372         FREE(ret_var.data);
33373         return ret_arr;
33374 }
33375
33376 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_add_htlcs"))) TS_CommitmentUpdate_set_update_add_htlcs(uint64_t this_ptr, uint64_tArray val) {
33377         LDKCommitmentUpdate this_ptr_conv;
33378         this_ptr_conv.inner = untag_ptr(this_ptr);
33379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33381         this_ptr_conv.is_owned = false;
33382         LDKCVec_UpdateAddHTLCZ val_constr;
33383         val_constr.datalen = val->arr_len;
33384         if (val_constr.datalen > 0)
33385                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
33386         else
33387                 val_constr.data = NULL;
33388         uint64_t* val_vals = val->elems;
33389         for (size_t p = 0; p < val_constr.datalen; p++) {
33390                 uint64_t val_conv_15 = val_vals[p];
33391                 LDKUpdateAddHTLC val_conv_15_conv;
33392                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
33393                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
33394                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
33395                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
33396                 val_constr.data[p] = val_conv_15_conv;
33397         }
33398         FREE(val);
33399         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
33400 }
33401
33402 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fulfill_htlcs"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint64_t this_ptr) {
33403         LDKCommitmentUpdate this_ptr_conv;
33404         this_ptr_conv.inner = untag_ptr(this_ptr);
33405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33407         this_ptr_conv.is_owned = false;
33408         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
33409         uint64_tArray ret_arr = NULL;
33410         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
33411         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
33412         for (size_t t = 0; t < ret_var.datalen; t++) {
33413                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
33414                 uint64_t ret_conv_19_ref = 0;
33415                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
33416                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
33417                 ret_arr_ptr[t] = ret_conv_19_ref;
33418         }
33419         
33420         FREE(ret_var.data);
33421         return ret_arr;
33422 }
33423
33424 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fulfill_htlcs"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint64_t this_ptr, uint64_tArray val) {
33425         LDKCommitmentUpdate this_ptr_conv;
33426         this_ptr_conv.inner = untag_ptr(this_ptr);
33427         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33429         this_ptr_conv.is_owned = false;
33430         LDKCVec_UpdateFulfillHTLCZ val_constr;
33431         val_constr.datalen = val->arr_len;
33432         if (val_constr.datalen > 0)
33433                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
33434         else
33435                 val_constr.data = NULL;
33436         uint64_t* val_vals = val->elems;
33437         for (size_t t = 0; t < val_constr.datalen; t++) {
33438                 uint64_t val_conv_19 = val_vals[t];
33439                 LDKUpdateFulfillHTLC val_conv_19_conv;
33440                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
33441                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
33442                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
33443                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
33444                 val_constr.data[t] = val_conv_19_conv;
33445         }
33446         FREE(val);
33447         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
33448 }
33449
33450 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_htlcs"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint64_t this_ptr) {
33451         LDKCommitmentUpdate this_ptr_conv;
33452         this_ptr_conv.inner = untag_ptr(this_ptr);
33453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33455         this_ptr_conv.is_owned = false;
33456         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
33457         uint64_tArray ret_arr = NULL;
33458         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
33459         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
33460         for (size_t q = 0; q < ret_var.datalen; q++) {
33461                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
33462                 uint64_t ret_conv_16_ref = 0;
33463                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
33464                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
33465                 ret_arr_ptr[q] = ret_conv_16_ref;
33466         }
33467         
33468         FREE(ret_var.data);
33469         return ret_arr;
33470 }
33471
33472 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_htlcs"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint64_t this_ptr, uint64_tArray val) {
33473         LDKCommitmentUpdate this_ptr_conv;
33474         this_ptr_conv.inner = untag_ptr(this_ptr);
33475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33477         this_ptr_conv.is_owned = false;
33478         LDKCVec_UpdateFailHTLCZ val_constr;
33479         val_constr.datalen = val->arr_len;
33480         if (val_constr.datalen > 0)
33481                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
33482         else
33483                 val_constr.data = NULL;
33484         uint64_t* val_vals = val->elems;
33485         for (size_t q = 0; q < val_constr.datalen; q++) {
33486                 uint64_t val_conv_16 = val_vals[q];
33487                 LDKUpdateFailHTLC val_conv_16_conv;
33488                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
33489                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
33490                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
33491                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
33492                 val_constr.data[q] = val_conv_16_conv;
33493         }
33494         FREE(val);
33495         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
33496 }
33497
33498 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint64_t this_ptr) {
33499         LDKCommitmentUpdate this_ptr_conv;
33500         this_ptr_conv.inner = untag_ptr(this_ptr);
33501         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33503         this_ptr_conv.is_owned = false;
33504         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
33505         uint64_tArray ret_arr = NULL;
33506         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
33507         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
33508         for (size_t z = 0; z < ret_var.datalen; z++) {
33509                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
33510                 uint64_t ret_conv_25_ref = 0;
33511                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
33512                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
33513                 ret_arr_ptr[z] = ret_conv_25_ref;
33514         }
33515         
33516         FREE(ret_var.data);
33517         return ret_arr;
33518 }
33519
33520 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) {
33521         LDKCommitmentUpdate this_ptr_conv;
33522         this_ptr_conv.inner = untag_ptr(this_ptr);
33523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33525         this_ptr_conv.is_owned = false;
33526         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
33527         val_constr.datalen = val->arr_len;
33528         if (val_constr.datalen > 0)
33529                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
33530         else
33531                 val_constr.data = NULL;
33532         uint64_t* val_vals = val->elems;
33533         for (size_t z = 0; z < val_constr.datalen; z++) {
33534                 uint64_t val_conv_25 = val_vals[z];
33535                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
33536                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
33537                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
33538                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
33539                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
33540                 val_constr.data[z] = val_conv_25_conv;
33541         }
33542         FREE(val);
33543         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
33544 }
33545
33546 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_update_fee"))) TS_CommitmentUpdate_get_update_fee(uint64_t this_ptr) {
33547         LDKCommitmentUpdate this_ptr_conv;
33548         this_ptr_conv.inner = untag_ptr(this_ptr);
33549         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33550         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33551         this_ptr_conv.is_owned = false;
33552         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
33553         uint64_t ret_ref = 0;
33554         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33555         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33556         return ret_ref;
33557 }
33558
33559 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fee"))) TS_CommitmentUpdate_set_update_fee(uint64_t this_ptr, uint64_t val) {
33560         LDKCommitmentUpdate this_ptr_conv;
33561         this_ptr_conv.inner = untag_ptr(this_ptr);
33562         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33564         this_ptr_conv.is_owned = false;
33565         LDKUpdateFee val_conv;
33566         val_conv.inner = untag_ptr(val);
33567         val_conv.is_owned = ptr_is_owned(val);
33568         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33569         val_conv = UpdateFee_clone(&val_conv);
33570         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
33571 }
33572
33573 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_commitment_signed"))) TS_CommitmentUpdate_get_commitment_signed(uint64_t this_ptr) {
33574         LDKCommitmentUpdate this_ptr_conv;
33575         this_ptr_conv.inner = untag_ptr(this_ptr);
33576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33578         this_ptr_conv.is_owned = false;
33579         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
33580         uint64_t ret_ref = 0;
33581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33583         return ret_ref;
33584 }
33585
33586 void  __attribute__((export_name("TS_CommitmentUpdate_set_commitment_signed"))) TS_CommitmentUpdate_set_commitment_signed(uint64_t this_ptr, uint64_t val) {
33587         LDKCommitmentUpdate this_ptr_conv;
33588         this_ptr_conv.inner = untag_ptr(this_ptr);
33589         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33591         this_ptr_conv.is_owned = false;
33592         LDKCommitmentSigned val_conv;
33593         val_conv.inner = untag_ptr(val);
33594         val_conv.is_owned = ptr_is_owned(val);
33595         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33596         val_conv = CommitmentSigned_clone(&val_conv);
33597         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
33598 }
33599
33600 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) {
33601         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
33602         update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
33603         if (update_add_htlcs_arg_constr.datalen > 0)
33604                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
33605         else
33606                 update_add_htlcs_arg_constr.data = NULL;
33607         uint64_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
33608         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
33609                 uint64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
33610                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
33611                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
33612                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
33613                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
33614                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
33615                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
33616         }
33617         FREE(update_add_htlcs_arg);
33618         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
33619         update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
33620         if (update_fulfill_htlcs_arg_constr.datalen > 0)
33621                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
33622         else
33623                 update_fulfill_htlcs_arg_constr.data = NULL;
33624         uint64_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
33625         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
33626                 uint64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
33627                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
33628                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
33629                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
33630                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
33631                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
33632                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
33633         }
33634         FREE(update_fulfill_htlcs_arg);
33635         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
33636         update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
33637         if (update_fail_htlcs_arg_constr.datalen > 0)
33638                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
33639         else
33640                 update_fail_htlcs_arg_constr.data = NULL;
33641         uint64_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
33642         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
33643                 uint64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
33644                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
33645                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
33646                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
33647                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
33648                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
33649                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
33650         }
33651         FREE(update_fail_htlcs_arg);
33652         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
33653         update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
33654         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
33655                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
33656         else
33657                 update_fail_malformed_htlcs_arg_constr.data = NULL;
33658         uint64_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
33659         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
33660                 uint64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
33661                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
33662                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
33663                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
33664                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
33665                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
33666                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
33667         }
33668         FREE(update_fail_malformed_htlcs_arg);
33669         LDKUpdateFee update_fee_arg_conv;
33670         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
33671         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
33672         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
33673         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
33674         LDKCommitmentSigned commitment_signed_arg_conv;
33675         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
33676         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
33677         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
33678         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
33679         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);
33680         uint64_t ret_ref = 0;
33681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33683         return ret_ref;
33684 }
33685
33686 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
33687         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
33688         uint64_t ret_ref = 0;
33689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33691         return ret_ref;
33692 }
33693 int64_t  __attribute__((export_name("TS_CommitmentUpdate_clone_ptr"))) TS_CommitmentUpdate_clone_ptr(uint64_t arg) {
33694         LDKCommitmentUpdate arg_conv;
33695         arg_conv.inner = untag_ptr(arg);
33696         arg_conv.is_owned = ptr_is_owned(arg);
33697         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
33698         arg_conv.is_owned = false;
33699         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
33700         return ret_conv;
33701 }
33702
33703 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_clone"))) TS_CommitmentUpdate_clone(uint64_t orig) {
33704         LDKCommitmentUpdate orig_conv;
33705         orig_conv.inner = untag_ptr(orig);
33706         orig_conv.is_owned = ptr_is_owned(orig);
33707         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
33708         orig_conv.is_owned = false;
33709         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
33710         uint64_t ret_ref = 0;
33711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33713         return ret_ref;
33714 }
33715
33716 void  __attribute__((export_name("TS_ChannelMessageHandler_free"))) TS_ChannelMessageHandler_free(uint64_t this_ptr) {
33717         if (!ptr_is_owned(this_ptr)) return;
33718         void* this_ptr_ptr = untag_ptr(this_ptr);
33719         CHECK_ACCESS(this_ptr_ptr);
33720         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
33721         FREE(untag_ptr(this_ptr));
33722         ChannelMessageHandler_free(this_ptr_conv);
33723 }
33724
33725 void  __attribute__((export_name("TS_RoutingMessageHandler_free"))) TS_RoutingMessageHandler_free(uint64_t this_ptr) {
33726         if (!ptr_is_owned(this_ptr)) return;
33727         void* this_ptr_ptr = untag_ptr(this_ptr);
33728         CHECK_ACCESS(this_ptr_ptr);
33729         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
33730         FREE(untag_ptr(this_ptr));
33731         RoutingMessageHandler_free(this_ptr_conv);
33732 }
33733
33734 void  __attribute__((export_name("TS_OnionMessageHandler_free"))) TS_OnionMessageHandler_free(uint64_t this_ptr) {
33735         if (!ptr_is_owned(this_ptr)) return;
33736         void* this_ptr_ptr = untag_ptr(this_ptr);
33737         CHECK_ACCESS(this_ptr_ptr);
33738         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
33739         FREE(untag_ptr(this_ptr));
33740         OnionMessageHandler_free(this_ptr_conv);
33741 }
33742
33743 int8_tArray  __attribute__((export_name("TS_AcceptChannel_write"))) TS_AcceptChannel_write(uint64_t obj) {
33744         LDKAcceptChannel obj_conv;
33745         obj_conv.inner = untag_ptr(obj);
33746         obj_conv.is_owned = ptr_is_owned(obj);
33747         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33748         obj_conv.is_owned = false;
33749         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
33750         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33751         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33752         CVec_u8Z_free(ret_var);
33753         return ret_arr;
33754 }
33755
33756 uint64_t  __attribute__((export_name("TS_AcceptChannel_read"))) TS_AcceptChannel_read(int8_tArray ser) {
33757         LDKu8slice ser_ref;
33758         ser_ref.datalen = ser->arr_len;
33759         ser_ref.data = ser->elems;
33760         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
33761         *ret_conv = AcceptChannel_read(ser_ref);
33762         FREE(ser);
33763         return tag_ptr(ret_conv, true);
33764 }
33765
33766 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_write"))) TS_AnnouncementSignatures_write(uint64_t obj) {
33767         LDKAnnouncementSignatures obj_conv;
33768         obj_conv.inner = untag_ptr(obj);
33769         obj_conv.is_owned = ptr_is_owned(obj);
33770         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33771         obj_conv.is_owned = false;
33772         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
33773         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33774         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33775         CVec_u8Z_free(ret_var);
33776         return ret_arr;
33777 }
33778
33779 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_read"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
33780         LDKu8slice ser_ref;
33781         ser_ref.datalen = ser->arr_len;
33782         ser_ref.data = ser->elems;
33783         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
33784         *ret_conv = AnnouncementSignatures_read(ser_ref);
33785         FREE(ser);
33786         return tag_ptr(ret_conv, true);
33787 }
33788
33789 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_write"))) TS_ChannelReestablish_write(uint64_t obj) {
33790         LDKChannelReestablish obj_conv;
33791         obj_conv.inner = untag_ptr(obj);
33792         obj_conv.is_owned = ptr_is_owned(obj);
33793         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33794         obj_conv.is_owned = false;
33795         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
33796         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33797         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33798         CVec_u8Z_free(ret_var);
33799         return ret_arr;
33800 }
33801
33802 uint64_t  __attribute__((export_name("TS_ChannelReestablish_read"))) TS_ChannelReestablish_read(int8_tArray ser) {
33803         LDKu8slice ser_ref;
33804         ser_ref.datalen = ser->arr_len;
33805         ser_ref.data = ser->elems;
33806         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
33807         *ret_conv = ChannelReestablish_read(ser_ref);
33808         FREE(ser);
33809         return tag_ptr(ret_conv, true);
33810 }
33811
33812 int8_tArray  __attribute__((export_name("TS_ClosingSigned_write"))) TS_ClosingSigned_write(uint64_t obj) {
33813         LDKClosingSigned obj_conv;
33814         obj_conv.inner = untag_ptr(obj);
33815         obj_conv.is_owned = ptr_is_owned(obj);
33816         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33817         obj_conv.is_owned = false;
33818         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
33819         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33820         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33821         CVec_u8Z_free(ret_var);
33822         return ret_arr;
33823 }
33824
33825 uint64_t  __attribute__((export_name("TS_ClosingSigned_read"))) TS_ClosingSigned_read(int8_tArray ser) {
33826         LDKu8slice ser_ref;
33827         ser_ref.datalen = ser->arr_len;
33828         ser_ref.data = ser->elems;
33829         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
33830         *ret_conv = ClosingSigned_read(ser_ref);
33831         FREE(ser);
33832         return tag_ptr(ret_conv, true);
33833 }
33834
33835 int8_tArray  __attribute__((export_name("TS_ClosingSignedFeeRange_write"))) TS_ClosingSignedFeeRange_write(uint64_t obj) {
33836         LDKClosingSignedFeeRange obj_conv;
33837         obj_conv.inner = untag_ptr(obj);
33838         obj_conv.is_owned = ptr_is_owned(obj);
33839         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33840         obj_conv.is_owned = false;
33841         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
33842         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33843         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33844         CVec_u8Z_free(ret_var);
33845         return ret_arr;
33846 }
33847
33848 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_read"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
33849         LDKu8slice ser_ref;
33850         ser_ref.datalen = ser->arr_len;
33851         ser_ref.data = ser->elems;
33852         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
33853         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
33854         FREE(ser);
33855         return tag_ptr(ret_conv, true);
33856 }
33857
33858 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_write"))) TS_CommitmentSigned_write(uint64_t obj) {
33859         LDKCommitmentSigned obj_conv;
33860         obj_conv.inner = untag_ptr(obj);
33861         obj_conv.is_owned = ptr_is_owned(obj);
33862         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33863         obj_conv.is_owned = false;
33864         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
33865         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33866         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33867         CVec_u8Z_free(ret_var);
33868         return ret_arr;
33869 }
33870
33871 uint64_t  __attribute__((export_name("TS_CommitmentSigned_read"))) TS_CommitmentSigned_read(int8_tArray ser) {
33872         LDKu8slice ser_ref;
33873         ser_ref.datalen = ser->arr_len;
33874         ser_ref.data = ser->elems;
33875         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
33876         *ret_conv = CommitmentSigned_read(ser_ref);
33877         FREE(ser);
33878         return tag_ptr(ret_conv, true);
33879 }
33880
33881 int8_tArray  __attribute__((export_name("TS_FundingCreated_write"))) TS_FundingCreated_write(uint64_t obj) {
33882         LDKFundingCreated obj_conv;
33883         obj_conv.inner = untag_ptr(obj);
33884         obj_conv.is_owned = ptr_is_owned(obj);
33885         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33886         obj_conv.is_owned = false;
33887         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
33888         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33889         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33890         CVec_u8Z_free(ret_var);
33891         return ret_arr;
33892 }
33893
33894 uint64_t  __attribute__((export_name("TS_FundingCreated_read"))) TS_FundingCreated_read(int8_tArray ser) {
33895         LDKu8slice ser_ref;
33896         ser_ref.datalen = ser->arr_len;
33897         ser_ref.data = ser->elems;
33898         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
33899         *ret_conv = FundingCreated_read(ser_ref);
33900         FREE(ser);
33901         return tag_ptr(ret_conv, true);
33902 }
33903
33904 int8_tArray  __attribute__((export_name("TS_FundingSigned_write"))) TS_FundingSigned_write(uint64_t obj) {
33905         LDKFundingSigned obj_conv;
33906         obj_conv.inner = untag_ptr(obj);
33907         obj_conv.is_owned = ptr_is_owned(obj);
33908         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33909         obj_conv.is_owned = false;
33910         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
33911         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33912         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33913         CVec_u8Z_free(ret_var);
33914         return ret_arr;
33915 }
33916
33917 uint64_t  __attribute__((export_name("TS_FundingSigned_read"))) TS_FundingSigned_read(int8_tArray ser) {
33918         LDKu8slice ser_ref;
33919         ser_ref.datalen = ser->arr_len;
33920         ser_ref.data = ser->elems;
33921         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
33922         *ret_conv = FundingSigned_read(ser_ref);
33923         FREE(ser);
33924         return tag_ptr(ret_conv, true);
33925 }
33926
33927 int8_tArray  __attribute__((export_name("TS_ChannelReady_write"))) TS_ChannelReady_write(uint64_t obj) {
33928         LDKChannelReady obj_conv;
33929         obj_conv.inner = untag_ptr(obj);
33930         obj_conv.is_owned = ptr_is_owned(obj);
33931         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33932         obj_conv.is_owned = false;
33933         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
33934         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33935         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33936         CVec_u8Z_free(ret_var);
33937         return ret_arr;
33938 }
33939
33940 uint64_t  __attribute__((export_name("TS_ChannelReady_read"))) TS_ChannelReady_read(int8_tArray ser) {
33941         LDKu8slice ser_ref;
33942         ser_ref.datalen = ser->arr_len;
33943         ser_ref.data = ser->elems;
33944         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
33945         *ret_conv = ChannelReady_read(ser_ref);
33946         FREE(ser);
33947         return tag_ptr(ret_conv, true);
33948 }
33949
33950 int8_tArray  __attribute__((export_name("TS_Init_write"))) TS_Init_write(uint64_t obj) {
33951         LDKInit obj_conv;
33952         obj_conv.inner = untag_ptr(obj);
33953         obj_conv.is_owned = ptr_is_owned(obj);
33954         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33955         obj_conv.is_owned = false;
33956         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
33957         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33958         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33959         CVec_u8Z_free(ret_var);
33960         return ret_arr;
33961 }
33962
33963 uint64_t  __attribute__((export_name("TS_Init_read"))) TS_Init_read(int8_tArray ser) {
33964         LDKu8slice ser_ref;
33965         ser_ref.datalen = ser->arr_len;
33966         ser_ref.data = ser->elems;
33967         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
33968         *ret_conv = Init_read(ser_ref);
33969         FREE(ser);
33970         return tag_ptr(ret_conv, true);
33971 }
33972
33973 int8_tArray  __attribute__((export_name("TS_OpenChannel_write"))) TS_OpenChannel_write(uint64_t obj) {
33974         LDKOpenChannel obj_conv;
33975         obj_conv.inner = untag_ptr(obj);
33976         obj_conv.is_owned = ptr_is_owned(obj);
33977         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33978         obj_conv.is_owned = false;
33979         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
33980         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33981         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33982         CVec_u8Z_free(ret_var);
33983         return ret_arr;
33984 }
33985
33986 uint64_t  __attribute__((export_name("TS_OpenChannel_read"))) TS_OpenChannel_read(int8_tArray ser) {
33987         LDKu8slice ser_ref;
33988         ser_ref.datalen = ser->arr_len;
33989         ser_ref.data = ser->elems;
33990         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
33991         *ret_conv = OpenChannel_read(ser_ref);
33992         FREE(ser);
33993         return tag_ptr(ret_conv, true);
33994 }
33995
33996 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_write"))) TS_RevokeAndACK_write(uint64_t obj) {
33997         LDKRevokeAndACK obj_conv;
33998         obj_conv.inner = untag_ptr(obj);
33999         obj_conv.is_owned = ptr_is_owned(obj);
34000         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34001         obj_conv.is_owned = false;
34002         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
34003         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34004         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34005         CVec_u8Z_free(ret_var);
34006         return ret_arr;
34007 }
34008
34009 uint64_t  __attribute__((export_name("TS_RevokeAndACK_read"))) TS_RevokeAndACK_read(int8_tArray ser) {
34010         LDKu8slice ser_ref;
34011         ser_ref.datalen = ser->arr_len;
34012         ser_ref.data = ser->elems;
34013         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
34014         *ret_conv = RevokeAndACK_read(ser_ref);
34015         FREE(ser);
34016         return tag_ptr(ret_conv, true);
34017 }
34018
34019 int8_tArray  __attribute__((export_name("TS_Shutdown_write"))) TS_Shutdown_write(uint64_t obj) {
34020         LDKShutdown obj_conv;
34021         obj_conv.inner = untag_ptr(obj);
34022         obj_conv.is_owned = ptr_is_owned(obj);
34023         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34024         obj_conv.is_owned = false;
34025         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
34026         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34027         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34028         CVec_u8Z_free(ret_var);
34029         return ret_arr;
34030 }
34031
34032 uint64_t  __attribute__((export_name("TS_Shutdown_read"))) TS_Shutdown_read(int8_tArray ser) {
34033         LDKu8slice ser_ref;
34034         ser_ref.datalen = ser->arr_len;
34035         ser_ref.data = ser->elems;
34036         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
34037         *ret_conv = Shutdown_read(ser_ref);
34038         FREE(ser);
34039         return tag_ptr(ret_conv, true);
34040 }
34041
34042 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_write"))) TS_UpdateFailHTLC_write(uint64_t obj) {
34043         LDKUpdateFailHTLC obj_conv;
34044         obj_conv.inner = untag_ptr(obj);
34045         obj_conv.is_owned = ptr_is_owned(obj);
34046         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34047         obj_conv.is_owned = false;
34048         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
34049         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34050         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34051         CVec_u8Z_free(ret_var);
34052         return ret_arr;
34053 }
34054
34055 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_read"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
34056         LDKu8slice ser_ref;
34057         ser_ref.datalen = ser->arr_len;
34058         ser_ref.data = ser->elems;
34059         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
34060         *ret_conv = UpdateFailHTLC_read(ser_ref);
34061         FREE(ser);
34062         return tag_ptr(ret_conv, true);
34063 }
34064
34065 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_write"))) TS_UpdateFailMalformedHTLC_write(uint64_t obj) {
34066         LDKUpdateFailMalformedHTLC obj_conv;
34067         obj_conv.inner = untag_ptr(obj);
34068         obj_conv.is_owned = ptr_is_owned(obj);
34069         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34070         obj_conv.is_owned = false;
34071         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
34072         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34073         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34074         CVec_u8Z_free(ret_var);
34075         return ret_arr;
34076 }
34077
34078 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_read"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
34079         LDKu8slice ser_ref;
34080         ser_ref.datalen = ser->arr_len;
34081         ser_ref.data = ser->elems;
34082         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
34083         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
34084         FREE(ser);
34085         return tag_ptr(ret_conv, true);
34086 }
34087
34088 int8_tArray  __attribute__((export_name("TS_UpdateFee_write"))) TS_UpdateFee_write(uint64_t obj) {
34089         LDKUpdateFee obj_conv;
34090         obj_conv.inner = untag_ptr(obj);
34091         obj_conv.is_owned = ptr_is_owned(obj);
34092         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34093         obj_conv.is_owned = false;
34094         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
34095         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34096         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34097         CVec_u8Z_free(ret_var);
34098         return ret_arr;
34099 }
34100
34101 uint64_t  __attribute__((export_name("TS_UpdateFee_read"))) TS_UpdateFee_read(int8_tArray ser) {
34102         LDKu8slice ser_ref;
34103         ser_ref.datalen = ser->arr_len;
34104         ser_ref.data = ser->elems;
34105         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
34106         *ret_conv = UpdateFee_read(ser_ref);
34107         FREE(ser);
34108         return tag_ptr(ret_conv, true);
34109 }
34110
34111 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_write"))) TS_UpdateFulfillHTLC_write(uint64_t obj) {
34112         LDKUpdateFulfillHTLC obj_conv;
34113         obj_conv.inner = untag_ptr(obj);
34114         obj_conv.is_owned = ptr_is_owned(obj);
34115         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34116         obj_conv.is_owned = false;
34117         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
34118         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34119         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34120         CVec_u8Z_free(ret_var);
34121         return ret_arr;
34122 }
34123
34124 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_read"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
34125         LDKu8slice ser_ref;
34126         ser_ref.datalen = ser->arr_len;
34127         ser_ref.data = ser->elems;
34128         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
34129         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
34130         FREE(ser);
34131         return tag_ptr(ret_conv, true);
34132 }
34133
34134 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_write"))) TS_UpdateAddHTLC_write(uint64_t obj) {
34135         LDKUpdateAddHTLC obj_conv;
34136         obj_conv.inner = untag_ptr(obj);
34137         obj_conv.is_owned = ptr_is_owned(obj);
34138         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34139         obj_conv.is_owned = false;
34140         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
34141         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34142         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34143         CVec_u8Z_free(ret_var);
34144         return ret_arr;
34145 }
34146
34147 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_read"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
34148         LDKu8slice ser_ref;
34149         ser_ref.datalen = ser->arr_len;
34150         ser_ref.data = ser->elems;
34151         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
34152         *ret_conv = UpdateAddHTLC_read(ser_ref);
34153         FREE(ser);
34154         return tag_ptr(ret_conv, true);
34155 }
34156
34157 uint64_t  __attribute__((export_name("TS_OnionMessage_read"))) TS_OnionMessage_read(int8_tArray ser) {
34158         LDKu8slice ser_ref;
34159         ser_ref.datalen = ser->arr_len;
34160         ser_ref.data = ser->elems;
34161         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
34162         *ret_conv = OnionMessage_read(ser_ref);
34163         FREE(ser);
34164         return tag_ptr(ret_conv, true);
34165 }
34166
34167 int8_tArray  __attribute__((export_name("TS_OnionMessage_write"))) TS_OnionMessage_write(uint64_t obj) {
34168         LDKOnionMessage obj_conv;
34169         obj_conv.inner = untag_ptr(obj);
34170         obj_conv.is_owned = ptr_is_owned(obj);
34171         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34172         obj_conv.is_owned = false;
34173         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
34174         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34175         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34176         CVec_u8Z_free(ret_var);
34177         return ret_arr;
34178 }
34179
34180 int8_tArray  __attribute__((export_name("TS_Ping_write"))) TS_Ping_write(uint64_t obj) {
34181         LDKPing obj_conv;
34182         obj_conv.inner = untag_ptr(obj);
34183         obj_conv.is_owned = ptr_is_owned(obj);
34184         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34185         obj_conv.is_owned = false;
34186         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
34187         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34188         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34189         CVec_u8Z_free(ret_var);
34190         return ret_arr;
34191 }
34192
34193 uint64_t  __attribute__((export_name("TS_Ping_read"))) TS_Ping_read(int8_tArray ser) {
34194         LDKu8slice ser_ref;
34195         ser_ref.datalen = ser->arr_len;
34196         ser_ref.data = ser->elems;
34197         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
34198         *ret_conv = Ping_read(ser_ref);
34199         FREE(ser);
34200         return tag_ptr(ret_conv, true);
34201 }
34202
34203 int8_tArray  __attribute__((export_name("TS_Pong_write"))) TS_Pong_write(uint64_t obj) {
34204         LDKPong obj_conv;
34205         obj_conv.inner = untag_ptr(obj);
34206         obj_conv.is_owned = ptr_is_owned(obj);
34207         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34208         obj_conv.is_owned = false;
34209         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
34210         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34211         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34212         CVec_u8Z_free(ret_var);
34213         return ret_arr;
34214 }
34215
34216 uint64_t  __attribute__((export_name("TS_Pong_read"))) TS_Pong_read(int8_tArray ser) {
34217         LDKu8slice ser_ref;
34218         ser_ref.datalen = ser->arr_len;
34219         ser_ref.data = ser->elems;
34220         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
34221         *ret_conv = Pong_read(ser_ref);
34222         FREE(ser);
34223         return tag_ptr(ret_conv, true);
34224 }
34225
34226 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_write"))) TS_UnsignedChannelAnnouncement_write(uint64_t obj) {
34227         LDKUnsignedChannelAnnouncement obj_conv;
34228         obj_conv.inner = untag_ptr(obj);
34229         obj_conv.is_owned = ptr_is_owned(obj);
34230         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34231         obj_conv.is_owned = false;
34232         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
34233         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34234         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34235         CVec_u8Z_free(ret_var);
34236         return ret_arr;
34237 }
34238
34239 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_read"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
34240         LDKu8slice ser_ref;
34241         ser_ref.datalen = ser->arr_len;
34242         ser_ref.data = ser->elems;
34243         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
34244         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
34245         FREE(ser);
34246         return tag_ptr(ret_conv, true);
34247 }
34248
34249 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_write"))) TS_ChannelAnnouncement_write(uint64_t obj) {
34250         LDKChannelAnnouncement obj_conv;
34251         obj_conv.inner = untag_ptr(obj);
34252         obj_conv.is_owned = ptr_is_owned(obj);
34253         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34254         obj_conv.is_owned = false;
34255         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
34256         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34257         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34258         CVec_u8Z_free(ret_var);
34259         return ret_arr;
34260 }
34261
34262 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_read"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
34263         LDKu8slice ser_ref;
34264         ser_ref.datalen = ser->arr_len;
34265         ser_ref.data = ser->elems;
34266         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
34267         *ret_conv = ChannelAnnouncement_read(ser_ref);
34268         FREE(ser);
34269         return tag_ptr(ret_conv, true);
34270 }
34271
34272 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_write"))) TS_UnsignedChannelUpdate_write(uint64_t obj) {
34273         LDKUnsignedChannelUpdate obj_conv;
34274         obj_conv.inner = untag_ptr(obj);
34275         obj_conv.is_owned = ptr_is_owned(obj);
34276         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34277         obj_conv.is_owned = false;
34278         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
34279         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34280         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34281         CVec_u8Z_free(ret_var);
34282         return ret_arr;
34283 }
34284
34285 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_read"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
34286         LDKu8slice ser_ref;
34287         ser_ref.datalen = ser->arr_len;
34288         ser_ref.data = ser->elems;
34289         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
34290         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
34291         FREE(ser);
34292         return tag_ptr(ret_conv, true);
34293 }
34294
34295 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_write"))) TS_ChannelUpdate_write(uint64_t obj) {
34296         LDKChannelUpdate obj_conv;
34297         obj_conv.inner = untag_ptr(obj);
34298         obj_conv.is_owned = ptr_is_owned(obj);
34299         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34300         obj_conv.is_owned = false;
34301         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
34302         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34303         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34304         CVec_u8Z_free(ret_var);
34305         return ret_arr;
34306 }
34307
34308 uint64_t  __attribute__((export_name("TS_ChannelUpdate_read"))) TS_ChannelUpdate_read(int8_tArray ser) {
34309         LDKu8slice ser_ref;
34310         ser_ref.datalen = ser->arr_len;
34311         ser_ref.data = ser->elems;
34312         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
34313         *ret_conv = ChannelUpdate_read(ser_ref);
34314         FREE(ser);
34315         return tag_ptr(ret_conv, true);
34316 }
34317
34318 int8_tArray  __attribute__((export_name("TS_ErrorMessage_write"))) TS_ErrorMessage_write(uint64_t obj) {
34319         LDKErrorMessage obj_conv;
34320         obj_conv.inner = untag_ptr(obj);
34321         obj_conv.is_owned = ptr_is_owned(obj);
34322         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34323         obj_conv.is_owned = false;
34324         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
34325         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34326         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34327         CVec_u8Z_free(ret_var);
34328         return ret_arr;
34329 }
34330
34331 uint64_t  __attribute__((export_name("TS_ErrorMessage_read"))) TS_ErrorMessage_read(int8_tArray ser) {
34332         LDKu8slice ser_ref;
34333         ser_ref.datalen = ser->arr_len;
34334         ser_ref.data = ser->elems;
34335         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
34336         *ret_conv = ErrorMessage_read(ser_ref);
34337         FREE(ser);
34338         return tag_ptr(ret_conv, true);
34339 }
34340
34341 int8_tArray  __attribute__((export_name("TS_WarningMessage_write"))) TS_WarningMessage_write(uint64_t obj) {
34342         LDKWarningMessage obj_conv;
34343         obj_conv.inner = untag_ptr(obj);
34344         obj_conv.is_owned = ptr_is_owned(obj);
34345         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34346         obj_conv.is_owned = false;
34347         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
34348         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34349         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34350         CVec_u8Z_free(ret_var);
34351         return ret_arr;
34352 }
34353
34354 uint64_t  __attribute__((export_name("TS_WarningMessage_read"))) TS_WarningMessage_read(int8_tArray ser) {
34355         LDKu8slice ser_ref;
34356         ser_ref.datalen = ser->arr_len;
34357         ser_ref.data = ser->elems;
34358         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
34359         *ret_conv = WarningMessage_read(ser_ref);
34360         FREE(ser);
34361         return tag_ptr(ret_conv, true);
34362 }
34363
34364 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_write"))) TS_UnsignedNodeAnnouncement_write(uint64_t obj) {
34365         LDKUnsignedNodeAnnouncement obj_conv;
34366         obj_conv.inner = untag_ptr(obj);
34367         obj_conv.is_owned = ptr_is_owned(obj);
34368         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34369         obj_conv.is_owned = false;
34370         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
34371         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34372         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34373         CVec_u8Z_free(ret_var);
34374         return ret_arr;
34375 }
34376
34377 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_read"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
34378         LDKu8slice ser_ref;
34379         ser_ref.datalen = ser->arr_len;
34380         ser_ref.data = ser->elems;
34381         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
34382         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
34383         FREE(ser);
34384         return tag_ptr(ret_conv, true);
34385 }
34386
34387 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_write"))) TS_NodeAnnouncement_write(uint64_t obj) {
34388         LDKNodeAnnouncement obj_conv;
34389         obj_conv.inner = untag_ptr(obj);
34390         obj_conv.is_owned = ptr_is_owned(obj);
34391         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34392         obj_conv.is_owned = false;
34393         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
34394         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34395         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34396         CVec_u8Z_free(ret_var);
34397         return ret_arr;
34398 }
34399
34400 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_read"))) TS_NodeAnnouncement_read(int8_tArray ser) {
34401         LDKu8slice ser_ref;
34402         ser_ref.datalen = ser->arr_len;
34403         ser_ref.data = ser->elems;
34404         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
34405         *ret_conv = NodeAnnouncement_read(ser_ref);
34406         FREE(ser);
34407         return tag_ptr(ret_conv, true);
34408 }
34409
34410 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_read"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
34411         LDKu8slice ser_ref;
34412         ser_ref.datalen = ser->arr_len;
34413         ser_ref.data = ser->elems;
34414         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
34415         *ret_conv = QueryShortChannelIds_read(ser_ref);
34416         FREE(ser);
34417         return tag_ptr(ret_conv, true);
34418 }
34419
34420 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_write"))) TS_QueryShortChannelIds_write(uint64_t obj) {
34421         LDKQueryShortChannelIds obj_conv;
34422         obj_conv.inner = untag_ptr(obj);
34423         obj_conv.is_owned = ptr_is_owned(obj);
34424         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34425         obj_conv.is_owned = false;
34426         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
34427         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34428         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34429         CVec_u8Z_free(ret_var);
34430         return ret_arr;
34431 }
34432
34433 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_write"))) TS_ReplyShortChannelIdsEnd_write(uint64_t obj) {
34434         LDKReplyShortChannelIdsEnd obj_conv;
34435         obj_conv.inner = untag_ptr(obj);
34436         obj_conv.is_owned = ptr_is_owned(obj);
34437         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34438         obj_conv.is_owned = false;
34439         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
34440         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34441         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34442         CVec_u8Z_free(ret_var);
34443         return ret_arr;
34444 }
34445
34446 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_read"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
34447         LDKu8slice ser_ref;
34448         ser_ref.datalen = ser->arr_len;
34449         ser_ref.data = ser->elems;
34450         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
34451         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
34452         FREE(ser);
34453         return tag_ptr(ret_conv, true);
34454 }
34455
34456 int32_t  __attribute__((export_name("TS_QueryChannelRange_end_blocknum"))) TS_QueryChannelRange_end_blocknum(uint64_t this_arg) {
34457         LDKQueryChannelRange this_arg_conv;
34458         this_arg_conv.inner = untag_ptr(this_arg);
34459         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34461         this_arg_conv.is_owned = false;
34462         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
34463         return ret_conv;
34464 }
34465
34466 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_write"))) TS_QueryChannelRange_write(uint64_t obj) {
34467         LDKQueryChannelRange obj_conv;
34468         obj_conv.inner = untag_ptr(obj);
34469         obj_conv.is_owned = ptr_is_owned(obj);
34470         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34471         obj_conv.is_owned = false;
34472         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
34473         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34474         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34475         CVec_u8Z_free(ret_var);
34476         return ret_arr;
34477 }
34478
34479 uint64_t  __attribute__((export_name("TS_QueryChannelRange_read"))) TS_QueryChannelRange_read(int8_tArray ser) {
34480         LDKu8slice ser_ref;
34481         ser_ref.datalen = ser->arr_len;
34482         ser_ref.data = ser->elems;
34483         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
34484         *ret_conv = QueryChannelRange_read(ser_ref);
34485         FREE(ser);
34486         return tag_ptr(ret_conv, true);
34487 }
34488
34489 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_read"))) TS_ReplyChannelRange_read(int8_tArray ser) {
34490         LDKu8slice ser_ref;
34491         ser_ref.datalen = ser->arr_len;
34492         ser_ref.data = ser->elems;
34493         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
34494         *ret_conv = ReplyChannelRange_read(ser_ref);
34495         FREE(ser);
34496         return tag_ptr(ret_conv, true);
34497 }
34498
34499 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_write"))) TS_ReplyChannelRange_write(uint64_t obj) {
34500         LDKReplyChannelRange obj_conv;
34501         obj_conv.inner = untag_ptr(obj);
34502         obj_conv.is_owned = ptr_is_owned(obj);
34503         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34504         obj_conv.is_owned = false;
34505         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
34506         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34507         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34508         CVec_u8Z_free(ret_var);
34509         return ret_arr;
34510 }
34511
34512 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_write"))) TS_GossipTimestampFilter_write(uint64_t obj) {
34513         LDKGossipTimestampFilter obj_conv;
34514         obj_conv.inner = untag_ptr(obj);
34515         obj_conv.is_owned = ptr_is_owned(obj);
34516         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
34517         obj_conv.is_owned = false;
34518         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
34519         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
34520         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
34521         CVec_u8Z_free(ret_var);
34522         return ret_arr;
34523 }
34524
34525 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_read"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
34526         LDKu8slice ser_ref;
34527         ser_ref.datalen = ser->arr_len;
34528         ser_ref.data = ser->elems;
34529         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
34530         *ret_conv = GossipTimestampFilter_read(ser_ref);
34531         FREE(ser);
34532         return tag_ptr(ret_conv, true);
34533 }
34534
34535 void  __attribute__((export_name("TS_CustomMessageHandler_free"))) TS_CustomMessageHandler_free(uint64_t this_ptr) {
34536         if (!ptr_is_owned(this_ptr)) return;
34537         void* this_ptr_ptr = untag_ptr(this_ptr);
34538         CHECK_ACCESS(this_ptr_ptr);
34539         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
34540         FREE(untag_ptr(this_ptr));
34541         CustomMessageHandler_free(this_ptr_conv);
34542 }
34543
34544 void  __attribute__((export_name("TS_IgnoringMessageHandler_free"))) TS_IgnoringMessageHandler_free(uint64_t this_obj) {
34545         LDKIgnoringMessageHandler this_obj_conv;
34546         this_obj_conv.inner = untag_ptr(this_obj);
34547         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34549         IgnoringMessageHandler_free(this_obj_conv);
34550 }
34551
34552 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_new"))) TS_IgnoringMessageHandler_new() {
34553         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
34554         uint64_t ret_ref = 0;
34555         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34556         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34557         return ret_ref;
34558 }
34559
34560 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_MessageSendEventsProvider"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
34561         LDKIgnoringMessageHandler this_arg_conv;
34562         this_arg_conv.inner = untag_ptr(this_arg);
34563         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34565         this_arg_conv.is_owned = false;
34566         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
34567         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
34568         return tag_ptr(ret_ret, true);
34569 }
34570
34571 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_RoutingMessageHandler"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint64_t this_arg) {
34572         LDKIgnoringMessageHandler this_arg_conv;
34573         this_arg_conv.inner = untag_ptr(this_arg);
34574         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34576         this_arg_conv.is_owned = false;
34577         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
34578         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
34579         return tag_ptr(ret_ret, true);
34580 }
34581
34582 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageProvider"))) TS_IgnoringMessageHandler_as_OnionMessageProvider(uint64_t this_arg) {
34583         LDKIgnoringMessageHandler this_arg_conv;
34584         this_arg_conv.inner = untag_ptr(this_arg);
34585         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34587         this_arg_conv.is_owned = false;
34588         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
34589         *ret_ret = IgnoringMessageHandler_as_OnionMessageProvider(&this_arg_conv);
34590         return tag_ptr(ret_ret, true);
34591 }
34592
34593 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageHandler"))) TS_IgnoringMessageHandler_as_OnionMessageHandler(uint64_t this_arg) {
34594         LDKIgnoringMessageHandler this_arg_conv;
34595         this_arg_conv.inner = untag_ptr(this_arg);
34596         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34598         this_arg_conv.is_owned = false;
34599         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
34600         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
34601         return tag_ptr(ret_ret, true);
34602 }
34603
34604 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageReader"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint64_t this_arg) {
34605         LDKIgnoringMessageHandler this_arg_conv;
34606         this_arg_conv.inner = untag_ptr(this_arg);
34607         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34609         this_arg_conv.is_owned = false;
34610         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
34611         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
34612         return tag_ptr(ret_ret, true);
34613 }
34614
34615 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageHandler"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint64_t this_arg) {
34616         LDKIgnoringMessageHandler this_arg_conv;
34617         this_arg_conv.inner = untag_ptr(this_arg);
34618         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34620         this_arg_conv.is_owned = false;
34621         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
34622         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
34623         return tag_ptr(ret_ret, true);
34624 }
34625
34626 void  __attribute__((export_name("TS_ErroringMessageHandler_free"))) TS_ErroringMessageHandler_free(uint64_t this_obj) {
34627         LDKErroringMessageHandler this_obj_conv;
34628         this_obj_conv.inner = untag_ptr(this_obj);
34629         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34631         ErroringMessageHandler_free(this_obj_conv);
34632 }
34633
34634 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_new"))) TS_ErroringMessageHandler_new() {
34635         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
34636         uint64_t ret_ref = 0;
34637         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34638         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34639         return ret_ref;
34640 }
34641
34642 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_MessageSendEventsProvider"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
34643         LDKErroringMessageHandler this_arg_conv;
34644         this_arg_conv.inner = untag_ptr(this_arg);
34645         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34647         this_arg_conv.is_owned = false;
34648         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
34649         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
34650         return tag_ptr(ret_ret, true);
34651 }
34652
34653 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_ChannelMessageHandler"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint64_t this_arg) {
34654         LDKErroringMessageHandler this_arg_conv;
34655         this_arg_conv.inner = untag_ptr(this_arg);
34656         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34658         this_arg_conv.is_owned = false;
34659         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
34660         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
34661         return tag_ptr(ret_ret, true);
34662 }
34663
34664 void  __attribute__((export_name("TS_MessageHandler_free"))) TS_MessageHandler_free(uint64_t this_obj) {
34665         LDKMessageHandler this_obj_conv;
34666         this_obj_conv.inner = untag_ptr(this_obj);
34667         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34669         MessageHandler_free(this_obj_conv);
34670 }
34671
34672 uint64_t  __attribute__((export_name("TS_MessageHandler_get_chan_handler"))) TS_MessageHandler_get_chan_handler(uint64_t this_ptr) {
34673         LDKMessageHandler this_ptr_conv;
34674         this_ptr_conv.inner = untag_ptr(this_ptr);
34675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34677         this_ptr_conv.is_owned = false;
34678         // WARNING: This object doesn't live past this scope, needs clone!
34679         uint64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
34680         return ret_ret;
34681 }
34682
34683 void  __attribute__((export_name("TS_MessageHandler_set_chan_handler"))) TS_MessageHandler_set_chan_handler(uint64_t this_ptr, uint64_t val) {
34684         LDKMessageHandler this_ptr_conv;
34685         this_ptr_conv.inner = untag_ptr(this_ptr);
34686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34688         this_ptr_conv.is_owned = false;
34689         void* val_ptr = untag_ptr(val);
34690         CHECK_ACCESS(val_ptr);
34691         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
34692         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
34693                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34694                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
34695         }
34696         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
34697 }
34698
34699 uint64_t  __attribute__((export_name("TS_MessageHandler_get_route_handler"))) TS_MessageHandler_get_route_handler(uint64_t this_ptr) {
34700         LDKMessageHandler this_ptr_conv;
34701         this_ptr_conv.inner = untag_ptr(this_ptr);
34702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34704         this_ptr_conv.is_owned = false;
34705         // WARNING: This object doesn't live past this scope, needs clone!
34706         uint64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
34707         return ret_ret;
34708 }
34709
34710 void  __attribute__((export_name("TS_MessageHandler_set_route_handler"))) TS_MessageHandler_set_route_handler(uint64_t this_ptr, uint64_t val) {
34711         LDKMessageHandler this_ptr_conv;
34712         this_ptr_conv.inner = untag_ptr(this_ptr);
34713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34715         this_ptr_conv.is_owned = false;
34716         void* val_ptr = untag_ptr(val);
34717         CHECK_ACCESS(val_ptr);
34718         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
34719         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
34720                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34721                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
34722         }
34723         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
34724 }
34725
34726 uint64_t  __attribute__((export_name("TS_MessageHandler_get_onion_message_handler"))) TS_MessageHandler_get_onion_message_handler(uint64_t this_ptr) {
34727         LDKMessageHandler this_ptr_conv;
34728         this_ptr_conv.inner = untag_ptr(this_ptr);
34729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34731         this_ptr_conv.is_owned = false;
34732         // WARNING: This object doesn't live past this scope, needs clone!
34733         uint64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
34734         return ret_ret;
34735 }
34736
34737 void  __attribute__((export_name("TS_MessageHandler_set_onion_message_handler"))) TS_MessageHandler_set_onion_message_handler(uint64_t this_ptr, uint64_t val) {
34738         LDKMessageHandler this_ptr_conv;
34739         this_ptr_conv.inner = untag_ptr(this_ptr);
34740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34742         this_ptr_conv.is_owned = false;
34743         void* val_ptr = untag_ptr(val);
34744         CHECK_ACCESS(val_ptr);
34745         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
34746         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
34747                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34748                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
34749         }
34750         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
34751 }
34752
34753 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) {
34754         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
34755         CHECK_ACCESS(chan_handler_arg_ptr);
34756         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
34757         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
34758                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34759                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
34760         }
34761         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
34762         CHECK_ACCESS(route_handler_arg_ptr);
34763         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
34764         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
34765                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34766                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
34767         }
34768         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
34769         CHECK_ACCESS(onion_message_handler_arg_ptr);
34770         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
34771         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
34772                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34773                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
34774         }
34775         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv);
34776         uint64_t ret_ref = 0;
34777         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34778         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34779         return ret_ref;
34780 }
34781
34782 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
34783         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
34784         *ret_ret = SocketDescriptor_clone(arg);
34785         return tag_ptr(ret_ret, true);
34786 }
34787 int64_t  __attribute__((export_name("TS_SocketDescriptor_clone_ptr"))) TS_SocketDescriptor_clone_ptr(uint64_t arg) {
34788         void* arg_ptr = untag_ptr(arg);
34789         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
34790         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
34791         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
34792         return ret_conv;
34793 }
34794
34795 uint64_t  __attribute__((export_name("TS_SocketDescriptor_clone"))) TS_SocketDescriptor_clone(uint64_t orig) {
34796         void* orig_ptr = untag_ptr(orig);
34797         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
34798         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
34799         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
34800         *ret_ret = SocketDescriptor_clone(orig_conv);
34801         return tag_ptr(ret_ret, true);
34802 }
34803
34804 void  __attribute__((export_name("TS_SocketDescriptor_free"))) TS_SocketDescriptor_free(uint64_t this_ptr) {
34805         if (!ptr_is_owned(this_ptr)) return;
34806         void* this_ptr_ptr = untag_ptr(this_ptr);
34807         CHECK_ACCESS(this_ptr_ptr);
34808         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
34809         FREE(untag_ptr(this_ptr));
34810         SocketDescriptor_free(this_ptr_conv);
34811 }
34812
34813 void  __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError_free(uint64_t this_obj) {
34814         LDKPeerHandleError this_obj_conv;
34815         this_obj_conv.inner = untag_ptr(this_obj);
34816         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34818         PeerHandleError_free(this_obj_conv);
34819 }
34820
34821 jboolean  __attribute__((export_name("TS_PeerHandleError_get_no_connection_possible"))) TS_PeerHandleError_get_no_connection_possible(uint64_t this_ptr) {
34822         LDKPeerHandleError this_ptr_conv;
34823         this_ptr_conv.inner = untag_ptr(this_ptr);
34824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34826         this_ptr_conv.is_owned = false;
34827         jboolean ret_conv = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
34828         return ret_conv;
34829 }
34830
34831 void  __attribute__((export_name("TS_PeerHandleError_set_no_connection_possible"))) TS_PeerHandleError_set_no_connection_possible(uint64_t this_ptr, jboolean val) {
34832         LDKPeerHandleError this_ptr_conv;
34833         this_ptr_conv.inner = untag_ptr(this_ptr);
34834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34836         this_ptr_conv.is_owned = false;
34837         PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
34838 }
34839
34840 uint64_t  __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) {
34841         LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
34842         uint64_t ret_ref = 0;
34843         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34844         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34845         return ret_ref;
34846 }
34847
34848 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
34849         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
34850         uint64_t ret_ref = 0;
34851         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34852         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34853         return ret_ref;
34854 }
34855 int64_t  __attribute__((export_name("TS_PeerHandleError_clone_ptr"))) TS_PeerHandleError_clone_ptr(uint64_t arg) {
34856         LDKPeerHandleError arg_conv;
34857         arg_conv.inner = untag_ptr(arg);
34858         arg_conv.is_owned = ptr_is_owned(arg);
34859         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34860         arg_conv.is_owned = false;
34861         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
34862         return ret_conv;
34863 }
34864
34865 uint64_t  __attribute__((export_name("TS_PeerHandleError_clone"))) TS_PeerHandleError_clone(uint64_t orig) {
34866         LDKPeerHandleError orig_conv;
34867         orig_conv.inner = untag_ptr(orig);
34868         orig_conv.is_owned = ptr_is_owned(orig);
34869         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34870         orig_conv.is_owned = false;
34871         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
34872         uint64_t ret_ref = 0;
34873         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34874         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34875         return ret_ref;
34876 }
34877
34878 void  __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(uint64_t this_obj) {
34879         LDKPeerManager this_obj_conv;
34880         this_obj_conv.inner = untag_ptr(this_obj);
34881         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34883         PeerManager_free(this_obj_conv);
34884 }
34885
34886 uint64_t  __attribute__((export_name("TS_PeerManager_new"))) TS_PeerManager_new(uint64_t message_handler, int8_tArray our_node_secret, int64_t current_time, int8_tArray ephemeral_random_data, uint64_t logger, uint64_t custom_message_handler) {
34887         LDKMessageHandler message_handler_conv;
34888         message_handler_conv.inner = untag_ptr(message_handler);
34889         message_handler_conv.is_owned = ptr_is_owned(message_handler);
34890         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
34891         // WARNING: we need a move here but no clone is available for LDKMessageHandler
34892         
34893         LDKSecretKey our_node_secret_ref;
34894         CHECK(our_node_secret->arr_len == 32);
34895         memcpy(our_node_secret_ref.bytes, our_node_secret->elems, 32); FREE(our_node_secret);
34896         unsigned char ephemeral_random_data_arr[32];
34897         CHECK(ephemeral_random_data->arr_len == 32);
34898         memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
34899         unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
34900         void* logger_ptr = untag_ptr(logger);
34901         CHECK_ACCESS(logger_ptr);
34902         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
34903         if (logger_conv.free == LDKLogger_JCalls_free) {
34904                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34905                 LDKLogger_JCalls_cloned(&logger_conv);
34906         }
34907         void* custom_message_handler_ptr = untag_ptr(custom_message_handler);
34908         CHECK_ACCESS(custom_message_handler_ptr);
34909         LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(custom_message_handler_ptr);
34910         if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
34911                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34912                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
34913         }
34914         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, current_time, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
34915         uint64_t ret_ref = 0;
34916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34918         return ret_ref;
34919 }
34920
34921 ptrArray  __attribute__((export_name("TS_PeerManager_get_peer_node_ids"))) TS_PeerManager_get_peer_node_ids(uint64_t this_arg) {
34922         LDKPeerManager this_arg_conv;
34923         this_arg_conv.inner = untag_ptr(this_arg);
34924         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34926         this_arg_conv.is_owned = false;
34927         LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
34928         ptrArray ret_arr = NULL;
34929         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
34930         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
34931         for (size_t m = 0; m < ret_var.datalen; m++) {
34932                 int8_tArray ret_conv_12_arr = init_int8_tArray(33, __LINE__);
34933                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compressed_form, 33);
34934                 ret_arr_ptr[m] = ret_conv_12_arr;
34935         }
34936         
34937         FREE(ret_var.data);
34938         return ret_arr;
34939 }
34940
34941 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) {
34942         LDKPeerManager this_arg_conv;
34943         this_arg_conv.inner = untag_ptr(this_arg);
34944         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34946         this_arg_conv.is_owned = false;
34947         LDKPublicKey their_node_id_ref;
34948         CHECK(their_node_id->arr_len == 33);
34949         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
34950         void* descriptor_ptr = untag_ptr(descriptor);
34951         CHECK_ACCESS(descriptor_ptr);
34952         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
34953         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
34954                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34955                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
34956         }
34957         void* remote_network_address_ptr = untag_ptr(remote_network_address);
34958         CHECK_ACCESS(remote_network_address_ptr);
34959         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
34960         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
34961         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
34962         return tag_ptr(ret_conv, true);
34963 }
34964
34965 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) {
34966         LDKPeerManager this_arg_conv;
34967         this_arg_conv.inner = untag_ptr(this_arg);
34968         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34970         this_arg_conv.is_owned = false;
34971         void* descriptor_ptr = untag_ptr(descriptor);
34972         CHECK_ACCESS(descriptor_ptr);
34973         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
34974         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
34975                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34976                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
34977         }
34978         void* remote_network_address_ptr = untag_ptr(remote_network_address);
34979         CHECK_ACCESS(remote_network_address_ptr);
34980         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
34981         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
34982         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
34983         return tag_ptr(ret_conv, true);
34984 }
34985
34986 uint64_t  __attribute__((export_name("TS_PeerManager_write_buffer_space_avail"))) TS_PeerManager_write_buffer_space_avail(uint64_t this_arg, uint64_t descriptor) {
34987         LDKPeerManager this_arg_conv;
34988         this_arg_conv.inner = untag_ptr(this_arg);
34989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
34990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
34991         this_arg_conv.is_owned = false;
34992         void* descriptor_ptr = untag_ptr(descriptor);
34993         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
34994         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
34995         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
34996         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
34997         return tag_ptr(ret_conv, true);
34998 }
34999
35000 uint64_t  __attribute__((export_name("TS_PeerManager_read_event"))) TS_PeerManager_read_event(uint64_t this_arg, uint64_t peer_descriptor, int8_tArray data) {
35001         LDKPeerManager this_arg_conv;
35002         this_arg_conv.inner = untag_ptr(this_arg);
35003         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35005         this_arg_conv.is_owned = false;
35006         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
35007         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
35008         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
35009         LDKu8slice data_ref;
35010         data_ref.datalen = data->arr_len;
35011         data_ref.data = data->elems;
35012         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
35013         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
35014         FREE(data);
35015         return tag_ptr(ret_conv, true);
35016 }
35017
35018 void  __attribute__((export_name("TS_PeerManager_process_events"))) TS_PeerManager_process_events(uint64_t this_arg) {
35019         LDKPeerManager this_arg_conv;
35020         this_arg_conv.inner = untag_ptr(this_arg);
35021         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35023         this_arg_conv.is_owned = false;
35024         PeerManager_process_events(&this_arg_conv);
35025 }
35026
35027 void  __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_PeerManager_socket_disconnected(uint64_t this_arg, uint64_t descriptor) {
35028         LDKPeerManager this_arg_conv;
35029         this_arg_conv.inner = untag_ptr(this_arg);
35030         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35032         this_arg_conv.is_owned = false;
35033         void* descriptor_ptr = untag_ptr(descriptor);
35034         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
35035         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
35036         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
35037 }
35038
35039 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) {
35040         LDKPeerManager this_arg_conv;
35041         this_arg_conv.inner = untag_ptr(this_arg);
35042         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35044         this_arg_conv.is_owned = false;
35045         LDKPublicKey node_id_ref;
35046         CHECK(node_id->arr_len == 33);
35047         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
35048         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
35049 }
35050
35051 void  __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint64_t this_arg) {
35052         LDKPeerManager this_arg_conv;
35053         this_arg_conv.inner = untag_ptr(this_arg);
35054         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35056         this_arg_conv.is_owned = false;
35057         PeerManager_disconnect_all_peers(&this_arg_conv);
35058 }
35059
35060 void  __attribute__((export_name("TS_PeerManager_timer_tick_occurred"))) TS_PeerManager_timer_tick_occurred(uint64_t this_arg) {
35061         LDKPeerManager this_arg_conv;
35062         this_arg_conv.inner = untag_ptr(this_arg);
35063         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35065         this_arg_conv.is_owned = false;
35066         PeerManager_timer_tick_occurred(&this_arg_conv);
35067 }
35068
35069 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) {
35070         LDKPeerManager this_arg_conv;
35071         this_arg_conv.inner = untag_ptr(this_arg);
35072         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35074         this_arg_conv.is_owned = false;
35075         LDKThreeBytes rgb_ref;
35076         CHECK(rgb->arr_len == 3);
35077         memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
35078         LDKThirtyTwoBytes alias_ref;
35079         CHECK(alias->arr_len == 32);
35080         memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
35081         LDKCVec_NetAddressZ addresses_constr;
35082         addresses_constr.datalen = addresses->arr_len;
35083         if (addresses_constr.datalen > 0)
35084                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
35085         else
35086                 addresses_constr.data = NULL;
35087         uint64_t* addresses_vals = addresses->elems;
35088         for (size_t m = 0; m < addresses_constr.datalen; m++) {
35089                 uint64_t addresses_conv_12 = addresses_vals[m];
35090                 void* addresses_conv_12_ptr = untag_ptr(addresses_conv_12);
35091                 CHECK_ACCESS(addresses_conv_12_ptr);
35092                 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
35093                 addresses_constr.data[m] = addresses_conv_12_conv;
35094         }
35095         FREE(addresses);
35096         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
35097 }
35098
35099 int64_t  __attribute__((export_name("TS_htlc_success_tx_weight"))) TS_htlc_success_tx_weight(jboolean opt_anchors) {
35100         int64_t ret_conv = htlc_success_tx_weight(opt_anchors);
35101         return ret_conv;
35102 }
35103
35104 int64_t  __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeout_tx_weight(jboolean opt_anchors) {
35105         int64_t ret_conv = htlc_timeout_tx_weight(opt_anchors);
35106         return ret_conv;
35107 }
35108
35109 int8_tArray  __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
35110         unsigned char commitment_seed_arr[32];
35111         CHECK(commitment_seed->arr_len == 32);
35112         memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
35113         unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
35114         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35115         memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
35116         return ret_arr;
35117 }
35118
35119 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) {
35120         LDKCVec_u8Z to_holder_script_ref;
35121         to_holder_script_ref.datalen = to_holder_script->arr_len;
35122         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
35123         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
35124         LDKCVec_u8Z to_counterparty_script_ref;
35125         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
35126         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
35127         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
35128         LDKOutPoint funding_outpoint_conv;
35129         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
35130         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
35131         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
35132         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
35133         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);
35134         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35135         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35136         Transaction_free(ret_var);
35137         return ret_arr;
35138 }
35139
35140 void  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_free"))) TS_CounterpartyCommitmentSecrets_free(uint64_t this_obj) {
35141         LDKCounterpartyCommitmentSecrets this_obj_conv;
35142         this_obj_conv.inner = untag_ptr(this_obj);
35143         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35145         CounterpartyCommitmentSecrets_free(this_obj_conv);
35146 }
35147
35148 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
35149         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
35150         uint64_t ret_ref = 0;
35151         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35152         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35153         return ret_ref;
35154 }
35155 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone_ptr"))) TS_CounterpartyCommitmentSecrets_clone_ptr(uint64_t arg) {
35156         LDKCounterpartyCommitmentSecrets arg_conv;
35157         arg_conv.inner = untag_ptr(arg);
35158         arg_conv.is_owned = ptr_is_owned(arg);
35159         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35160         arg_conv.is_owned = false;
35161         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
35162         return ret_conv;
35163 }
35164
35165 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone"))) TS_CounterpartyCommitmentSecrets_clone(uint64_t orig) {
35166         LDKCounterpartyCommitmentSecrets orig_conv;
35167         orig_conv.inner = untag_ptr(orig);
35168         orig_conv.is_owned = ptr_is_owned(orig);
35169         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35170         orig_conv.is_owned = false;
35171         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
35172         uint64_t ret_ref = 0;
35173         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35174         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35175         return ret_ref;
35176 }
35177
35178 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_new"))) TS_CounterpartyCommitmentSecrets_new() {
35179         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
35180         uint64_t ret_ref = 0;
35181         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35182         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35183         return ret_ref;
35184 }
35185
35186 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_min_seen_secret"))) TS_CounterpartyCommitmentSecrets_get_min_seen_secret(uint64_t this_arg) {
35187         LDKCounterpartyCommitmentSecrets this_arg_conv;
35188         this_arg_conv.inner = untag_ptr(this_arg);
35189         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35191         this_arg_conv.is_owned = false;
35192         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
35193         return ret_conv;
35194 }
35195
35196 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_provide_secret"))) TS_CounterpartyCommitmentSecrets_provide_secret(uint64_t this_arg, int64_t idx, int8_tArray secret) {
35197         LDKCounterpartyCommitmentSecrets this_arg_conv;
35198         this_arg_conv.inner = untag_ptr(this_arg);
35199         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35201         this_arg_conv.is_owned = false;
35202         LDKThirtyTwoBytes secret_ref;
35203         CHECK(secret->arr_len == 32);
35204         memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
35205         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
35206         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
35207         return tag_ptr(ret_conv, true);
35208 }
35209
35210 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_secret"))) TS_CounterpartyCommitmentSecrets_get_secret(uint64_t this_arg, int64_t idx) {
35211         LDKCounterpartyCommitmentSecrets this_arg_conv;
35212         this_arg_conv.inner = untag_ptr(this_arg);
35213         this_arg_conv.is_owned = ptr_is_owned(this_arg);
35214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
35215         this_arg_conv.is_owned = false;
35216         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35217         memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
35218         return ret_arr;
35219 }
35220
35221 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_write"))) TS_CounterpartyCommitmentSecrets_write(uint64_t obj) {
35222         LDKCounterpartyCommitmentSecrets obj_conv;
35223         obj_conv.inner = untag_ptr(obj);
35224         obj_conv.is_owned = ptr_is_owned(obj);
35225         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35226         obj_conv.is_owned = false;
35227         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
35228         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35229         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35230         CVec_u8Z_free(ret_var);
35231         return ret_arr;
35232 }
35233
35234 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_read"))) TS_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
35235         LDKu8slice ser_ref;
35236         ser_ref.datalen = ser->arr_len;
35237         ser_ref.data = ser->elems;
35238         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
35239         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
35240         FREE(ser);
35241         return tag_ptr(ret_conv, true);
35242 }
35243
35244 uint64_t  __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
35245         LDKPublicKey per_commitment_point_ref;
35246         CHECK(per_commitment_point->arr_len == 33);
35247         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
35248         unsigned char base_secret_arr[32];
35249         CHECK(base_secret->arr_len == 32);
35250         memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
35251         unsigned char (*base_secret_ref)[32] = &base_secret_arr;
35252         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
35253         *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
35254         return tag_ptr(ret_conv, true);
35255 }
35256
35257 uint64_t  __attribute__((export_name("TS_derive_public_key"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
35258         LDKPublicKey per_commitment_point_ref;
35259         CHECK(per_commitment_point->arr_len == 33);
35260         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
35261         LDKPublicKey base_point_ref;
35262         CHECK(base_point->arr_len == 33);
35263         memcpy(base_point_ref.compressed_form, base_point->elems, 33); FREE(base_point);
35264         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
35265         *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
35266         return tag_ptr(ret_conv, true);
35267 }
35268
35269 uint64_t  __attribute__((export_name("TS_derive_private_revocation_key"))) TS_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
35270         unsigned char per_commitment_secret_arr[32];
35271         CHECK(per_commitment_secret->arr_len == 32);
35272         memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
35273         unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
35274         unsigned char countersignatory_revocation_base_secret_arr[32];
35275         CHECK(countersignatory_revocation_base_secret->arr_len == 32);
35276         memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
35277         unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
35278         LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
35279         *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
35280         return tag_ptr(ret_conv, true);
35281 }
35282
35283 uint64_t  __attribute__((export_name("TS_derive_public_revocation_key"))) TS_derive_public_revocation_key(int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
35284         LDKPublicKey per_commitment_point_ref;
35285         CHECK(per_commitment_point->arr_len == 33);
35286         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
35287         LDKPublicKey countersignatory_revocation_base_point_ref;
35288         CHECK(countersignatory_revocation_base_point->arr_len == 33);
35289         memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point->elems, 33); FREE(countersignatory_revocation_base_point);
35290         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
35291         *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
35292         return tag_ptr(ret_conv, true);
35293 }
35294
35295 void  __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint64_t this_obj) {
35296         LDKTxCreationKeys this_obj_conv;
35297         this_obj_conv.inner = untag_ptr(this_obj);
35298         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35300         TxCreationKeys_free(this_obj_conv);
35301 }
35302
35303 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_per_commitment_point"))) TS_TxCreationKeys_get_per_commitment_point(uint64_t this_ptr) {
35304         LDKTxCreationKeys this_ptr_conv;
35305         this_ptr_conv.inner = untag_ptr(this_ptr);
35306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35308         this_ptr_conv.is_owned = false;
35309         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35310         memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
35311         return ret_arr;
35312 }
35313
35314 void  __attribute__((export_name("TS_TxCreationKeys_set_per_commitment_point"))) TS_TxCreationKeys_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
35315         LDKTxCreationKeys this_ptr_conv;
35316         this_ptr_conv.inner = untag_ptr(this_ptr);
35317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35319         this_ptr_conv.is_owned = false;
35320         LDKPublicKey val_ref;
35321         CHECK(val->arr_len == 33);
35322         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35323         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
35324 }
35325
35326 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_revocation_key"))) TS_TxCreationKeys_get_revocation_key(uint64_t this_ptr) {
35327         LDKTxCreationKeys this_ptr_conv;
35328         this_ptr_conv.inner = untag_ptr(this_ptr);
35329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35331         this_ptr_conv.is_owned = false;
35332         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35333         memcpy(ret_arr->elems, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
35334         return ret_arr;
35335 }
35336
35337 void  __attribute__((export_name("TS_TxCreationKeys_set_revocation_key"))) TS_TxCreationKeys_set_revocation_key(uint64_t this_ptr, int8_tArray val) {
35338         LDKTxCreationKeys this_ptr_conv;
35339         this_ptr_conv.inner = untag_ptr(this_ptr);
35340         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35342         this_ptr_conv.is_owned = false;
35343         LDKPublicKey val_ref;
35344         CHECK(val->arr_len == 33);
35345         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35346         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
35347 }
35348
35349 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_htlc_key"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint64_t this_ptr) {
35350         LDKTxCreationKeys this_ptr_conv;
35351         this_ptr_conv.inner = untag_ptr(this_ptr);
35352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35354         this_ptr_conv.is_owned = false;
35355         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35356         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
35357         return ret_arr;
35358 }
35359
35360 void  __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_htlc_key"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint64_t this_ptr, int8_tArray val) {
35361         LDKTxCreationKeys this_ptr_conv;
35362         this_ptr_conv.inner = untag_ptr(this_ptr);
35363         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35365         this_ptr_conv.is_owned = false;
35366         LDKPublicKey val_ref;
35367         CHECK(val->arr_len == 33);
35368         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35369         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
35370 }
35371
35372 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_countersignatory_htlc_key"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint64_t this_ptr) {
35373         LDKTxCreationKeys this_ptr_conv;
35374         this_ptr_conv.inner = untag_ptr(this_ptr);
35375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35377         this_ptr_conv.is_owned = false;
35378         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35379         memcpy(ret_arr->elems, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
35380         return ret_arr;
35381 }
35382
35383 void  __attribute__((export_name("TS_TxCreationKeys_set_countersignatory_htlc_key"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint64_t this_ptr, int8_tArray val) {
35384         LDKTxCreationKeys this_ptr_conv;
35385         this_ptr_conv.inner = untag_ptr(this_ptr);
35386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35388         this_ptr_conv.is_owned = false;
35389         LDKPublicKey val_ref;
35390         CHECK(val->arr_len == 33);
35391         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35392         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
35393 }
35394
35395 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint64_t this_ptr) {
35396         LDKTxCreationKeys this_ptr_conv;
35397         this_ptr_conv.inner = untag_ptr(this_ptr);
35398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35400         this_ptr_conv.is_owned = false;
35401         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35402         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
35403         return ret_arr;
35404 }
35405
35406 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) {
35407         LDKTxCreationKeys this_ptr_conv;
35408         this_ptr_conv.inner = untag_ptr(this_ptr);
35409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35411         this_ptr_conv.is_owned = false;
35412         LDKPublicKey val_ref;
35413         CHECK(val->arr_len == 33);
35414         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35415         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
35416 }
35417
35418 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) {
35419         LDKPublicKey per_commitment_point_arg_ref;
35420         CHECK(per_commitment_point_arg->arr_len == 33);
35421         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
35422         LDKPublicKey revocation_key_arg_ref;
35423         CHECK(revocation_key_arg->arr_len == 33);
35424         memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg->elems, 33); FREE(revocation_key_arg);
35425         LDKPublicKey broadcaster_htlc_key_arg_ref;
35426         CHECK(broadcaster_htlc_key_arg->arr_len == 33);
35427         memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg->elems, 33); FREE(broadcaster_htlc_key_arg);
35428         LDKPublicKey countersignatory_htlc_key_arg_ref;
35429         CHECK(countersignatory_htlc_key_arg->arr_len == 33);
35430         memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg->elems, 33); FREE(countersignatory_htlc_key_arg);
35431         LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
35432         CHECK(broadcaster_delayed_payment_key_arg->arr_len == 33);
35433         memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg->elems, 33); FREE(broadcaster_delayed_payment_key_arg);
35434         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);
35435         uint64_t ret_ref = 0;
35436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35438         return ret_ref;
35439 }
35440
35441 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
35442         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
35443         uint64_t ret_ref = 0;
35444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35446         return ret_ref;
35447 }
35448 int64_t  __attribute__((export_name("TS_TxCreationKeys_clone_ptr"))) TS_TxCreationKeys_clone_ptr(uint64_t arg) {
35449         LDKTxCreationKeys arg_conv;
35450         arg_conv.inner = untag_ptr(arg);
35451         arg_conv.is_owned = ptr_is_owned(arg);
35452         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35453         arg_conv.is_owned = false;
35454         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
35455         return ret_conv;
35456 }
35457
35458 uint64_t  __attribute__((export_name("TS_TxCreationKeys_clone"))) TS_TxCreationKeys_clone(uint64_t orig) {
35459         LDKTxCreationKeys orig_conv;
35460         orig_conv.inner = untag_ptr(orig);
35461         orig_conv.is_owned = ptr_is_owned(orig);
35462         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35463         orig_conv.is_owned = false;
35464         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
35465         uint64_t ret_ref = 0;
35466         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35467         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35468         return ret_ref;
35469 }
35470
35471 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_write"))) TS_TxCreationKeys_write(uint64_t obj) {
35472         LDKTxCreationKeys obj_conv;
35473         obj_conv.inner = untag_ptr(obj);
35474         obj_conv.is_owned = ptr_is_owned(obj);
35475         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35476         obj_conv.is_owned = false;
35477         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
35478         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35479         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35480         CVec_u8Z_free(ret_var);
35481         return ret_arr;
35482 }
35483
35484 uint64_t  __attribute__((export_name("TS_TxCreationKeys_read"))) TS_TxCreationKeys_read(int8_tArray ser) {
35485         LDKu8slice ser_ref;
35486         ser_ref.datalen = ser->arr_len;
35487         ser_ref.data = ser->elems;
35488         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
35489         *ret_conv = TxCreationKeys_read(ser_ref);
35490         FREE(ser);
35491         return tag_ptr(ret_conv, true);
35492 }
35493
35494 void  __attribute__((export_name("TS_ChannelPublicKeys_free"))) TS_ChannelPublicKeys_free(uint64_t this_obj) {
35495         LDKChannelPublicKeys this_obj_conv;
35496         this_obj_conv.inner = untag_ptr(this_obj);
35497         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35499         ChannelPublicKeys_free(this_obj_conv);
35500 }
35501
35502 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_funding_pubkey"))) TS_ChannelPublicKeys_get_funding_pubkey(uint64_t this_ptr) {
35503         LDKChannelPublicKeys this_ptr_conv;
35504         this_ptr_conv.inner = untag_ptr(this_ptr);
35505         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35507         this_ptr_conv.is_owned = false;
35508         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35509         memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
35510         return ret_arr;
35511 }
35512
35513 void  __attribute__((export_name("TS_ChannelPublicKeys_set_funding_pubkey"))) TS_ChannelPublicKeys_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
35514         LDKChannelPublicKeys this_ptr_conv;
35515         this_ptr_conv.inner = untag_ptr(this_ptr);
35516         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35518         this_ptr_conv.is_owned = false;
35519         LDKPublicKey val_ref;
35520         CHECK(val->arr_len == 33);
35521         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35522         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
35523 }
35524
35525 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_revocation_basepoint"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint64_t this_ptr) {
35526         LDKChannelPublicKeys this_ptr_conv;
35527         this_ptr_conv.inner = untag_ptr(this_ptr);
35528         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35530         this_ptr_conv.is_owned = false;
35531         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35532         memcpy(ret_arr->elems, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
35533         return ret_arr;
35534 }
35535
35536 void  __attribute__((export_name("TS_ChannelPublicKeys_set_revocation_basepoint"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
35537         LDKChannelPublicKeys this_ptr_conv;
35538         this_ptr_conv.inner = untag_ptr(this_ptr);
35539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35541         this_ptr_conv.is_owned = false;
35542         LDKPublicKey val_ref;
35543         CHECK(val->arr_len == 33);
35544         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35545         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
35546 }
35547
35548 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_payment_point"))) TS_ChannelPublicKeys_get_payment_point(uint64_t this_ptr) {
35549         LDKChannelPublicKeys this_ptr_conv;
35550         this_ptr_conv.inner = untag_ptr(this_ptr);
35551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35553         this_ptr_conv.is_owned = false;
35554         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35555         memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
35556         return ret_arr;
35557 }
35558
35559 void  __attribute__((export_name("TS_ChannelPublicKeys_set_payment_point"))) TS_ChannelPublicKeys_set_payment_point(uint64_t this_ptr, int8_tArray val) {
35560         LDKChannelPublicKeys this_ptr_conv;
35561         this_ptr_conv.inner = untag_ptr(this_ptr);
35562         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35564         this_ptr_conv.is_owned = false;
35565         LDKPublicKey val_ref;
35566         CHECK(val->arr_len == 33);
35567         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35568         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
35569 }
35570
35571 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_delayed_payment_basepoint"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint64_t this_ptr) {
35572         LDKChannelPublicKeys this_ptr_conv;
35573         this_ptr_conv.inner = untag_ptr(this_ptr);
35574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35576         this_ptr_conv.is_owned = false;
35577         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35578         memcpy(ret_arr->elems, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
35579         return ret_arr;
35580 }
35581
35582 void  __attribute__((export_name("TS_ChannelPublicKeys_set_delayed_payment_basepoint"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
35583         LDKChannelPublicKeys this_ptr_conv;
35584         this_ptr_conv.inner = untag_ptr(this_ptr);
35585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35587         this_ptr_conv.is_owned = false;
35588         LDKPublicKey val_ref;
35589         CHECK(val->arr_len == 33);
35590         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35591         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
35592 }
35593
35594 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_htlc_basepoint"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint64_t this_ptr) {
35595         LDKChannelPublicKeys this_ptr_conv;
35596         this_ptr_conv.inner = untag_ptr(this_ptr);
35597         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35599         this_ptr_conv.is_owned = false;
35600         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35601         memcpy(ret_arr->elems, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
35602         return ret_arr;
35603 }
35604
35605 void  __attribute__((export_name("TS_ChannelPublicKeys_set_htlc_basepoint"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
35606         LDKChannelPublicKeys this_ptr_conv;
35607         this_ptr_conv.inner = untag_ptr(this_ptr);
35608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35610         this_ptr_conv.is_owned = false;
35611         LDKPublicKey val_ref;
35612         CHECK(val->arr_len == 33);
35613         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35614         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
35615 }
35616
35617 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) {
35618         LDKPublicKey funding_pubkey_arg_ref;
35619         CHECK(funding_pubkey_arg->arr_len == 33);
35620         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
35621         LDKPublicKey revocation_basepoint_arg_ref;
35622         CHECK(revocation_basepoint_arg->arr_len == 33);
35623         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
35624         LDKPublicKey payment_point_arg_ref;
35625         CHECK(payment_point_arg->arr_len == 33);
35626         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
35627         LDKPublicKey delayed_payment_basepoint_arg_ref;
35628         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
35629         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
35630         LDKPublicKey htlc_basepoint_arg_ref;
35631         CHECK(htlc_basepoint_arg->arr_len == 33);
35632         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
35633         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);
35634         uint64_t ret_ref = 0;
35635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35636         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35637         return ret_ref;
35638 }
35639
35640 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
35641         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
35642         uint64_t ret_ref = 0;
35643         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35644         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35645         return ret_ref;
35646 }
35647 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone_ptr"))) TS_ChannelPublicKeys_clone_ptr(uint64_t arg) {
35648         LDKChannelPublicKeys arg_conv;
35649         arg_conv.inner = untag_ptr(arg);
35650         arg_conv.is_owned = ptr_is_owned(arg);
35651         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35652         arg_conv.is_owned = false;
35653         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
35654         return ret_conv;
35655 }
35656
35657 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone"))) TS_ChannelPublicKeys_clone(uint64_t orig) {
35658         LDKChannelPublicKeys orig_conv;
35659         orig_conv.inner = untag_ptr(orig);
35660         orig_conv.is_owned = ptr_is_owned(orig);
35661         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35662         orig_conv.is_owned = false;
35663         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
35664         uint64_t ret_ref = 0;
35665         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35666         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35667         return ret_ref;
35668 }
35669
35670 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_write"))) TS_ChannelPublicKeys_write(uint64_t obj) {
35671         LDKChannelPublicKeys obj_conv;
35672         obj_conv.inner = untag_ptr(obj);
35673         obj_conv.is_owned = ptr_is_owned(obj);
35674         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35675         obj_conv.is_owned = false;
35676         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
35677         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35678         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35679         CVec_u8Z_free(ret_var);
35680         return ret_arr;
35681 }
35682
35683 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_read"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
35684         LDKu8slice ser_ref;
35685         ser_ref.datalen = ser->arr_len;
35686         ser_ref.data = ser->elems;
35687         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
35688         *ret_conv = ChannelPublicKeys_read(ser_ref);
35689         FREE(ser);
35690         return tag_ptr(ret_conv, true);
35691 }
35692
35693 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) {
35694         LDKPublicKey per_commitment_point_ref;
35695         CHECK(per_commitment_point->arr_len == 33);
35696         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
35697         LDKPublicKey broadcaster_delayed_payment_base_ref;
35698         CHECK(broadcaster_delayed_payment_base->arr_len == 33);
35699         memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base->elems, 33); FREE(broadcaster_delayed_payment_base);
35700         LDKPublicKey broadcaster_htlc_base_ref;
35701         CHECK(broadcaster_htlc_base->arr_len == 33);
35702         memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base->elems, 33); FREE(broadcaster_htlc_base);
35703         LDKPublicKey countersignatory_revocation_base_ref;
35704         CHECK(countersignatory_revocation_base->arr_len == 33);
35705         memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base->elems, 33); FREE(countersignatory_revocation_base);
35706         LDKPublicKey countersignatory_htlc_base_ref;
35707         CHECK(countersignatory_htlc_base->arr_len == 33);
35708         memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base->elems, 33); FREE(countersignatory_htlc_base);
35709         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
35710         *ret_conv = TxCreationKeys_derive_new(per_commitment_point_ref, broadcaster_delayed_payment_base_ref, broadcaster_htlc_base_ref, countersignatory_revocation_base_ref, countersignatory_htlc_base_ref);
35711         return tag_ptr(ret_conv, true);
35712 }
35713
35714 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) {
35715         LDKPublicKey per_commitment_point_ref;
35716         CHECK(per_commitment_point->arr_len == 33);
35717         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
35718         LDKChannelPublicKeys broadcaster_keys_conv;
35719         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
35720         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
35721         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
35722         broadcaster_keys_conv.is_owned = false;
35723         LDKChannelPublicKeys countersignatory_keys_conv;
35724         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
35725         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
35726         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
35727         countersignatory_keys_conv.is_owned = false;
35728         LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
35729         *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
35730         return tag_ptr(ret_conv, true);
35731 }
35732
35733 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) {
35734         LDKPublicKey revocation_key_ref;
35735         CHECK(revocation_key->arr_len == 33);
35736         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
35737         LDKPublicKey broadcaster_delayed_payment_key_ref;
35738         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
35739         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
35740         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
35741         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35742         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35743         CVec_u8Z_free(ret_var);
35744         return ret_arr;
35745 }
35746
35747 void  __attribute__((export_name("TS_HTLCOutputInCommitment_free"))) TS_HTLCOutputInCommitment_free(uint64_t this_obj) {
35748         LDKHTLCOutputInCommitment this_obj_conv;
35749         this_obj_conv.inner = untag_ptr(this_obj);
35750         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35752         HTLCOutputInCommitment_free(this_obj_conv);
35753 }
35754
35755 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_get_offered"))) TS_HTLCOutputInCommitment_get_offered(uint64_t this_ptr) {
35756         LDKHTLCOutputInCommitment this_ptr_conv;
35757         this_ptr_conv.inner = untag_ptr(this_ptr);
35758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35760         this_ptr_conv.is_owned = false;
35761         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
35762         return ret_conv;
35763 }
35764
35765 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_offered"))) TS_HTLCOutputInCommitment_set_offered(uint64_t this_ptr, jboolean val) {
35766         LDKHTLCOutputInCommitment this_ptr_conv;
35767         this_ptr_conv.inner = untag_ptr(this_ptr);
35768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35770         this_ptr_conv.is_owned = false;
35771         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
35772 }
35773
35774 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_amount_msat"))) TS_HTLCOutputInCommitment_get_amount_msat(uint64_t this_ptr) {
35775         LDKHTLCOutputInCommitment this_ptr_conv;
35776         this_ptr_conv.inner = untag_ptr(this_ptr);
35777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35779         this_ptr_conv.is_owned = false;
35780         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
35781         return ret_conv;
35782 }
35783
35784 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_amount_msat"))) TS_HTLCOutputInCommitment_set_amount_msat(uint64_t this_ptr, int64_t val) {
35785         LDKHTLCOutputInCommitment this_ptr_conv;
35786         this_ptr_conv.inner = untag_ptr(this_ptr);
35787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35789         this_ptr_conv.is_owned = false;
35790         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
35791 }
35792
35793 int32_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_cltv_expiry"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint64_t this_ptr) {
35794         LDKHTLCOutputInCommitment this_ptr_conv;
35795         this_ptr_conv.inner = untag_ptr(this_ptr);
35796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35798         this_ptr_conv.is_owned = false;
35799         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
35800         return ret_conv;
35801 }
35802
35803 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_cltv_expiry"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
35804         LDKHTLCOutputInCommitment this_ptr_conv;
35805         this_ptr_conv.inner = untag_ptr(this_ptr);
35806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35808         this_ptr_conv.is_owned = false;
35809         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
35810 }
35811
35812 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_get_payment_hash"))) TS_HTLCOutputInCommitment_get_payment_hash(uint64_t this_ptr) {
35813         LDKHTLCOutputInCommitment this_ptr_conv;
35814         this_ptr_conv.inner = untag_ptr(this_ptr);
35815         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35817         this_ptr_conv.is_owned = false;
35818         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35819         memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
35820         return ret_arr;
35821 }
35822
35823 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_payment_hash"))) TS_HTLCOutputInCommitment_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
35824         LDKHTLCOutputInCommitment this_ptr_conv;
35825         this_ptr_conv.inner = untag_ptr(this_ptr);
35826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35828         this_ptr_conv.is_owned = false;
35829         LDKThirtyTwoBytes val_ref;
35830         CHECK(val->arr_len == 32);
35831         memcpy(val_ref.data, val->elems, 32); FREE(val);
35832         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
35833 }
35834
35835 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_transaction_output_index"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint64_t this_ptr) {
35836         LDKHTLCOutputInCommitment this_ptr_conv;
35837         this_ptr_conv.inner = untag_ptr(this_ptr);
35838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35840         this_ptr_conv.is_owned = false;
35841         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
35842         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
35843         uint64_t ret_ref = tag_ptr(ret_copy, true);
35844         return ret_ref;
35845 }
35846
35847 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_transaction_output_index"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint64_t this_ptr, uint64_t val) {
35848         LDKHTLCOutputInCommitment this_ptr_conv;
35849         this_ptr_conv.inner = untag_ptr(this_ptr);
35850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35852         this_ptr_conv.is_owned = false;
35853         void* val_ptr = untag_ptr(val);
35854         CHECK_ACCESS(val_ptr);
35855         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
35856         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
35857         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
35858 }
35859
35860 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) {
35861         LDKThirtyTwoBytes payment_hash_arg_ref;
35862         CHECK(payment_hash_arg->arr_len == 32);
35863         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
35864         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
35865         CHECK_ACCESS(transaction_output_index_arg_ptr);
35866         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
35867         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
35868         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
35869         uint64_t ret_ref = 0;
35870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35872         return ret_ref;
35873 }
35874
35875 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
35876         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
35877         uint64_t ret_ref = 0;
35878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35880         return ret_ref;
35881 }
35882 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone_ptr"))) TS_HTLCOutputInCommitment_clone_ptr(uint64_t arg) {
35883         LDKHTLCOutputInCommitment arg_conv;
35884         arg_conv.inner = untag_ptr(arg);
35885         arg_conv.is_owned = ptr_is_owned(arg);
35886         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35887         arg_conv.is_owned = false;
35888         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
35889         return ret_conv;
35890 }
35891
35892 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone"))) TS_HTLCOutputInCommitment_clone(uint64_t orig) {
35893         LDKHTLCOutputInCommitment orig_conv;
35894         orig_conv.inner = untag_ptr(orig);
35895         orig_conv.is_owned = ptr_is_owned(orig);
35896         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35897         orig_conv.is_owned = false;
35898         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
35899         uint64_t ret_ref = 0;
35900         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35901         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35902         return ret_ref;
35903 }
35904
35905 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_write"))) TS_HTLCOutputInCommitment_write(uint64_t obj) {
35906         LDKHTLCOutputInCommitment obj_conv;
35907         obj_conv.inner = untag_ptr(obj);
35908         obj_conv.is_owned = ptr_is_owned(obj);
35909         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
35910         obj_conv.is_owned = false;
35911         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
35912         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35913         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35914         CVec_u8Z_free(ret_var);
35915         return ret_arr;
35916 }
35917
35918 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_read"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
35919         LDKu8slice ser_ref;
35920         ser_ref.datalen = ser->arr_len;
35921         ser_ref.data = ser->elems;
35922         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
35923         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
35924         FREE(ser);
35925         return tag_ptr(ret_conv, true);
35926 }
35927
35928 int8_tArray  __attribute__((export_name("TS_get_htlc_redeemscript"))) TS_get_htlc_redeemscript(uint64_t htlc, jboolean opt_anchors, uint64_t keys) {
35929         LDKHTLCOutputInCommitment htlc_conv;
35930         htlc_conv.inner = untag_ptr(htlc);
35931         htlc_conv.is_owned = ptr_is_owned(htlc);
35932         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
35933         htlc_conv.is_owned = false;
35934         LDKTxCreationKeys keys_conv;
35935         keys_conv.inner = untag_ptr(keys);
35936         keys_conv.is_owned = ptr_is_owned(keys);
35937         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
35938         keys_conv.is_owned = false;
35939         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv);
35940         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35941         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35942         CVec_u8Z_free(ret_var);
35943         return ret_arr;
35944 }
35945
35946 int8_tArray  __attribute__((export_name("TS_make_funding_redeemscript"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
35947         LDKPublicKey broadcaster_ref;
35948         CHECK(broadcaster->arr_len == 33);
35949         memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
35950         LDKPublicKey countersignatory_ref;
35951         CHECK(countersignatory->arr_len == 33);
35952         memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
35953         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
35954         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35955         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35956         CVec_u8Z_free(ret_var);
35957         return ret_arr;
35958 }
35959
35960 int8_tArray  __attribute__((export_name("TS_build_htlc_transaction"))) TS_build_htlc_transaction(int8_tArray commitment_txid, int32_t feerate_per_kw, int16_t contest_delay, uint64_t htlc, jboolean opt_anchors, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) {
35961         unsigned char commitment_txid_arr[32];
35962         CHECK(commitment_txid->arr_len == 32);
35963         memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
35964         unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
35965         LDKHTLCOutputInCommitment htlc_conv;
35966         htlc_conv.inner = untag_ptr(htlc);
35967         htlc_conv.is_owned = ptr_is_owned(htlc);
35968         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
35969         htlc_conv.is_owned = false;
35970         LDKPublicKey broadcaster_delayed_payment_key_ref;
35971         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
35972         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
35973         LDKPublicKey revocation_key_ref;
35974         CHECK(revocation_key->arr_len == 33);
35975         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
35976         LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, opt_anchors, broadcaster_delayed_payment_key_ref, revocation_key_ref);
35977         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35978         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35979         Transaction_free(ret_var);
35980         return ret_arr;
35981 }
35982
35983 int8_tArray  __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
35984         LDKPublicKey funding_pubkey_ref;
35985         CHECK(funding_pubkey->arr_len == 33);
35986         memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
35987         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
35988         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
35989         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
35990         CVec_u8Z_free(ret_var);
35991         return ret_arr;
35992 }
35993
35994 void  __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint64_t this_obj) {
35995         LDKChannelTransactionParameters this_obj_conv;
35996         this_obj_conv.inner = untag_ptr(this_obj);
35997         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35999         ChannelTransactionParameters_free(this_obj_conv);
36000 }
36001
36002 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_pubkeys"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint64_t this_ptr) {
36003         LDKChannelTransactionParameters this_ptr_conv;
36004         this_ptr_conv.inner = untag_ptr(this_ptr);
36005         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36007         this_ptr_conv.is_owned = false;
36008         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
36009         uint64_t ret_ref = 0;
36010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36012         return ret_ref;
36013 }
36014
36015 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_pubkeys"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint64_t this_ptr, uint64_t val) {
36016         LDKChannelTransactionParameters this_ptr_conv;
36017         this_ptr_conv.inner = untag_ptr(this_ptr);
36018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36020         this_ptr_conv.is_owned = false;
36021         LDKChannelPublicKeys val_conv;
36022         val_conv.inner = untag_ptr(val);
36023         val_conv.is_owned = ptr_is_owned(val);
36024         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36025         val_conv = ChannelPublicKeys_clone(&val_conv);
36026         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
36027 }
36028
36029 int16_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint64_t this_ptr) {
36030         LDKChannelTransactionParameters this_ptr_conv;
36031         this_ptr_conv.inner = untag_ptr(this_ptr);
36032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36034         this_ptr_conv.is_owned = false;
36035         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
36036         return ret_conv;
36037 }
36038
36039 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) {
36040         LDKChannelTransactionParameters this_ptr_conv;
36041         this_ptr_conv.inner = untag_ptr(this_ptr);
36042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36044         this_ptr_conv.is_owned = false;
36045         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
36046 }
36047
36048 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_get_is_outbound_from_holder"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint64_t this_ptr) {
36049         LDKChannelTransactionParameters this_ptr_conv;
36050         this_ptr_conv.inner = untag_ptr(this_ptr);
36051         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36053         this_ptr_conv.is_owned = false;
36054         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
36055         return ret_conv;
36056 }
36057
36058 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_is_outbound_from_holder"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint64_t this_ptr, jboolean val) {
36059         LDKChannelTransactionParameters this_ptr_conv;
36060         this_ptr_conv.inner = untag_ptr(this_ptr);
36061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36063         this_ptr_conv.is_owned = false;
36064         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
36065 }
36066
36067 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_counterparty_parameters"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint64_t this_ptr) {
36068         LDKChannelTransactionParameters this_ptr_conv;
36069         this_ptr_conv.inner = untag_ptr(this_ptr);
36070         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36072         this_ptr_conv.is_owned = false;
36073         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
36074         uint64_t ret_ref = 0;
36075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36077         return ret_ref;
36078 }
36079
36080 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_counterparty_parameters"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint64_t this_ptr, uint64_t val) {
36081         LDKChannelTransactionParameters this_ptr_conv;
36082         this_ptr_conv.inner = untag_ptr(this_ptr);
36083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36085         this_ptr_conv.is_owned = false;
36086         LDKCounterpartyChannelTransactionParameters val_conv;
36087         val_conv.inner = untag_ptr(val);
36088         val_conv.is_owned = ptr_is_owned(val);
36089         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36090         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
36091         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
36092 }
36093
36094 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_funding_outpoint"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint64_t this_ptr) {
36095         LDKChannelTransactionParameters this_ptr_conv;
36096         this_ptr_conv.inner = untag_ptr(this_ptr);
36097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36099         this_ptr_conv.is_owned = false;
36100         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
36101         uint64_t ret_ref = 0;
36102         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36103         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36104         return ret_ref;
36105 }
36106
36107 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_funding_outpoint"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint64_t this_ptr, uint64_t val) {
36108         LDKChannelTransactionParameters this_ptr_conv;
36109         this_ptr_conv.inner = untag_ptr(this_ptr);
36110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36112         this_ptr_conv.is_owned = false;
36113         LDKOutPoint val_conv;
36114         val_conv.inner = untag_ptr(val);
36115         val_conv.is_owned = ptr_is_owned(val);
36116         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36117         val_conv = OutPoint_clone(&val_conv);
36118         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
36119 }
36120
36121 uint32_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_opt_anchors"))) TS_ChannelTransactionParameters_get_opt_anchors(uint64_t this_ptr) {
36122         LDKChannelTransactionParameters this_ptr_conv;
36123         this_ptr_conv.inner = untag_ptr(this_ptr);
36124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36126         this_ptr_conv.is_owned = false;
36127         uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv));
36128         return ret_conv;
36129 }
36130
36131 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_opt_anchors"))) TS_ChannelTransactionParameters_set_opt_anchors(uint64_t this_ptr, uint32_t val) {
36132         LDKChannelTransactionParameters this_ptr_conv;
36133         this_ptr_conv.inner = untag_ptr(this_ptr);
36134         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36136         this_ptr_conv.is_owned = false;
36137         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
36138         ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv);
36139 }
36140
36141 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) {
36142         LDKChannelPublicKeys holder_pubkeys_arg_conv;
36143         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
36144         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
36145         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
36146         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
36147         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
36148         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
36149         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
36150         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
36151         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
36152         LDKOutPoint funding_outpoint_arg_conv;
36153         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
36154         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
36155         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
36156         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
36157         LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_anchors_arg);
36158         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);
36159         uint64_t ret_ref = 0;
36160         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36161         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36162         return ret_ref;
36163 }
36164
36165 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
36166         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
36167         uint64_t ret_ref = 0;
36168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36170         return ret_ref;
36171 }
36172 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone_ptr"))) TS_ChannelTransactionParameters_clone_ptr(uint64_t arg) {
36173         LDKChannelTransactionParameters arg_conv;
36174         arg_conv.inner = untag_ptr(arg);
36175         arg_conv.is_owned = ptr_is_owned(arg);
36176         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36177         arg_conv.is_owned = false;
36178         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
36179         return ret_conv;
36180 }
36181
36182 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone"))) TS_ChannelTransactionParameters_clone(uint64_t orig) {
36183         LDKChannelTransactionParameters orig_conv;
36184         orig_conv.inner = untag_ptr(orig);
36185         orig_conv.is_owned = ptr_is_owned(orig);
36186         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36187         orig_conv.is_owned = false;
36188         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
36189         uint64_t ret_ref = 0;
36190         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36191         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36192         return ret_ref;
36193 }
36194
36195 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_free"))) TS_CounterpartyChannelTransactionParameters_free(uint64_t this_obj) {
36196         LDKCounterpartyChannelTransactionParameters this_obj_conv;
36197         this_obj_conv.inner = untag_ptr(this_obj);
36198         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36200         CounterpartyChannelTransactionParameters_free(this_obj_conv);
36201 }
36202
36203 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_pubkeys"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint64_t this_ptr) {
36204         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
36205         this_ptr_conv.inner = untag_ptr(this_ptr);
36206         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36208         this_ptr_conv.is_owned = false;
36209         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
36210         uint64_t ret_ref = 0;
36211         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36212         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36213         return ret_ref;
36214 }
36215
36216 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_pubkeys"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint64_t this_ptr, uint64_t val) {
36217         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
36218         this_ptr_conv.inner = untag_ptr(this_ptr);
36219         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36221         this_ptr_conv.is_owned = false;
36222         LDKChannelPublicKeys val_conv;
36223         val_conv.inner = untag_ptr(val);
36224         val_conv.is_owned = ptr_is_owned(val);
36225         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36226         val_conv = ChannelPublicKeys_clone(&val_conv);
36227         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
36228 }
36229
36230 int16_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint64_t this_ptr) {
36231         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
36232         this_ptr_conv.inner = untag_ptr(this_ptr);
36233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36235         this_ptr_conv.is_owned = false;
36236         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
36237         return ret_conv;
36238 }
36239
36240 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint64_t this_ptr, int16_t val) {
36241         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
36242         this_ptr_conv.inner = untag_ptr(this_ptr);
36243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36245         this_ptr_conv.is_owned = false;
36246         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
36247 }
36248
36249 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_new"))) TS_CounterpartyChannelTransactionParameters_new(uint64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
36250         LDKChannelPublicKeys pubkeys_arg_conv;
36251         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
36252         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
36253         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
36254         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
36255         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
36256         uint64_t ret_ref = 0;
36257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36259         return ret_ref;
36260 }
36261
36262 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
36263         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
36264         uint64_t ret_ref = 0;
36265         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36266         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36267         return ret_ref;
36268 }
36269 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone_ptr"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint64_t arg) {
36270         LDKCounterpartyChannelTransactionParameters arg_conv;
36271         arg_conv.inner = untag_ptr(arg);
36272         arg_conv.is_owned = ptr_is_owned(arg);
36273         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36274         arg_conv.is_owned = false;
36275         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
36276         return ret_conv;
36277 }
36278
36279 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone"))) TS_CounterpartyChannelTransactionParameters_clone(uint64_t orig) {
36280         LDKCounterpartyChannelTransactionParameters orig_conv;
36281         orig_conv.inner = untag_ptr(orig);
36282         orig_conv.is_owned = ptr_is_owned(orig);
36283         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36284         orig_conv.is_owned = false;
36285         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
36286         uint64_t ret_ref = 0;
36287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36288         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36289         return ret_ref;
36290 }
36291
36292 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_is_populated"))) TS_ChannelTransactionParameters_is_populated(uint64_t this_arg) {
36293         LDKChannelTransactionParameters this_arg_conv;
36294         this_arg_conv.inner = untag_ptr(this_arg);
36295         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36297         this_arg_conv.is_owned = false;
36298         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
36299         return ret_conv;
36300 }
36301
36302 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_holder_broadcastable"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint64_t this_arg) {
36303         LDKChannelTransactionParameters this_arg_conv;
36304         this_arg_conv.inner = untag_ptr(this_arg);
36305         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36307         this_arg_conv.is_owned = false;
36308         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
36309         uint64_t ret_ref = 0;
36310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36312         return ret_ref;
36313 }
36314
36315 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_counterparty_broadcastable"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint64_t this_arg) {
36316         LDKChannelTransactionParameters this_arg_conv;
36317         this_arg_conv.inner = untag_ptr(this_arg);
36318         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36320         this_arg_conv.is_owned = false;
36321         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
36322         uint64_t ret_ref = 0;
36323         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36324         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36325         return ret_ref;
36326 }
36327
36328 int8_tArray  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_write"))) TS_CounterpartyChannelTransactionParameters_write(uint64_t obj) {
36329         LDKCounterpartyChannelTransactionParameters obj_conv;
36330         obj_conv.inner = untag_ptr(obj);
36331         obj_conv.is_owned = ptr_is_owned(obj);
36332         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36333         obj_conv.is_owned = false;
36334         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
36335         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36336         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36337         CVec_u8Z_free(ret_var);
36338         return ret_arr;
36339 }
36340
36341 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_read"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
36342         LDKu8slice ser_ref;
36343         ser_ref.datalen = ser->arr_len;
36344         ser_ref.data = ser->elems;
36345         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
36346         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
36347         FREE(ser);
36348         return tag_ptr(ret_conv, true);
36349 }
36350
36351 int8_tArray  __attribute__((export_name("TS_ChannelTransactionParameters_write"))) TS_ChannelTransactionParameters_write(uint64_t obj) {
36352         LDKChannelTransactionParameters obj_conv;
36353         obj_conv.inner = untag_ptr(obj);
36354         obj_conv.is_owned = ptr_is_owned(obj);
36355         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36356         obj_conv.is_owned = false;
36357         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
36358         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36359         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36360         CVec_u8Z_free(ret_var);
36361         return ret_arr;
36362 }
36363
36364 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_read"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
36365         LDKu8slice ser_ref;
36366         ser_ref.datalen = ser->arr_len;
36367         ser_ref.data = ser->elems;
36368         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
36369         *ret_conv = ChannelTransactionParameters_read(ser_ref);
36370         FREE(ser);
36371         return tag_ptr(ret_conv, true);
36372 }
36373
36374 void  __attribute__((export_name("TS_DirectedChannelTransactionParameters_free"))) TS_DirectedChannelTransactionParameters_free(uint64_t this_obj) {
36375         LDKDirectedChannelTransactionParameters this_obj_conv;
36376         this_obj_conv.inner = untag_ptr(this_obj);
36377         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36379         DirectedChannelTransactionParameters_free(this_obj_conv);
36380 }
36381
36382 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_broadcaster_pubkeys"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint64_t this_arg) {
36383         LDKDirectedChannelTransactionParameters this_arg_conv;
36384         this_arg_conv.inner = untag_ptr(this_arg);
36385         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36387         this_arg_conv.is_owned = false;
36388         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
36389         uint64_t ret_ref = 0;
36390         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36391         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36392         return ret_ref;
36393 }
36394
36395 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_countersignatory_pubkeys"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint64_t this_arg) {
36396         LDKDirectedChannelTransactionParameters this_arg_conv;
36397         this_arg_conv.inner = untag_ptr(this_arg);
36398         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36400         this_arg_conv.is_owned = false;
36401         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
36402         uint64_t ret_ref = 0;
36403         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36404         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36405         return ret_ref;
36406 }
36407
36408 int16_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_contest_delay"))) TS_DirectedChannelTransactionParameters_contest_delay(uint64_t this_arg) {
36409         LDKDirectedChannelTransactionParameters this_arg_conv;
36410         this_arg_conv.inner = untag_ptr(this_arg);
36411         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36413         this_arg_conv.is_owned = false;
36414         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
36415         return ret_conv;
36416 }
36417
36418 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_is_outbound"))) TS_DirectedChannelTransactionParameters_is_outbound(uint64_t this_arg) {
36419         LDKDirectedChannelTransactionParameters this_arg_conv;
36420         this_arg_conv.inner = untag_ptr(this_arg);
36421         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36423         this_arg_conv.is_owned = false;
36424         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
36425         return ret_conv;
36426 }
36427
36428 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_funding_outpoint"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint64_t this_arg) {
36429         LDKDirectedChannelTransactionParameters this_arg_conv;
36430         this_arg_conv.inner = untag_ptr(this_arg);
36431         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36433         this_arg_conv.is_owned = false;
36434         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
36435         uint64_t ret_ref = 0;
36436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36438         return ret_ref;
36439 }
36440
36441 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_opt_anchors"))) TS_DirectedChannelTransactionParameters_opt_anchors(uint64_t this_arg) {
36442         LDKDirectedChannelTransactionParameters this_arg_conv;
36443         this_arg_conv.inner = untag_ptr(this_arg);
36444         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36446         this_arg_conv.is_owned = false;
36447         jboolean ret_conv = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv);
36448         return ret_conv;
36449 }
36450
36451 void  __attribute__((export_name("TS_HolderCommitmentTransaction_free"))) TS_HolderCommitmentTransaction_free(uint64_t this_obj) {
36452         LDKHolderCommitmentTransaction this_obj_conv;
36453         this_obj_conv.inner = untag_ptr(this_obj);
36454         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36456         HolderCommitmentTransaction_free(this_obj_conv);
36457 }
36458
36459 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_sig"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint64_t this_ptr) {
36460         LDKHolderCommitmentTransaction this_ptr_conv;
36461         this_ptr_conv.inner = untag_ptr(this_ptr);
36462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36464         this_ptr_conv.is_owned = false;
36465         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
36466         memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
36467         return ret_arr;
36468 }
36469
36470 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_sig"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
36471         LDKHolderCommitmentTransaction this_ptr_conv;
36472         this_ptr_conv.inner = untag_ptr(this_ptr);
36473         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36475         this_ptr_conv.is_owned = false;
36476         LDKSignature val_ref;
36477         CHECK(val->arr_len == 64);
36478         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
36479         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
36480 }
36481
36482 ptrArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs(uint64_t this_ptr) {
36483         LDKHolderCommitmentTransaction this_ptr_conv;
36484         this_ptr_conv.inner = untag_ptr(this_ptr);
36485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36487         this_ptr_conv.is_owned = false;
36488         LDKCVec_SignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
36489         ptrArray ret_arr = NULL;
36490         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
36491         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
36492         for (size_t m = 0; m < ret_var.datalen; m++) {
36493                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
36494                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
36495                 ret_arr_ptr[m] = ret_conv_12_arr;
36496         }
36497         
36498         FREE(ret_var.data);
36499         return ret_arr;
36500 }
36501
36502 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint64_t this_ptr, ptrArray val) {
36503         LDKHolderCommitmentTransaction this_ptr_conv;
36504         this_ptr_conv.inner = untag_ptr(this_ptr);
36505         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36507         this_ptr_conv.is_owned = false;
36508         LDKCVec_SignatureZ val_constr;
36509         val_constr.datalen = val->arr_len;
36510         if (val_constr.datalen > 0)
36511                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
36512         else
36513                 val_constr.data = NULL;
36514         int8_tArray* val_vals = (void*) val->elems;
36515         for (size_t m = 0; m < val_constr.datalen; m++) {
36516                 int8_tArray val_conv_12 = val_vals[m];
36517                 LDKSignature val_conv_12_ref;
36518                 CHECK(val_conv_12->arr_len == 64);
36519                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
36520                 val_constr.data[m] = val_conv_12_ref;
36521         }
36522         FREE(val);
36523         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
36524 }
36525
36526 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
36527         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
36528         uint64_t ret_ref = 0;
36529         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36530         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36531         return ret_ref;
36532 }
36533 int64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone_ptr"))) TS_HolderCommitmentTransaction_clone_ptr(uint64_t arg) {
36534         LDKHolderCommitmentTransaction arg_conv;
36535         arg_conv.inner = untag_ptr(arg);
36536         arg_conv.is_owned = ptr_is_owned(arg);
36537         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36538         arg_conv.is_owned = false;
36539         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
36540         return ret_conv;
36541 }
36542
36543 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone"))) TS_HolderCommitmentTransaction_clone(uint64_t orig) {
36544         LDKHolderCommitmentTransaction orig_conv;
36545         orig_conv.inner = untag_ptr(orig);
36546         orig_conv.is_owned = ptr_is_owned(orig);
36547         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36548         orig_conv.is_owned = false;
36549         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
36550         uint64_t ret_ref = 0;
36551         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36552         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36553         return ret_ref;
36554 }
36555
36556 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_write"))) TS_HolderCommitmentTransaction_write(uint64_t obj) {
36557         LDKHolderCommitmentTransaction obj_conv;
36558         obj_conv.inner = untag_ptr(obj);
36559         obj_conv.is_owned = ptr_is_owned(obj);
36560         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36561         obj_conv.is_owned = false;
36562         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
36563         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36564         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36565         CVec_u8Z_free(ret_var);
36566         return ret_arr;
36567 }
36568
36569 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_read"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
36570         LDKu8slice ser_ref;
36571         ser_ref.datalen = ser->arr_len;
36572         ser_ref.data = ser->elems;
36573         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
36574         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
36575         FREE(ser);
36576         return tag_ptr(ret_conv, true);
36577 }
36578
36579 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) {
36580         LDKCommitmentTransaction commitment_tx_conv;
36581         commitment_tx_conv.inner = untag_ptr(commitment_tx);
36582         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
36583         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
36584         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
36585         LDKSignature counterparty_sig_ref;
36586         CHECK(counterparty_sig->arr_len == 64);
36587         memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
36588         LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
36589         counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
36590         if (counterparty_htlc_sigs_constr.datalen > 0)
36591                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
36592         else
36593                 counterparty_htlc_sigs_constr.data = NULL;
36594         int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
36595         for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
36596                 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
36597                 LDKSignature counterparty_htlc_sigs_conv_12_ref;
36598                 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
36599                 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64); FREE(counterparty_htlc_sigs_conv_12);
36600                 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
36601         }
36602         FREE(counterparty_htlc_sigs);
36603         LDKPublicKey holder_funding_key_ref;
36604         CHECK(holder_funding_key->arr_len == 33);
36605         memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
36606         LDKPublicKey counterparty_funding_key_ref;
36607         CHECK(counterparty_funding_key->arr_len == 33);
36608         memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
36609         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
36610         uint64_t ret_ref = 0;
36611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36613         return ret_ref;
36614 }
36615
36616 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_free"))) TS_BuiltCommitmentTransaction_free(uint64_t this_obj) {
36617         LDKBuiltCommitmentTransaction this_obj_conv;
36618         this_obj_conv.inner = untag_ptr(this_obj);
36619         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36621         BuiltCommitmentTransaction_free(this_obj_conv);
36622 }
36623
36624 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_transaction"))) TS_BuiltCommitmentTransaction_get_transaction(uint64_t this_ptr) {
36625         LDKBuiltCommitmentTransaction 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         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
36631         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36632         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36633         Transaction_free(ret_var);
36634         return ret_arr;
36635 }
36636
36637 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_transaction"))) TS_BuiltCommitmentTransaction_set_transaction(uint64_t this_ptr, int8_tArray val) {
36638         LDKBuiltCommitmentTransaction this_ptr_conv;
36639         this_ptr_conv.inner = untag_ptr(this_ptr);
36640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36642         this_ptr_conv.is_owned = false;
36643         LDKTransaction val_ref;
36644         val_ref.datalen = val->arr_len;
36645         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
36646         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
36647         val_ref.data_is_owned = true;
36648         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
36649 }
36650
36651 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_txid"))) TS_BuiltCommitmentTransaction_get_txid(uint64_t this_ptr) {
36652         LDKBuiltCommitmentTransaction this_ptr_conv;
36653         this_ptr_conv.inner = untag_ptr(this_ptr);
36654         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36656         this_ptr_conv.is_owned = false;
36657         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36658         memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
36659         return ret_arr;
36660 }
36661
36662 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_txid"))) TS_BuiltCommitmentTransaction_set_txid(uint64_t this_ptr, int8_tArray val) {
36663         LDKBuiltCommitmentTransaction this_ptr_conv;
36664         this_ptr_conv.inner = untag_ptr(this_ptr);
36665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36667         this_ptr_conv.is_owned = false;
36668         LDKThirtyTwoBytes val_ref;
36669         CHECK(val->arr_len == 32);
36670         memcpy(val_ref.data, val->elems, 32); FREE(val);
36671         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
36672 }
36673
36674 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_new"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
36675         LDKTransaction transaction_arg_ref;
36676         transaction_arg_ref.datalen = transaction_arg->arr_len;
36677         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
36678         memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
36679         transaction_arg_ref.data_is_owned = true;
36680         LDKThirtyTwoBytes txid_arg_ref;
36681         CHECK(txid_arg->arr_len == 32);
36682         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
36683         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
36684         uint64_t ret_ref = 0;
36685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36687         return ret_ref;
36688 }
36689
36690 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
36691         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
36692         uint64_t ret_ref = 0;
36693         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36694         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36695         return ret_ref;
36696 }
36697 int64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone_ptr"))) TS_BuiltCommitmentTransaction_clone_ptr(uint64_t arg) {
36698         LDKBuiltCommitmentTransaction arg_conv;
36699         arg_conv.inner = untag_ptr(arg);
36700         arg_conv.is_owned = ptr_is_owned(arg);
36701         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36702         arg_conv.is_owned = false;
36703         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
36704         return ret_conv;
36705 }
36706
36707 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone"))) TS_BuiltCommitmentTransaction_clone(uint64_t orig) {
36708         LDKBuiltCommitmentTransaction orig_conv;
36709         orig_conv.inner = untag_ptr(orig);
36710         orig_conv.is_owned = ptr_is_owned(orig);
36711         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36712         orig_conv.is_owned = false;
36713         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
36714         uint64_t ret_ref = 0;
36715         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36716         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36717         return ret_ref;
36718 }
36719
36720 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_write"))) TS_BuiltCommitmentTransaction_write(uint64_t obj) {
36721         LDKBuiltCommitmentTransaction obj_conv;
36722         obj_conv.inner = untag_ptr(obj);
36723         obj_conv.is_owned = ptr_is_owned(obj);
36724         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
36725         obj_conv.is_owned = false;
36726         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
36727         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36728         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36729         CVec_u8Z_free(ret_var);
36730         return ret_arr;
36731 }
36732
36733 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_read"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
36734         LDKu8slice ser_ref;
36735         ser_ref.datalen = ser->arr_len;
36736         ser_ref.data = ser->elems;
36737         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
36738         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
36739         FREE(ser);
36740         return tag_ptr(ret_conv, true);
36741 }
36742
36743 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) {
36744         LDKBuiltCommitmentTransaction this_arg_conv;
36745         this_arg_conv.inner = untag_ptr(this_arg);
36746         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36748         this_arg_conv.is_owned = false;
36749         LDKu8slice funding_redeemscript_ref;
36750         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
36751         funding_redeemscript_ref.data = funding_redeemscript->elems;
36752         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36753         memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
36754         FREE(funding_redeemscript);
36755         return ret_arr;
36756 }
36757
36758 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) {
36759         LDKBuiltCommitmentTransaction this_arg_conv;
36760         this_arg_conv.inner = untag_ptr(this_arg);
36761         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36763         this_arg_conv.is_owned = false;
36764         unsigned char funding_key_arr[32];
36765         CHECK(funding_key->arr_len == 32);
36766         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
36767         unsigned char (*funding_key_ref)[32] = &funding_key_arr;
36768         LDKu8slice funding_redeemscript_ref;
36769         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
36770         funding_redeemscript_ref.data = funding_redeemscript->elems;
36771         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
36772         memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
36773         FREE(funding_redeemscript);
36774         return ret_arr;
36775 }
36776
36777 void  __attribute__((export_name("TS_ClosingTransaction_free"))) TS_ClosingTransaction_free(uint64_t this_obj) {
36778         LDKClosingTransaction this_obj_conv;
36779         this_obj_conv.inner = untag_ptr(this_obj);
36780         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36782         ClosingTransaction_free(this_obj_conv);
36783 }
36784
36785 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
36786         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
36787         uint64_t ret_ref = 0;
36788         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36789         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36790         return ret_ref;
36791 }
36792 int64_t  __attribute__((export_name("TS_ClosingTransaction_clone_ptr"))) TS_ClosingTransaction_clone_ptr(uint64_t arg) {
36793         LDKClosingTransaction arg_conv;
36794         arg_conv.inner = untag_ptr(arg);
36795         arg_conv.is_owned = ptr_is_owned(arg);
36796         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36797         arg_conv.is_owned = false;
36798         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
36799         return ret_conv;
36800 }
36801
36802 uint64_t  __attribute__((export_name("TS_ClosingTransaction_clone"))) TS_ClosingTransaction_clone(uint64_t orig) {
36803         LDKClosingTransaction orig_conv;
36804         orig_conv.inner = untag_ptr(orig);
36805         orig_conv.is_owned = ptr_is_owned(orig);
36806         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36807         orig_conv.is_owned = false;
36808         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
36809         uint64_t ret_ref = 0;
36810         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36811         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36812         return ret_ref;
36813 }
36814
36815 int64_t  __attribute__((export_name("TS_ClosingTransaction_hash"))) TS_ClosingTransaction_hash(uint64_t o) {
36816         LDKClosingTransaction o_conv;
36817         o_conv.inner = untag_ptr(o);
36818         o_conv.is_owned = ptr_is_owned(o);
36819         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36820         o_conv.is_owned = false;
36821         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
36822         return ret_conv;
36823 }
36824
36825 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) {
36826         LDKCVec_u8Z to_holder_script_ref;
36827         to_holder_script_ref.datalen = to_holder_script->arr_len;
36828         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
36829         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
36830         LDKCVec_u8Z to_counterparty_script_ref;
36831         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
36832         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
36833         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
36834         LDKOutPoint funding_outpoint_conv;
36835         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
36836         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
36837         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
36838         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
36839         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
36840         uint64_t ret_ref = 0;
36841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36843         return ret_ref;
36844 }
36845
36846 uint64_t  __attribute__((export_name("TS_ClosingTransaction_trust"))) TS_ClosingTransaction_trust(uint64_t this_arg) {
36847         LDKClosingTransaction this_arg_conv;
36848         this_arg_conv.inner = untag_ptr(this_arg);
36849         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36851         this_arg_conv.is_owned = false;
36852         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
36853         uint64_t ret_ref = 0;
36854         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36855         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36856         return ret_ref;
36857 }
36858
36859 uint64_t  __attribute__((export_name("TS_ClosingTransaction_verify"))) TS_ClosingTransaction_verify(uint64_t this_arg, uint64_t funding_outpoint) {
36860         LDKClosingTransaction this_arg_conv;
36861         this_arg_conv.inner = untag_ptr(this_arg);
36862         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36864         this_arg_conv.is_owned = false;
36865         LDKOutPoint funding_outpoint_conv;
36866         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
36867         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
36868         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
36869         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
36870         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
36871         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
36872         return tag_ptr(ret_conv, true);
36873 }
36874
36875 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_holder_value_sat"))) TS_ClosingTransaction_to_holder_value_sat(uint64_t this_arg) {
36876         LDKClosingTransaction this_arg_conv;
36877         this_arg_conv.inner = untag_ptr(this_arg);
36878         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36880         this_arg_conv.is_owned = false;
36881         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
36882         return ret_conv;
36883 }
36884
36885 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_value_sat"))) TS_ClosingTransaction_to_counterparty_value_sat(uint64_t this_arg) {
36886         LDKClosingTransaction this_arg_conv;
36887         this_arg_conv.inner = untag_ptr(this_arg);
36888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36890         this_arg_conv.is_owned = false;
36891         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
36892         return ret_conv;
36893 }
36894
36895 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_holder_script"))) TS_ClosingTransaction_to_holder_script(uint64_t this_arg) {
36896         LDKClosingTransaction this_arg_conv;
36897         this_arg_conv.inner = untag_ptr(this_arg);
36898         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36900         this_arg_conv.is_owned = false;
36901         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
36902         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36903         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36904         return ret_arr;
36905 }
36906
36907 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_script"))) TS_ClosingTransaction_to_counterparty_script(uint64_t this_arg) {
36908         LDKClosingTransaction this_arg_conv;
36909         this_arg_conv.inner = untag_ptr(this_arg);
36910         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36912         this_arg_conv.is_owned = false;
36913         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
36914         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36915         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36916         return ret_arr;
36917 }
36918
36919 void  __attribute__((export_name("TS_TrustedClosingTransaction_free"))) TS_TrustedClosingTransaction_free(uint64_t this_obj) {
36920         LDKTrustedClosingTransaction this_obj_conv;
36921         this_obj_conv.inner = untag_ptr(this_obj);
36922         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36924         TrustedClosingTransaction_free(this_obj_conv);
36925 }
36926
36927 int8_tArray  __attribute__((export_name("TS_TrustedClosingTransaction_built_transaction"))) TS_TrustedClosingTransaction_built_transaction(uint64_t this_arg) {
36928         LDKTrustedClosingTransaction this_arg_conv;
36929         this_arg_conv.inner = untag_ptr(this_arg);
36930         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36932         this_arg_conv.is_owned = false;
36933         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
36934         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
36935         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
36936         Transaction_free(ret_var);
36937         return ret_arr;
36938 }
36939
36940 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) {
36941         LDKTrustedClosingTransaction this_arg_conv;
36942         this_arg_conv.inner = untag_ptr(this_arg);
36943         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36945         this_arg_conv.is_owned = false;
36946         LDKu8slice funding_redeemscript_ref;
36947         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
36948         funding_redeemscript_ref.data = funding_redeemscript->elems;
36949         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36950         memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
36951         FREE(funding_redeemscript);
36952         return ret_arr;
36953 }
36954
36955 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) {
36956         LDKTrustedClosingTransaction this_arg_conv;
36957         this_arg_conv.inner = untag_ptr(this_arg);
36958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
36959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
36960         this_arg_conv.is_owned = false;
36961         unsigned char funding_key_arr[32];
36962         CHECK(funding_key->arr_len == 32);
36963         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
36964         unsigned char (*funding_key_ref)[32] = &funding_key_arr;
36965         LDKu8slice funding_redeemscript_ref;
36966         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
36967         funding_redeemscript_ref.data = funding_redeemscript->elems;
36968         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
36969         memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
36970         FREE(funding_redeemscript);
36971         return ret_arr;
36972 }
36973
36974 void  __attribute__((export_name("TS_CommitmentTransaction_free"))) TS_CommitmentTransaction_free(uint64_t this_obj) {
36975         LDKCommitmentTransaction this_obj_conv;
36976         this_obj_conv.inner = untag_ptr(this_obj);
36977         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36979         CommitmentTransaction_free(this_obj_conv);
36980 }
36981
36982 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
36983         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
36984         uint64_t ret_ref = 0;
36985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36987         return ret_ref;
36988 }
36989 int64_t  __attribute__((export_name("TS_CommitmentTransaction_clone_ptr"))) TS_CommitmentTransaction_clone_ptr(uint64_t arg) {
36990         LDKCommitmentTransaction arg_conv;
36991         arg_conv.inner = untag_ptr(arg);
36992         arg_conv.is_owned = ptr_is_owned(arg);
36993         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36994         arg_conv.is_owned = false;
36995         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
36996         return ret_conv;
36997 }
36998
36999 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_clone"))) TS_CommitmentTransaction_clone(uint64_t orig) {
37000         LDKCommitmentTransaction orig_conv;
37001         orig_conv.inner = untag_ptr(orig);
37002         orig_conv.is_owned = ptr_is_owned(orig);
37003         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37004         orig_conv.is_owned = false;
37005         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
37006         uint64_t ret_ref = 0;
37007         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37008         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37009         return ret_ref;
37010 }
37011
37012 int8_tArray  __attribute__((export_name("TS_CommitmentTransaction_write"))) TS_CommitmentTransaction_write(uint64_t obj) {
37013         LDKCommitmentTransaction obj_conv;
37014         obj_conv.inner = untag_ptr(obj);
37015         obj_conv.is_owned = ptr_is_owned(obj);
37016         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37017         obj_conv.is_owned = false;
37018         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
37019         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37020         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37021         CVec_u8Z_free(ret_var);
37022         return ret_arr;
37023 }
37024
37025 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_read"))) TS_CommitmentTransaction_read(int8_tArray ser) {
37026         LDKu8slice ser_ref;
37027         ser_ref.datalen = ser->arr_len;
37028         ser_ref.data = ser->elems;
37029         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
37030         *ret_conv = CommitmentTransaction_read(ser_ref);
37031         FREE(ser);
37032         return tag_ptr(ret_conv, true);
37033 }
37034
37035 int64_t  __attribute__((export_name("TS_CommitmentTransaction_commitment_number"))) TS_CommitmentTransaction_commitment_number(uint64_t this_arg) {
37036         LDKCommitmentTransaction this_arg_conv;
37037         this_arg_conv.inner = untag_ptr(this_arg);
37038         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37040         this_arg_conv.is_owned = false;
37041         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
37042         return ret_conv;
37043 }
37044
37045 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_broadcaster_value_sat"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint64_t this_arg) {
37046         LDKCommitmentTransaction this_arg_conv;
37047         this_arg_conv.inner = untag_ptr(this_arg);
37048         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37050         this_arg_conv.is_owned = false;
37051         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
37052         return ret_conv;
37053 }
37054
37055 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_countersignatory_value_sat"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint64_t this_arg) {
37056         LDKCommitmentTransaction this_arg_conv;
37057         this_arg_conv.inner = untag_ptr(this_arg);
37058         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37060         this_arg_conv.is_owned = false;
37061         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
37062         return ret_conv;
37063 }
37064
37065 int32_t  __attribute__((export_name("TS_CommitmentTransaction_feerate_per_kw"))) TS_CommitmentTransaction_feerate_per_kw(uint64_t this_arg) {
37066         LDKCommitmentTransaction this_arg_conv;
37067         this_arg_conv.inner = untag_ptr(this_arg);
37068         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37070         this_arg_conv.is_owned = false;
37071         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
37072         return ret_conv;
37073 }
37074
37075 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_trust"))) TS_CommitmentTransaction_trust(uint64_t this_arg) {
37076         LDKCommitmentTransaction this_arg_conv;
37077         this_arg_conv.inner = untag_ptr(this_arg);
37078         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37080         this_arg_conv.is_owned = false;
37081         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
37082         uint64_t ret_ref = 0;
37083         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37084         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37085         return ret_ref;
37086 }
37087
37088 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) {
37089         LDKCommitmentTransaction this_arg_conv;
37090         this_arg_conv.inner = untag_ptr(this_arg);
37091         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37093         this_arg_conv.is_owned = false;
37094         LDKDirectedChannelTransactionParameters channel_parameters_conv;
37095         channel_parameters_conv.inner = untag_ptr(channel_parameters);
37096         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
37097         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
37098         channel_parameters_conv.is_owned = false;
37099         LDKChannelPublicKeys broadcaster_keys_conv;
37100         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
37101         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
37102         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
37103         broadcaster_keys_conv.is_owned = false;
37104         LDKChannelPublicKeys countersignatory_keys_conv;
37105         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
37106         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
37107         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
37108         countersignatory_keys_conv.is_owned = false;
37109         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
37110         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
37111         return tag_ptr(ret_conv, true);
37112 }
37113
37114 void  __attribute__((export_name("TS_TrustedCommitmentTransaction_free"))) TS_TrustedCommitmentTransaction_free(uint64_t this_obj) {
37115         LDKTrustedCommitmentTransaction this_obj_conv;
37116         this_obj_conv.inner = untag_ptr(this_obj);
37117         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37119         TrustedCommitmentTransaction_free(this_obj_conv);
37120 }
37121
37122 int8_tArray  __attribute__((export_name("TS_TrustedCommitmentTransaction_txid"))) TS_TrustedCommitmentTransaction_txid(uint64_t this_arg) {
37123         LDKTrustedCommitmentTransaction this_arg_conv;
37124         this_arg_conv.inner = untag_ptr(this_arg);
37125         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37127         this_arg_conv.is_owned = false;
37128         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37129         memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
37130         return ret_arr;
37131 }
37132
37133 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_built_transaction"))) TS_TrustedCommitmentTransaction_built_transaction(uint64_t this_arg) {
37134         LDKTrustedCommitmentTransaction this_arg_conv;
37135         this_arg_conv.inner = untag_ptr(this_arg);
37136         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37138         this_arg_conv.is_owned = false;
37139         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
37140         uint64_t ret_ref = 0;
37141         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37142         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37143         return ret_ref;
37144 }
37145
37146 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_keys"))) TS_TrustedCommitmentTransaction_keys(uint64_t this_arg) {
37147         LDKTrustedCommitmentTransaction this_arg_conv;
37148         this_arg_conv.inner = untag_ptr(this_arg);
37149         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37151         this_arg_conv.is_owned = false;
37152         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
37153         uint64_t ret_ref = 0;
37154         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37155         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37156         return ret_ref;
37157 }
37158
37159 jboolean  __attribute__((export_name("TS_TrustedCommitmentTransaction_opt_anchors"))) TS_TrustedCommitmentTransaction_opt_anchors(uint64_t this_arg) {
37160         LDKTrustedCommitmentTransaction this_arg_conv;
37161         this_arg_conv.inner = untag_ptr(this_arg);
37162         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37164         this_arg_conv.is_owned = false;
37165         jboolean ret_conv = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv);
37166         return ret_conv;
37167 }
37168
37169 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) {
37170         LDKTrustedCommitmentTransaction this_arg_conv;
37171         this_arg_conv.inner = untag_ptr(this_arg);
37172         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37174         this_arg_conv.is_owned = false;
37175         unsigned char htlc_base_key_arr[32];
37176         CHECK(htlc_base_key->arr_len == 32);
37177         memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
37178         unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
37179         LDKDirectedChannelTransactionParameters channel_parameters_conv;
37180         channel_parameters_conv.inner = untag_ptr(channel_parameters);
37181         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
37182         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
37183         channel_parameters_conv.is_owned = false;
37184         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
37185         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
37186         return tag_ptr(ret_conv, true);
37187 }
37188
37189 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) {
37190         LDKPublicKey broadcaster_payment_basepoint_ref;
37191         CHECK(broadcaster_payment_basepoint->arr_len == 33);
37192         memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
37193         LDKPublicKey countersignatory_payment_basepoint_ref;
37194         CHECK(countersignatory_payment_basepoint->arr_len == 33);
37195         memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
37196         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
37197         return ret_conv;
37198 }
37199
37200 jboolean  __attribute__((export_name("TS_InitFeatures_eq"))) TS_InitFeatures_eq(uint64_t a, uint64_t b) {
37201         LDKInitFeatures a_conv;
37202         a_conv.inner = untag_ptr(a);
37203         a_conv.is_owned = ptr_is_owned(a);
37204         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37205         a_conv.is_owned = false;
37206         LDKInitFeatures b_conv;
37207         b_conv.inner = untag_ptr(b);
37208         b_conv.is_owned = ptr_is_owned(b);
37209         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37210         b_conv.is_owned = false;
37211         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
37212         return ret_conv;
37213 }
37214
37215 jboolean  __attribute__((export_name("TS_NodeFeatures_eq"))) TS_NodeFeatures_eq(uint64_t a, uint64_t b) {
37216         LDKNodeFeatures a_conv;
37217         a_conv.inner = untag_ptr(a);
37218         a_conv.is_owned = ptr_is_owned(a);
37219         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37220         a_conv.is_owned = false;
37221         LDKNodeFeatures b_conv;
37222         b_conv.inner = untag_ptr(b);
37223         b_conv.is_owned = ptr_is_owned(b);
37224         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37225         b_conv.is_owned = false;
37226         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
37227         return ret_conv;
37228 }
37229
37230 jboolean  __attribute__((export_name("TS_ChannelFeatures_eq"))) TS_ChannelFeatures_eq(uint64_t a, uint64_t b) {
37231         LDKChannelFeatures a_conv;
37232         a_conv.inner = untag_ptr(a);
37233         a_conv.is_owned = ptr_is_owned(a);
37234         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37235         a_conv.is_owned = false;
37236         LDKChannelFeatures b_conv;
37237         b_conv.inner = untag_ptr(b);
37238         b_conv.is_owned = ptr_is_owned(b);
37239         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37240         b_conv.is_owned = false;
37241         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
37242         return ret_conv;
37243 }
37244
37245 jboolean  __attribute__((export_name("TS_InvoiceFeatures_eq"))) TS_InvoiceFeatures_eq(uint64_t a, uint64_t b) {
37246         LDKInvoiceFeatures a_conv;
37247         a_conv.inner = untag_ptr(a);
37248         a_conv.is_owned = ptr_is_owned(a);
37249         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37250         a_conv.is_owned = false;
37251         LDKInvoiceFeatures b_conv;
37252         b_conv.inner = untag_ptr(b);
37253         b_conv.is_owned = ptr_is_owned(b);
37254         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37255         b_conv.is_owned = false;
37256         jboolean ret_conv = InvoiceFeatures_eq(&a_conv, &b_conv);
37257         return ret_conv;
37258 }
37259
37260 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint64_t a, uint64_t b) {
37261         LDKChannelTypeFeatures a_conv;
37262         a_conv.inner = untag_ptr(a);
37263         a_conv.is_owned = ptr_is_owned(a);
37264         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37265         a_conv.is_owned = false;
37266         LDKChannelTypeFeatures b_conv;
37267         b_conv.inner = untag_ptr(b);
37268         b_conv.is_owned = ptr_is_owned(b);
37269         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37270         b_conv.is_owned = false;
37271         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
37272         return ret_conv;
37273 }
37274
37275 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
37276         LDKInitFeatures ret_var = InitFeatures_clone(arg);
37277         uint64_t ret_ref = 0;
37278         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37279         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37280         return ret_ref;
37281 }
37282 int64_t  __attribute__((export_name("TS_InitFeatures_clone_ptr"))) TS_InitFeatures_clone_ptr(uint64_t arg) {
37283         LDKInitFeatures arg_conv;
37284         arg_conv.inner = untag_ptr(arg);
37285         arg_conv.is_owned = ptr_is_owned(arg);
37286         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37287         arg_conv.is_owned = false;
37288         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
37289         return ret_conv;
37290 }
37291
37292 uint64_t  __attribute__((export_name("TS_InitFeatures_clone"))) TS_InitFeatures_clone(uint64_t orig) {
37293         LDKInitFeatures orig_conv;
37294         orig_conv.inner = untag_ptr(orig);
37295         orig_conv.is_owned = ptr_is_owned(orig);
37296         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37297         orig_conv.is_owned = false;
37298         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
37299         uint64_t ret_ref = 0;
37300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37302         return ret_ref;
37303 }
37304
37305 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
37306         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
37307         uint64_t ret_ref = 0;
37308         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37309         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37310         return ret_ref;
37311 }
37312 int64_t  __attribute__((export_name("TS_NodeFeatures_clone_ptr"))) TS_NodeFeatures_clone_ptr(uint64_t arg) {
37313         LDKNodeFeatures arg_conv;
37314         arg_conv.inner = untag_ptr(arg);
37315         arg_conv.is_owned = ptr_is_owned(arg);
37316         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37317         arg_conv.is_owned = false;
37318         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
37319         return ret_conv;
37320 }
37321
37322 uint64_t  __attribute__((export_name("TS_NodeFeatures_clone"))) TS_NodeFeatures_clone(uint64_t orig) {
37323         LDKNodeFeatures orig_conv;
37324         orig_conv.inner = untag_ptr(orig);
37325         orig_conv.is_owned = ptr_is_owned(orig);
37326         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37327         orig_conv.is_owned = false;
37328         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
37329         uint64_t ret_ref = 0;
37330         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37331         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37332         return ret_ref;
37333 }
37334
37335 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
37336         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
37337         uint64_t ret_ref = 0;
37338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37340         return ret_ref;
37341 }
37342 int64_t  __attribute__((export_name("TS_ChannelFeatures_clone_ptr"))) TS_ChannelFeatures_clone_ptr(uint64_t arg) {
37343         LDKChannelFeatures arg_conv;
37344         arg_conv.inner = untag_ptr(arg);
37345         arg_conv.is_owned = ptr_is_owned(arg);
37346         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37347         arg_conv.is_owned = false;
37348         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
37349         return ret_conv;
37350 }
37351
37352 uint64_t  __attribute__((export_name("TS_ChannelFeatures_clone"))) TS_ChannelFeatures_clone(uint64_t orig) {
37353         LDKChannelFeatures orig_conv;
37354         orig_conv.inner = untag_ptr(orig);
37355         orig_conv.is_owned = ptr_is_owned(orig);
37356         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37357         orig_conv.is_owned = false;
37358         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
37359         uint64_t ret_ref = 0;
37360         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37361         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37362         return ret_ref;
37363 }
37364
37365 static inline uint64_t InvoiceFeatures_clone_ptr(LDKInvoiceFeatures *NONNULL_PTR arg) {
37366         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(arg);
37367         uint64_t ret_ref = 0;
37368         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37369         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37370         return ret_ref;
37371 }
37372 int64_t  __attribute__((export_name("TS_InvoiceFeatures_clone_ptr"))) TS_InvoiceFeatures_clone_ptr(uint64_t arg) {
37373         LDKInvoiceFeatures arg_conv;
37374         arg_conv.inner = untag_ptr(arg);
37375         arg_conv.is_owned = ptr_is_owned(arg);
37376         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37377         arg_conv.is_owned = false;
37378         int64_t ret_conv = InvoiceFeatures_clone_ptr(&arg_conv);
37379         return ret_conv;
37380 }
37381
37382 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_clone"))) TS_InvoiceFeatures_clone(uint64_t orig) {
37383         LDKInvoiceFeatures orig_conv;
37384         orig_conv.inner = untag_ptr(orig);
37385         orig_conv.is_owned = ptr_is_owned(orig);
37386         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37387         orig_conv.is_owned = false;
37388         LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
37389         uint64_t ret_ref = 0;
37390         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37391         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37392         return ret_ref;
37393 }
37394
37395 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
37396         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
37397         uint64_t ret_ref = 0;
37398         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37399         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37400         return ret_ref;
37401 }
37402 int64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone_ptr"))) TS_ChannelTypeFeatures_clone_ptr(uint64_t arg) {
37403         LDKChannelTypeFeatures arg_conv;
37404         arg_conv.inner = untag_ptr(arg);
37405         arg_conv.is_owned = ptr_is_owned(arg);
37406         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37407         arg_conv.is_owned = false;
37408         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
37409         return ret_conv;
37410 }
37411
37412 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone"))) TS_ChannelTypeFeatures_clone(uint64_t orig) {
37413         LDKChannelTypeFeatures orig_conv;
37414         orig_conv.inner = untag_ptr(orig);
37415         orig_conv.is_owned = ptr_is_owned(orig);
37416         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37417         orig_conv.is_owned = false;
37418         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
37419         uint64_t ret_ref = 0;
37420         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37421         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37422         return ret_ref;
37423 }
37424
37425 void  __attribute__((export_name("TS_InitFeatures_free"))) TS_InitFeatures_free(uint64_t this_obj) {
37426         LDKInitFeatures this_obj_conv;
37427         this_obj_conv.inner = untag_ptr(this_obj);
37428         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37430         InitFeatures_free(this_obj_conv);
37431 }
37432
37433 void  __attribute__((export_name("TS_NodeFeatures_free"))) TS_NodeFeatures_free(uint64_t this_obj) {
37434         LDKNodeFeatures this_obj_conv;
37435         this_obj_conv.inner = untag_ptr(this_obj);
37436         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37438         NodeFeatures_free(this_obj_conv);
37439 }
37440
37441 void  __attribute__((export_name("TS_ChannelFeatures_free"))) TS_ChannelFeatures_free(uint64_t this_obj) {
37442         LDKChannelFeatures this_obj_conv;
37443         this_obj_conv.inner = untag_ptr(this_obj);
37444         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37446         ChannelFeatures_free(this_obj_conv);
37447 }
37448
37449 void  __attribute__((export_name("TS_InvoiceFeatures_free"))) TS_InvoiceFeatures_free(uint64_t this_obj) {
37450         LDKInvoiceFeatures this_obj_conv;
37451         this_obj_conv.inner = untag_ptr(this_obj);
37452         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37454         InvoiceFeatures_free(this_obj_conv);
37455 }
37456
37457 void  __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint64_t this_obj) {
37458         LDKChannelTypeFeatures 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         ChannelTypeFeatures_free(this_obj_conv);
37463 }
37464
37465 uint64_t  __attribute__((export_name("TS_InitFeatures_known_channel_features"))) TS_InitFeatures_known_channel_features() {
37466         LDKInitFeatures ret_var = InitFeatures_known_channel_features();
37467         uint64_t ret_ref = 0;
37468         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37469         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37470         return ret_ref;
37471 }
37472
37473 uint64_t  __attribute__((export_name("TS_NodeFeatures_known_channel_features"))) TS_NodeFeatures_known_channel_features() {
37474         LDKNodeFeatures ret_var = NodeFeatures_known_channel_features();
37475         uint64_t ret_ref = 0;
37476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37478         return ret_ref;
37479 }
37480
37481 uint64_t  __attribute__((export_name("TS_InitFeatures_empty"))) TS_InitFeatures_empty() {
37482         LDKInitFeatures ret_var = InitFeatures_empty();
37483         uint64_t ret_ref = 0;
37484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37486         return ret_ref;
37487 }
37488
37489 uint64_t  __attribute__((export_name("TS_InitFeatures_known"))) TS_InitFeatures_known() {
37490         LDKInitFeatures ret_var = InitFeatures_known();
37491         uint64_t ret_ref = 0;
37492         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37493         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37494         return ret_ref;
37495 }
37496
37497 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits"))) TS_InitFeatures_requires_unknown_bits(uint64_t this_arg) {
37498         LDKInitFeatures this_arg_conv;
37499         this_arg_conv.inner = untag_ptr(this_arg);
37500         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37502         this_arg_conv.is_owned = false;
37503         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
37504         return ret_conv;
37505 }
37506
37507 uint64_t  __attribute__((export_name("TS_NodeFeatures_empty"))) TS_NodeFeatures_empty() {
37508         LDKNodeFeatures ret_var = NodeFeatures_empty();
37509         uint64_t ret_ref = 0;
37510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37512         return ret_ref;
37513 }
37514
37515 uint64_t  __attribute__((export_name("TS_NodeFeatures_known"))) TS_NodeFeatures_known() {
37516         LDKNodeFeatures ret_var = NodeFeatures_known();
37517         uint64_t ret_ref = 0;
37518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37520         return ret_ref;
37521 }
37522
37523 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits"))) TS_NodeFeatures_requires_unknown_bits(uint64_t this_arg) {
37524         LDKNodeFeatures this_arg_conv;
37525         this_arg_conv.inner = untag_ptr(this_arg);
37526         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37528         this_arg_conv.is_owned = false;
37529         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
37530         return ret_conv;
37531 }
37532
37533 uint64_t  __attribute__((export_name("TS_ChannelFeatures_empty"))) TS_ChannelFeatures_empty() {
37534         LDKChannelFeatures ret_var = ChannelFeatures_empty();
37535         uint64_t ret_ref = 0;
37536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37537         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37538         return ret_ref;
37539 }
37540
37541 uint64_t  __attribute__((export_name("TS_ChannelFeatures_known"))) TS_ChannelFeatures_known() {
37542         LDKChannelFeatures ret_var = ChannelFeatures_known();
37543         uint64_t ret_ref = 0;
37544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37546         return ret_ref;
37547 }
37548
37549 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits"))) TS_ChannelFeatures_requires_unknown_bits(uint64_t this_arg) {
37550         LDKChannelFeatures this_arg_conv;
37551         this_arg_conv.inner = untag_ptr(this_arg);
37552         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37554         this_arg_conv.is_owned = false;
37555         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
37556         return ret_conv;
37557 }
37558
37559 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_empty"))) TS_InvoiceFeatures_empty() {
37560         LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
37561         uint64_t ret_ref = 0;
37562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37564         return ret_ref;
37565 }
37566
37567 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_known"))) TS_InvoiceFeatures_known() {
37568         LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
37569         uint64_t ret_ref = 0;
37570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37572         return ret_ref;
37573 }
37574
37575 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_unknown_bits"))) TS_InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
37576         LDKInvoiceFeatures this_arg_conv;
37577         this_arg_conv.inner = untag_ptr(this_arg);
37578         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37580         this_arg_conv.is_owned = false;
37581         jboolean ret_conv = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
37582         return ret_conv;
37583 }
37584
37585 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() {
37586         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
37587         uint64_t ret_ref = 0;
37588         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37589         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37590         return ret_ref;
37591 }
37592
37593 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_known"))) TS_ChannelTypeFeatures_known() {
37594         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_known();
37595         uint64_t ret_ref = 0;
37596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37598         return ret_ref;
37599 }
37600
37601 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint64_t this_arg) {
37602         LDKChannelTypeFeatures this_arg_conv;
37603         this_arg_conv.inner = untag_ptr(this_arg);
37604         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37606         this_arg_conv.is_owned = false;
37607         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
37608         return ret_conv;
37609 }
37610
37611 int8_tArray  __attribute__((export_name("TS_InitFeatures_write"))) TS_InitFeatures_write(uint64_t obj) {
37612         LDKInitFeatures obj_conv;
37613         obj_conv.inner = untag_ptr(obj);
37614         obj_conv.is_owned = ptr_is_owned(obj);
37615         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37616         obj_conv.is_owned = false;
37617         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
37618         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37619         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37620         CVec_u8Z_free(ret_var);
37621         return ret_arr;
37622 }
37623
37624 uint64_t  __attribute__((export_name("TS_InitFeatures_read"))) TS_InitFeatures_read(int8_tArray ser) {
37625         LDKu8slice ser_ref;
37626         ser_ref.datalen = ser->arr_len;
37627         ser_ref.data = ser->elems;
37628         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
37629         *ret_conv = InitFeatures_read(ser_ref);
37630         FREE(ser);
37631         return tag_ptr(ret_conv, true);
37632 }
37633
37634 int8_tArray  __attribute__((export_name("TS_ChannelFeatures_write"))) TS_ChannelFeatures_write(uint64_t obj) {
37635         LDKChannelFeatures obj_conv;
37636         obj_conv.inner = untag_ptr(obj);
37637         obj_conv.is_owned = ptr_is_owned(obj);
37638         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37639         obj_conv.is_owned = false;
37640         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
37641         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37642         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37643         CVec_u8Z_free(ret_var);
37644         return ret_arr;
37645 }
37646
37647 uint64_t  __attribute__((export_name("TS_ChannelFeatures_read"))) TS_ChannelFeatures_read(int8_tArray ser) {
37648         LDKu8slice ser_ref;
37649         ser_ref.datalen = ser->arr_len;
37650         ser_ref.data = ser->elems;
37651         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
37652         *ret_conv = ChannelFeatures_read(ser_ref);
37653         FREE(ser);
37654         return tag_ptr(ret_conv, true);
37655 }
37656
37657 int8_tArray  __attribute__((export_name("TS_NodeFeatures_write"))) TS_NodeFeatures_write(uint64_t obj) {
37658         LDKNodeFeatures obj_conv;
37659         obj_conv.inner = untag_ptr(obj);
37660         obj_conv.is_owned = ptr_is_owned(obj);
37661         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37662         obj_conv.is_owned = false;
37663         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
37664         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37665         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37666         CVec_u8Z_free(ret_var);
37667         return ret_arr;
37668 }
37669
37670 uint64_t  __attribute__((export_name("TS_NodeFeatures_read"))) TS_NodeFeatures_read(int8_tArray ser) {
37671         LDKu8slice ser_ref;
37672         ser_ref.datalen = ser->arr_len;
37673         ser_ref.data = ser->elems;
37674         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
37675         *ret_conv = NodeFeatures_read(ser_ref);
37676         FREE(ser);
37677         return tag_ptr(ret_conv, true);
37678 }
37679
37680 int8_tArray  __attribute__((export_name("TS_InvoiceFeatures_write"))) TS_InvoiceFeatures_write(uint64_t obj) {
37681         LDKInvoiceFeatures obj_conv;
37682         obj_conv.inner = untag_ptr(obj);
37683         obj_conv.is_owned = ptr_is_owned(obj);
37684         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37685         obj_conv.is_owned = false;
37686         LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
37687         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37688         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37689         CVec_u8Z_free(ret_var);
37690         return ret_arr;
37691 }
37692
37693 uint64_t  __attribute__((export_name("TS_InvoiceFeatures_read"))) TS_InvoiceFeatures_read(int8_tArray ser) {
37694         LDKu8slice ser_ref;
37695         ser_ref.datalen = ser->arr_len;
37696         ser_ref.data = ser->elems;
37697         LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
37698         *ret_conv = InvoiceFeatures_read(ser_ref);
37699         FREE(ser);
37700         return tag_ptr(ret_conv, true);
37701 }
37702
37703 int8_tArray  __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint64_t obj) {
37704         LDKChannelTypeFeatures obj_conv;
37705         obj_conv.inner = untag_ptr(obj);
37706         obj_conv.is_owned = ptr_is_owned(obj);
37707         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
37708         obj_conv.is_owned = false;
37709         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
37710         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37711         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37712         CVec_u8Z_free(ret_var);
37713         return ret_arr;
37714 }
37715
37716 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
37717         LDKu8slice ser_ref;
37718         ser_ref.datalen = ser->arr_len;
37719         ser_ref.data = ser->elems;
37720         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
37721         *ret_conv = ChannelTypeFeatures_read(ser_ref);
37722         FREE(ser);
37723         return tag_ptr(ret_conv, true);
37724 }
37725
37726 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_optional"))) TS_InitFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
37727         LDKInitFeatures this_arg_conv;
37728         this_arg_conv.inner = untag_ptr(this_arg);
37729         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37731         this_arg_conv.is_owned = false;
37732         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
37733 }
37734
37735 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_required"))) TS_InitFeatures_set_data_loss_protect_required(uint64_t this_arg) {
37736         LDKInitFeatures this_arg_conv;
37737         this_arg_conv.inner = untag_ptr(this_arg);
37738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37740         this_arg_conv.is_owned = false;
37741         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
37742 }
37743
37744 jboolean  __attribute__((export_name("TS_InitFeatures_supports_data_loss_protect"))) TS_InitFeatures_supports_data_loss_protect(uint64_t this_arg) {
37745         LDKInitFeatures this_arg_conv;
37746         this_arg_conv.inner = untag_ptr(this_arg);
37747         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37749         this_arg_conv.is_owned = false;
37750         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
37751         return ret_conv;
37752 }
37753
37754 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_optional"))) TS_NodeFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
37755         LDKNodeFeatures this_arg_conv;
37756         this_arg_conv.inner = untag_ptr(this_arg);
37757         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37759         this_arg_conv.is_owned = false;
37760         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
37761 }
37762
37763 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_required"))) TS_NodeFeatures_set_data_loss_protect_required(uint64_t this_arg) {
37764         LDKNodeFeatures this_arg_conv;
37765         this_arg_conv.inner = untag_ptr(this_arg);
37766         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37768         this_arg_conv.is_owned = false;
37769         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
37770 }
37771
37772 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_data_loss_protect"))) TS_NodeFeatures_supports_data_loss_protect(uint64_t this_arg) {
37773         LDKNodeFeatures this_arg_conv;
37774         this_arg_conv.inner = untag_ptr(this_arg);
37775         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37777         this_arg_conv.is_owned = false;
37778         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
37779         return ret_conv;
37780 }
37781
37782 jboolean  __attribute__((export_name("TS_InitFeatures_requires_data_loss_protect"))) TS_InitFeatures_requires_data_loss_protect(uint64_t this_arg) {
37783         LDKInitFeatures this_arg_conv;
37784         this_arg_conv.inner = untag_ptr(this_arg);
37785         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37787         this_arg_conv.is_owned = false;
37788         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
37789         return ret_conv;
37790 }
37791
37792 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_data_loss_protect"))) TS_NodeFeatures_requires_data_loss_protect(uint64_t this_arg) {
37793         LDKNodeFeatures this_arg_conv;
37794         this_arg_conv.inner = untag_ptr(this_arg);
37795         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37797         this_arg_conv.is_owned = false;
37798         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
37799         return ret_conv;
37800 }
37801
37802 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_optional"))) TS_InitFeatures_set_initial_routing_sync_optional(uint64_t this_arg) {
37803         LDKInitFeatures this_arg_conv;
37804         this_arg_conv.inner = untag_ptr(this_arg);
37805         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37807         this_arg_conv.is_owned = false;
37808         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
37809 }
37810
37811 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_required"))) TS_InitFeatures_set_initial_routing_sync_required(uint64_t this_arg) {
37812         LDKInitFeatures this_arg_conv;
37813         this_arg_conv.inner = untag_ptr(this_arg);
37814         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37816         this_arg_conv.is_owned = false;
37817         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
37818 }
37819
37820 jboolean  __attribute__((export_name("TS_InitFeatures_initial_routing_sync"))) TS_InitFeatures_initial_routing_sync(uint64_t this_arg) {
37821         LDKInitFeatures this_arg_conv;
37822         this_arg_conv.inner = untag_ptr(this_arg);
37823         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37825         this_arg_conv.is_owned = false;
37826         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
37827         return ret_conv;
37828 }
37829
37830 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_optional"))) TS_InitFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
37831         LDKInitFeatures this_arg_conv;
37832         this_arg_conv.inner = untag_ptr(this_arg);
37833         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37835         this_arg_conv.is_owned = false;
37836         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
37837 }
37838
37839 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_required"))) TS_InitFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
37840         LDKInitFeatures this_arg_conv;
37841         this_arg_conv.inner = untag_ptr(this_arg);
37842         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37844         this_arg_conv.is_owned = false;
37845         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
37846 }
37847
37848 jboolean  __attribute__((export_name("TS_InitFeatures_supports_upfront_shutdown_script"))) TS_InitFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
37849         LDKInitFeatures this_arg_conv;
37850         this_arg_conv.inner = untag_ptr(this_arg);
37851         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37853         this_arg_conv.is_owned = false;
37854         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
37855         return ret_conv;
37856 }
37857
37858 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_optional"))) TS_NodeFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
37859         LDKNodeFeatures this_arg_conv;
37860         this_arg_conv.inner = untag_ptr(this_arg);
37861         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37863         this_arg_conv.is_owned = false;
37864         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
37865 }
37866
37867 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_required"))) TS_NodeFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
37868         LDKNodeFeatures this_arg_conv;
37869         this_arg_conv.inner = untag_ptr(this_arg);
37870         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37872         this_arg_conv.is_owned = false;
37873         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
37874 }
37875
37876 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_upfront_shutdown_script"))) TS_NodeFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
37877         LDKNodeFeatures this_arg_conv;
37878         this_arg_conv.inner = untag_ptr(this_arg);
37879         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37881         this_arg_conv.is_owned = false;
37882         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
37883         return ret_conv;
37884 }
37885
37886 jboolean  __attribute__((export_name("TS_InitFeatures_requires_upfront_shutdown_script"))) TS_InitFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
37887         LDKInitFeatures this_arg_conv;
37888         this_arg_conv.inner = untag_ptr(this_arg);
37889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37891         this_arg_conv.is_owned = false;
37892         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
37893         return ret_conv;
37894 }
37895
37896 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_upfront_shutdown_script"))) TS_NodeFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
37897         LDKNodeFeatures this_arg_conv;
37898         this_arg_conv.inner = untag_ptr(this_arg);
37899         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37901         this_arg_conv.is_owned = false;
37902         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
37903         return ret_conv;
37904 }
37905
37906 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_optional"))) TS_InitFeatures_set_gossip_queries_optional(uint64_t this_arg) {
37907         LDKInitFeatures this_arg_conv;
37908         this_arg_conv.inner = untag_ptr(this_arg);
37909         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37911         this_arg_conv.is_owned = false;
37912         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
37913 }
37914
37915 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_required"))) TS_InitFeatures_set_gossip_queries_required(uint64_t this_arg) {
37916         LDKInitFeatures this_arg_conv;
37917         this_arg_conv.inner = untag_ptr(this_arg);
37918         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37920         this_arg_conv.is_owned = false;
37921         InitFeatures_set_gossip_queries_required(&this_arg_conv);
37922 }
37923
37924 jboolean  __attribute__((export_name("TS_InitFeatures_supports_gossip_queries"))) TS_InitFeatures_supports_gossip_queries(uint64_t this_arg) {
37925         LDKInitFeatures this_arg_conv;
37926         this_arg_conv.inner = untag_ptr(this_arg);
37927         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37929         this_arg_conv.is_owned = false;
37930         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
37931         return ret_conv;
37932 }
37933
37934 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_optional"))) TS_NodeFeatures_set_gossip_queries_optional(uint64_t this_arg) {
37935         LDKNodeFeatures this_arg_conv;
37936         this_arg_conv.inner = untag_ptr(this_arg);
37937         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37939         this_arg_conv.is_owned = false;
37940         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
37941 }
37942
37943 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_required"))) TS_NodeFeatures_set_gossip_queries_required(uint64_t this_arg) {
37944         LDKNodeFeatures this_arg_conv;
37945         this_arg_conv.inner = untag_ptr(this_arg);
37946         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37948         this_arg_conv.is_owned = false;
37949         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
37950 }
37951
37952 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_gossip_queries"))) TS_NodeFeatures_supports_gossip_queries(uint64_t this_arg) {
37953         LDKNodeFeatures this_arg_conv;
37954         this_arg_conv.inner = untag_ptr(this_arg);
37955         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37957         this_arg_conv.is_owned = false;
37958         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
37959         return ret_conv;
37960 }
37961
37962 jboolean  __attribute__((export_name("TS_InitFeatures_requires_gossip_queries"))) TS_InitFeatures_requires_gossip_queries(uint64_t this_arg) {
37963         LDKInitFeatures this_arg_conv;
37964         this_arg_conv.inner = untag_ptr(this_arg);
37965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37967         this_arg_conv.is_owned = false;
37968         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
37969         return ret_conv;
37970 }
37971
37972 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_gossip_queries"))) TS_NodeFeatures_requires_gossip_queries(uint64_t this_arg) {
37973         LDKNodeFeatures this_arg_conv;
37974         this_arg_conv.inner = untag_ptr(this_arg);
37975         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37977         this_arg_conv.is_owned = false;
37978         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
37979         return ret_conv;
37980 }
37981
37982 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_optional"))) TS_InitFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
37983         LDKInitFeatures this_arg_conv;
37984         this_arg_conv.inner = untag_ptr(this_arg);
37985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37987         this_arg_conv.is_owned = false;
37988         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
37989 }
37990
37991 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_required"))) TS_InitFeatures_set_variable_length_onion_required(uint64_t this_arg) {
37992         LDKInitFeatures this_arg_conv;
37993         this_arg_conv.inner = untag_ptr(this_arg);
37994         this_arg_conv.is_owned = ptr_is_owned(this_arg);
37995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
37996         this_arg_conv.is_owned = false;
37997         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
37998 }
37999
38000 jboolean  __attribute__((export_name("TS_InitFeatures_supports_variable_length_onion"))) TS_InitFeatures_supports_variable_length_onion(uint64_t this_arg) {
38001         LDKInitFeatures this_arg_conv;
38002         this_arg_conv.inner = untag_ptr(this_arg);
38003         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38005         this_arg_conv.is_owned = false;
38006         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
38007         return ret_conv;
38008 }
38009
38010 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_optional"))) TS_NodeFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
38011         LDKNodeFeatures this_arg_conv;
38012         this_arg_conv.inner = untag_ptr(this_arg);
38013         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38015         this_arg_conv.is_owned = false;
38016         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
38017 }
38018
38019 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_required"))) TS_NodeFeatures_set_variable_length_onion_required(uint64_t this_arg) {
38020         LDKNodeFeatures this_arg_conv;
38021         this_arg_conv.inner = untag_ptr(this_arg);
38022         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38024         this_arg_conv.is_owned = false;
38025         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
38026 }
38027
38028 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_variable_length_onion"))) TS_NodeFeatures_supports_variable_length_onion(uint64_t this_arg) {
38029         LDKNodeFeatures this_arg_conv;
38030         this_arg_conv.inner = untag_ptr(this_arg);
38031         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38033         this_arg_conv.is_owned = false;
38034         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
38035         return ret_conv;
38036 }
38037
38038 void  __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_optional"))) TS_InvoiceFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
38039         LDKInvoiceFeatures this_arg_conv;
38040         this_arg_conv.inner = untag_ptr(this_arg);
38041         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38043         this_arg_conv.is_owned = false;
38044         InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
38045 }
38046
38047 void  __attribute__((export_name("TS_InvoiceFeatures_set_variable_length_onion_required"))) TS_InvoiceFeatures_set_variable_length_onion_required(uint64_t this_arg) {
38048         LDKInvoiceFeatures this_arg_conv;
38049         this_arg_conv.inner = untag_ptr(this_arg);
38050         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38052         this_arg_conv.is_owned = false;
38053         InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
38054 }
38055
38056 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_variable_length_onion"))) TS_InvoiceFeatures_supports_variable_length_onion(uint64_t this_arg) {
38057         LDKInvoiceFeatures this_arg_conv;
38058         this_arg_conv.inner = untag_ptr(this_arg);
38059         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38061         this_arg_conv.is_owned = false;
38062         jboolean ret_conv = InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
38063         return ret_conv;
38064 }
38065
38066 jboolean  __attribute__((export_name("TS_InitFeatures_requires_variable_length_onion"))) TS_InitFeatures_requires_variable_length_onion(uint64_t this_arg) {
38067         LDKInitFeatures this_arg_conv;
38068         this_arg_conv.inner = untag_ptr(this_arg);
38069         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38071         this_arg_conv.is_owned = false;
38072         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
38073         return ret_conv;
38074 }
38075
38076 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_variable_length_onion"))) TS_NodeFeatures_requires_variable_length_onion(uint64_t this_arg) {
38077         LDKNodeFeatures this_arg_conv;
38078         this_arg_conv.inner = untag_ptr(this_arg);
38079         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38081         this_arg_conv.is_owned = false;
38082         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
38083         return ret_conv;
38084 }
38085
38086 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_variable_length_onion"))) TS_InvoiceFeatures_requires_variable_length_onion(uint64_t this_arg) {
38087         LDKInvoiceFeatures this_arg_conv;
38088         this_arg_conv.inner = untag_ptr(this_arg);
38089         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38091         this_arg_conv.is_owned = false;
38092         jboolean ret_conv = InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
38093         return ret_conv;
38094 }
38095
38096 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_optional"))) TS_InitFeatures_set_static_remote_key_optional(uint64_t this_arg) {
38097         LDKInitFeatures this_arg_conv;
38098         this_arg_conv.inner = untag_ptr(this_arg);
38099         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38101         this_arg_conv.is_owned = false;
38102         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
38103 }
38104
38105 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_required"))) TS_InitFeatures_set_static_remote_key_required(uint64_t this_arg) {
38106         LDKInitFeatures this_arg_conv;
38107         this_arg_conv.inner = untag_ptr(this_arg);
38108         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38110         this_arg_conv.is_owned = false;
38111         InitFeatures_set_static_remote_key_required(&this_arg_conv);
38112 }
38113
38114 jboolean  __attribute__((export_name("TS_InitFeatures_supports_static_remote_key"))) TS_InitFeatures_supports_static_remote_key(uint64_t this_arg) {
38115         LDKInitFeatures this_arg_conv;
38116         this_arg_conv.inner = untag_ptr(this_arg);
38117         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38119         this_arg_conv.is_owned = false;
38120         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
38121         return ret_conv;
38122 }
38123
38124 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_optional"))) TS_NodeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
38125         LDKNodeFeatures this_arg_conv;
38126         this_arg_conv.inner = untag_ptr(this_arg);
38127         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38129         this_arg_conv.is_owned = false;
38130         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
38131 }
38132
38133 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_required"))) TS_NodeFeatures_set_static_remote_key_required(uint64_t this_arg) {
38134         LDKNodeFeatures this_arg_conv;
38135         this_arg_conv.inner = untag_ptr(this_arg);
38136         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38138         this_arg_conv.is_owned = false;
38139         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
38140 }
38141
38142 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_static_remote_key"))) TS_NodeFeatures_supports_static_remote_key(uint64_t this_arg) {
38143         LDKNodeFeatures this_arg_conv;
38144         this_arg_conv.inner = untag_ptr(this_arg);
38145         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38147         this_arg_conv.is_owned = false;
38148         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
38149         return ret_conv;
38150 }
38151
38152 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_optional"))) TS_ChannelTypeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
38153         LDKChannelTypeFeatures this_arg_conv;
38154         this_arg_conv.inner = untag_ptr(this_arg);
38155         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38157         this_arg_conv.is_owned = false;
38158         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
38159 }
38160
38161 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_required"))) TS_ChannelTypeFeatures_set_static_remote_key_required(uint64_t this_arg) {
38162         LDKChannelTypeFeatures this_arg_conv;
38163         this_arg_conv.inner = untag_ptr(this_arg);
38164         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38166         this_arg_conv.is_owned = false;
38167         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
38168 }
38169
38170 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_static_remote_key"))) TS_ChannelTypeFeatures_supports_static_remote_key(uint64_t this_arg) {
38171         LDKChannelTypeFeatures this_arg_conv;
38172         this_arg_conv.inner = untag_ptr(this_arg);
38173         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38175         this_arg_conv.is_owned = false;
38176         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
38177         return ret_conv;
38178 }
38179
38180 jboolean  __attribute__((export_name("TS_InitFeatures_requires_static_remote_key"))) TS_InitFeatures_requires_static_remote_key(uint64_t this_arg) {
38181         LDKInitFeatures this_arg_conv;
38182         this_arg_conv.inner = untag_ptr(this_arg);
38183         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38185         this_arg_conv.is_owned = false;
38186         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
38187         return ret_conv;
38188 }
38189
38190 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_static_remote_key"))) TS_NodeFeatures_requires_static_remote_key(uint64_t this_arg) {
38191         LDKNodeFeatures this_arg_conv;
38192         this_arg_conv.inner = untag_ptr(this_arg);
38193         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38195         this_arg_conv.is_owned = false;
38196         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
38197         return ret_conv;
38198 }
38199
38200 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_static_remote_key"))) TS_ChannelTypeFeatures_requires_static_remote_key(uint64_t this_arg) {
38201         LDKChannelTypeFeatures this_arg_conv;
38202         this_arg_conv.inner = untag_ptr(this_arg);
38203         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38205         this_arg_conv.is_owned = false;
38206         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
38207         return ret_conv;
38208 }
38209
38210 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_optional"))) TS_InitFeatures_set_payment_secret_optional(uint64_t this_arg) {
38211         LDKInitFeatures this_arg_conv;
38212         this_arg_conv.inner = untag_ptr(this_arg);
38213         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38215         this_arg_conv.is_owned = false;
38216         InitFeatures_set_payment_secret_optional(&this_arg_conv);
38217 }
38218
38219 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_required"))) TS_InitFeatures_set_payment_secret_required(uint64_t this_arg) {
38220         LDKInitFeatures this_arg_conv;
38221         this_arg_conv.inner = untag_ptr(this_arg);
38222         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38224         this_arg_conv.is_owned = false;
38225         InitFeatures_set_payment_secret_required(&this_arg_conv);
38226 }
38227
38228 jboolean  __attribute__((export_name("TS_InitFeatures_supports_payment_secret"))) TS_InitFeatures_supports_payment_secret(uint64_t this_arg) {
38229         LDKInitFeatures this_arg_conv;
38230         this_arg_conv.inner = untag_ptr(this_arg);
38231         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38233         this_arg_conv.is_owned = false;
38234         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
38235         return ret_conv;
38236 }
38237
38238 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_optional"))) TS_NodeFeatures_set_payment_secret_optional(uint64_t this_arg) {
38239         LDKNodeFeatures this_arg_conv;
38240         this_arg_conv.inner = untag_ptr(this_arg);
38241         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38243         this_arg_conv.is_owned = false;
38244         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
38245 }
38246
38247 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_required"))) TS_NodeFeatures_set_payment_secret_required(uint64_t this_arg) {
38248         LDKNodeFeatures this_arg_conv;
38249         this_arg_conv.inner = untag_ptr(this_arg);
38250         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38252         this_arg_conv.is_owned = false;
38253         NodeFeatures_set_payment_secret_required(&this_arg_conv);
38254 }
38255
38256 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_payment_secret"))) TS_NodeFeatures_supports_payment_secret(uint64_t this_arg) {
38257         LDKNodeFeatures this_arg_conv;
38258         this_arg_conv.inner = untag_ptr(this_arg);
38259         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38261         this_arg_conv.is_owned = false;
38262         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
38263         return ret_conv;
38264 }
38265
38266 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_optional"))) TS_InvoiceFeatures_set_payment_secret_optional(uint64_t this_arg) {
38267         LDKInvoiceFeatures this_arg_conv;
38268         this_arg_conv.inner = untag_ptr(this_arg);
38269         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38271         this_arg_conv.is_owned = false;
38272         InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
38273 }
38274
38275 void  __attribute__((export_name("TS_InvoiceFeatures_set_payment_secret_required"))) TS_InvoiceFeatures_set_payment_secret_required(uint64_t this_arg) {
38276         LDKInvoiceFeatures this_arg_conv;
38277         this_arg_conv.inner = untag_ptr(this_arg);
38278         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38279         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38280         this_arg_conv.is_owned = false;
38281         InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
38282 }
38283
38284 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_payment_secret"))) TS_InvoiceFeatures_supports_payment_secret(uint64_t this_arg) {
38285         LDKInvoiceFeatures this_arg_conv;
38286         this_arg_conv.inner = untag_ptr(this_arg);
38287         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38289         this_arg_conv.is_owned = false;
38290         jboolean ret_conv = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
38291         return ret_conv;
38292 }
38293
38294 jboolean  __attribute__((export_name("TS_InitFeatures_requires_payment_secret"))) TS_InitFeatures_requires_payment_secret(uint64_t this_arg) {
38295         LDKInitFeatures this_arg_conv;
38296         this_arg_conv.inner = untag_ptr(this_arg);
38297         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38299         this_arg_conv.is_owned = false;
38300         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
38301         return ret_conv;
38302 }
38303
38304 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_payment_secret"))) TS_NodeFeatures_requires_payment_secret(uint64_t this_arg) {
38305         LDKNodeFeatures this_arg_conv;
38306         this_arg_conv.inner = untag_ptr(this_arg);
38307         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38309         this_arg_conv.is_owned = false;
38310         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
38311         return ret_conv;
38312 }
38313
38314 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_payment_secret"))) TS_InvoiceFeatures_requires_payment_secret(uint64_t this_arg) {
38315         LDKInvoiceFeatures this_arg_conv;
38316         this_arg_conv.inner = untag_ptr(this_arg);
38317         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38319         this_arg_conv.is_owned = false;
38320         jboolean ret_conv = InvoiceFeatures_requires_payment_secret(&this_arg_conv);
38321         return ret_conv;
38322 }
38323
38324 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_optional"))) TS_InitFeatures_set_basic_mpp_optional(uint64_t this_arg) {
38325         LDKInitFeatures this_arg_conv;
38326         this_arg_conv.inner = untag_ptr(this_arg);
38327         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38329         this_arg_conv.is_owned = false;
38330         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
38331 }
38332
38333 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_required"))) TS_InitFeatures_set_basic_mpp_required(uint64_t this_arg) {
38334         LDKInitFeatures this_arg_conv;
38335         this_arg_conv.inner = untag_ptr(this_arg);
38336         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38338         this_arg_conv.is_owned = false;
38339         InitFeatures_set_basic_mpp_required(&this_arg_conv);
38340 }
38341
38342 jboolean  __attribute__((export_name("TS_InitFeatures_supports_basic_mpp"))) TS_InitFeatures_supports_basic_mpp(uint64_t this_arg) {
38343         LDKInitFeatures this_arg_conv;
38344         this_arg_conv.inner = untag_ptr(this_arg);
38345         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38347         this_arg_conv.is_owned = false;
38348         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
38349         return ret_conv;
38350 }
38351
38352 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_optional"))) TS_NodeFeatures_set_basic_mpp_optional(uint64_t this_arg) {
38353         LDKNodeFeatures this_arg_conv;
38354         this_arg_conv.inner = untag_ptr(this_arg);
38355         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38357         this_arg_conv.is_owned = false;
38358         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
38359 }
38360
38361 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_required"))) TS_NodeFeatures_set_basic_mpp_required(uint64_t this_arg) {
38362         LDKNodeFeatures this_arg_conv;
38363         this_arg_conv.inner = untag_ptr(this_arg);
38364         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38365         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38366         this_arg_conv.is_owned = false;
38367         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
38368 }
38369
38370 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_basic_mpp"))) TS_NodeFeatures_supports_basic_mpp(uint64_t this_arg) {
38371         LDKNodeFeatures this_arg_conv;
38372         this_arg_conv.inner = untag_ptr(this_arg);
38373         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38375         this_arg_conv.is_owned = false;
38376         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
38377         return ret_conv;
38378 }
38379
38380 void  __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_optional"))) TS_InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
38381         LDKInvoiceFeatures this_arg_conv;
38382         this_arg_conv.inner = untag_ptr(this_arg);
38383         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38385         this_arg_conv.is_owned = false;
38386         InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
38387 }
38388
38389 void  __attribute__((export_name("TS_InvoiceFeatures_set_basic_mpp_required"))) TS_InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
38390         LDKInvoiceFeatures this_arg_conv;
38391         this_arg_conv.inner = untag_ptr(this_arg);
38392         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38393         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38394         this_arg_conv.is_owned = false;
38395         InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
38396 }
38397
38398 jboolean  __attribute__((export_name("TS_InvoiceFeatures_supports_basic_mpp"))) TS_InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
38399         LDKInvoiceFeatures this_arg_conv;
38400         this_arg_conv.inner = untag_ptr(this_arg);
38401         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38403         this_arg_conv.is_owned = false;
38404         jboolean ret_conv = InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
38405         return ret_conv;
38406 }
38407
38408 jboolean  __attribute__((export_name("TS_InitFeatures_requires_basic_mpp"))) TS_InitFeatures_requires_basic_mpp(uint64_t this_arg) {
38409         LDKInitFeatures this_arg_conv;
38410         this_arg_conv.inner = untag_ptr(this_arg);
38411         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38413         this_arg_conv.is_owned = false;
38414         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
38415         return ret_conv;
38416 }
38417
38418 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_basic_mpp"))) TS_NodeFeatures_requires_basic_mpp(uint64_t this_arg) {
38419         LDKNodeFeatures this_arg_conv;
38420         this_arg_conv.inner = untag_ptr(this_arg);
38421         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38423         this_arg_conv.is_owned = false;
38424         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
38425         return ret_conv;
38426 }
38427
38428 jboolean  __attribute__((export_name("TS_InvoiceFeatures_requires_basic_mpp"))) TS_InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
38429         LDKInvoiceFeatures this_arg_conv;
38430         this_arg_conv.inner = untag_ptr(this_arg);
38431         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38433         this_arg_conv.is_owned = false;
38434         jboolean ret_conv = InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
38435         return ret_conv;
38436 }
38437
38438 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_optional"))) TS_InitFeatures_set_wumbo_optional(uint64_t this_arg) {
38439         LDKInitFeatures this_arg_conv;
38440         this_arg_conv.inner = untag_ptr(this_arg);
38441         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38443         this_arg_conv.is_owned = false;
38444         InitFeatures_set_wumbo_optional(&this_arg_conv);
38445 }
38446
38447 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_required"))) TS_InitFeatures_set_wumbo_required(uint64_t this_arg) {
38448         LDKInitFeatures this_arg_conv;
38449         this_arg_conv.inner = untag_ptr(this_arg);
38450         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38452         this_arg_conv.is_owned = false;
38453         InitFeatures_set_wumbo_required(&this_arg_conv);
38454 }
38455
38456 jboolean  __attribute__((export_name("TS_InitFeatures_supports_wumbo"))) TS_InitFeatures_supports_wumbo(uint64_t this_arg) {
38457         LDKInitFeatures this_arg_conv;
38458         this_arg_conv.inner = untag_ptr(this_arg);
38459         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38461         this_arg_conv.is_owned = false;
38462         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
38463         return ret_conv;
38464 }
38465
38466 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_optional"))) TS_NodeFeatures_set_wumbo_optional(uint64_t this_arg) {
38467         LDKNodeFeatures this_arg_conv;
38468         this_arg_conv.inner = untag_ptr(this_arg);
38469         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38471         this_arg_conv.is_owned = false;
38472         NodeFeatures_set_wumbo_optional(&this_arg_conv);
38473 }
38474
38475 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_required"))) TS_NodeFeatures_set_wumbo_required(uint64_t this_arg) {
38476         LDKNodeFeatures this_arg_conv;
38477         this_arg_conv.inner = untag_ptr(this_arg);
38478         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38480         this_arg_conv.is_owned = false;
38481         NodeFeatures_set_wumbo_required(&this_arg_conv);
38482 }
38483
38484 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_wumbo"))) TS_NodeFeatures_supports_wumbo(uint64_t this_arg) {
38485         LDKNodeFeatures this_arg_conv;
38486         this_arg_conv.inner = untag_ptr(this_arg);
38487         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38489         this_arg_conv.is_owned = false;
38490         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
38491         return ret_conv;
38492 }
38493
38494 jboolean  __attribute__((export_name("TS_InitFeatures_requires_wumbo"))) TS_InitFeatures_requires_wumbo(uint64_t this_arg) {
38495         LDKInitFeatures this_arg_conv;
38496         this_arg_conv.inner = untag_ptr(this_arg);
38497         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38499         this_arg_conv.is_owned = false;
38500         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
38501         return ret_conv;
38502 }
38503
38504 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_wumbo"))) TS_NodeFeatures_requires_wumbo(uint64_t this_arg) {
38505         LDKNodeFeatures this_arg_conv;
38506         this_arg_conv.inner = untag_ptr(this_arg);
38507         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38509         this_arg_conv.is_owned = false;
38510         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
38511         return ret_conv;
38512 }
38513
38514 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_optional"))) TS_InitFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
38515         LDKInitFeatures this_arg_conv;
38516         this_arg_conv.inner = untag_ptr(this_arg);
38517         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38519         this_arg_conv.is_owned = false;
38520         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
38521 }
38522
38523 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_required"))) TS_InitFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
38524         LDKInitFeatures this_arg_conv;
38525         this_arg_conv.inner = untag_ptr(this_arg);
38526         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38528         this_arg_conv.is_owned = false;
38529         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
38530 }
38531
38532 jboolean  __attribute__((export_name("TS_InitFeatures_supports_shutdown_anysegwit"))) TS_InitFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
38533         LDKInitFeatures this_arg_conv;
38534         this_arg_conv.inner = untag_ptr(this_arg);
38535         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38537         this_arg_conv.is_owned = false;
38538         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
38539         return ret_conv;
38540 }
38541
38542 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_optional"))) TS_NodeFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
38543         LDKNodeFeatures this_arg_conv;
38544         this_arg_conv.inner = untag_ptr(this_arg);
38545         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38547         this_arg_conv.is_owned = false;
38548         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
38549 }
38550
38551 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_required"))) TS_NodeFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
38552         LDKNodeFeatures this_arg_conv;
38553         this_arg_conv.inner = untag_ptr(this_arg);
38554         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38556         this_arg_conv.is_owned = false;
38557         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
38558 }
38559
38560 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_shutdown_anysegwit"))) TS_NodeFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
38561         LDKNodeFeatures this_arg_conv;
38562         this_arg_conv.inner = untag_ptr(this_arg);
38563         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38565         this_arg_conv.is_owned = false;
38566         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
38567         return ret_conv;
38568 }
38569
38570 jboolean  __attribute__((export_name("TS_InitFeatures_requires_shutdown_anysegwit"))) TS_InitFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
38571         LDKInitFeatures this_arg_conv;
38572         this_arg_conv.inner = untag_ptr(this_arg);
38573         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38575         this_arg_conv.is_owned = false;
38576         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
38577         return ret_conv;
38578 }
38579
38580 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_shutdown_anysegwit"))) TS_NodeFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
38581         LDKNodeFeatures this_arg_conv;
38582         this_arg_conv.inner = untag_ptr(this_arg);
38583         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38585         this_arg_conv.is_owned = false;
38586         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
38587         return ret_conv;
38588 }
38589
38590 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_optional"))) TS_InitFeatures_set_onion_messages_optional(uint64_t this_arg) {
38591         LDKInitFeatures this_arg_conv;
38592         this_arg_conv.inner = untag_ptr(this_arg);
38593         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38595         this_arg_conv.is_owned = false;
38596         InitFeatures_set_onion_messages_optional(&this_arg_conv);
38597 }
38598
38599 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_required"))) TS_InitFeatures_set_onion_messages_required(uint64_t this_arg) {
38600         LDKInitFeatures this_arg_conv;
38601         this_arg_conv.inner = untag_ptr(this_arg);
38602         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38604         this_arg_conv.is_owned = false;
38605         InitFeatures_set_onion_messages_required(&this_arg_conv);
38606 }
38607
38608 jboolean  __attribute__((export_name("TS_InitFeatures_supports_onion_messages"))) TS_InitFeatures_supports_onion_messages(uint64_t this_arg) {
38609         LDKInitFeatures this_arg_conv;
38610         this_arg_conv.inner = untag_ptr(this_arg);
38611         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38613         this_arg_conv.is_owned = false;
38614         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
38615         return ret_conv;
38616 }
38617
38618 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_optional"))) TS_NodeFeatures_set_onion_messages_optional(uint64_t this_arg) {
38619         LDKNodeFeatures this_arg_conv;
38620         this_arg_conv.inner = untag_ptr(this_arg);
38621         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38623         this_arg_conv.is_owned = false;
38624         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
38625 }
38626
38627 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_required"))) TS_NodeFeatures_set_onion_messages_required(uint64_t this_arg) {
38628         LDKNodeFeatures this_arg_conv;
38629         this_arg_conv.inner = untag_ptr(this_arg);
38630         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38632         this_arg_conv.is_owned = false;
38633         NodeFeatures_set_onion_messages_required(&this_arg_conv);
38634 }
38635
38636 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_onion_messages"))) TS_NodeFeatures_supports_onion_messages(uint64_t this_arg) {
38637         LDKNodeFeatures this_arg_conv;
38638         this_arg_conv.inner = untag_ptr(this_arg);
38639         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38641         this_arg_conv.is_owned = false;
38642         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
38643         return ret_conv;
38644 }
38645
38646 jboolean  __attribute__((export_name("TS_InitFeatures_requires_onion_messages"))) TS_InitFeatures_requires_onion_messages(uint64_t this_arg) {
38647         LDKInitFeatures this_arg_conv;
38648         this_arg_conv.inner = untag_ptr(this_arg);
38649         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38651         this_arg_conv.is_owned = false;
38652         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
38653         return ret_conv;
38654 }
38655
38656 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_onion_messages"))) TS_NodeFeatures_requires_onion_messages(uint64_t this_arg) {
38657         LDKNodeFeatures this_arg_conv;
38658         this_arg_conv.inner = untag_ptr(this_arg);
38659         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38661         this_arg_conv.is_owned = false;
38662         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
38663         return ret_conv;
38664 }
38665
38666 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_optional"))) TS_InitFeatures_set_channel_type_optional(uint64_t this_arg) {
38667         LDKInitFeatures this_arg_conv;
38668         this_arg_conv.inner = untag_ptr(this_arg);
38669         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38671         this_arg_conv.is_owned = false;
38672         InitFeatures_set_channel_type_optional(&this_arg_conv);
38673 }
38674
38675 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_required"))) TS_InitFeatures_set_channel_type_required(uint64_t this_arg) {
38676         LDKInitFeatures this_arg_conv;
38677         this_arg_conv.inner = untag_ptr(this_arg);
38678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38680         this_arg_conv.is_owned = false;
38681         InitFeatures_set_channel_type_required(&this_arg_conv);
38682 }
38683
38684 jboolean  __attribute__((export_name("TS_InitFeatures_supports_channel_type"))) TS_InitFeatures_supports_channel_type(uint64_t this_arg) {
38685         LDKInitFeatures this_arg_conv;
38686         this_arg_conv.inner = untag_ptr(this_arg);
38687         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38689         this_arg_conv.is_owned = false;
38690         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
38691         return ret_conv;
38692 }
38693
38694 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_optional"))) TS_NodeFeatures_set_channel_type_optional(uint64_t this_arg) {
38695         LDKNodeFeatures this_arg_conv;
38696         this_arg_conv.inner = untag_ptr(this_arg);
38697         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38699         this_arg_conv.is_owned = false;
38700         NodeFeatures_set_channel_type_optional(&this_arg_conv);
38701 }
38702
38703 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_required"))) TS_NodeFeatures_set_channel_type_required(uint64_t this_arg) {
38704         LDKNodeFeatures this_arg_conv;
38705         this_arg_conv.inner = untag_ptr(this_arg);
38706         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38708         this_arg_conv.is_owned = false;
38709         NodeFeatures_set_channel_type_required(&this_arg_conv);
38710 }
38711
38712 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_channel_type"))) TS_NodeFeatures_supports_channel_type(uint64_t this_arg) {
38713         LDKNodeFeatures this_arg_conv;
38714         this_arg_conv.inner = untag_ptr(this_arg);
38715         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38717         this_arg_conv.is_owned = false;
38718         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
38719         return ret_conv;
38720 }
38721
38722 jboolean  __attribute__((export_name("TS_InitFeatures_requires_channel_type"))) TS_InitFeatures_requires_channel_type(uint64_t this_arg) {
38723         LDKInitFeatures this_arg_conv;
38724         this_arg_conv.inner = untag_ptr(this_arg);
38725         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38727         this_arg_conv.is_owned = false;
38728         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
38729         return ret_conv;
38730 }
38731
38732 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_channel_type"))) TS_NodeFeatures_requires_channel_type(uint64_t this_arg) {
38733         LDKNodeFeatures this_arg_conv;
38734         this_arg_conv.inner = untag_ptr(this_arg);
38735         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38737         this_arg_conv.is_owned = false;
38738         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
38739         return ret_conv;
38740 }
38741
38742 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_optional"))) TS_InitFeatures_set_scid_privacy_optional(uint64_t this_arg) {
38743         LDKInitFeatures this_arg_conv;
38744         this_arg_conv.inner = untag_ptr(this_arg);
38745         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38747         this_arg_conv.is_owned = false;
38748         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
38749 }
38750
38751 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_required"))) TS_InitFeatures_set_scid_privacy_required(uint64_t this_arg) {
38752         LDKInitFeatures this_arg_conv;
38753         this_arg_conv.inner = untag_ptr(this_arg);
38754         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38756         this_arg_conv.is_owned = false;
38757         InitFeatures_set_scid_privacy_required(&this_arg_conv);
38758 }
38759
38760 jboolean  __attribute__((export_name("TS_InitFeatures_supports_scid_privacy"))) TS_InitFeatures_supports_scid_privacy(uint64_t this_arg) {
38761         LDKInitFeatures this_arg_conv;
38762         this_arg_conv.inner = untag_ptr(this_arg);
38763         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38765         this_arg_conv.is_owned = false;
38766         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
38767         return ret_conv;
38768 }
38769
38770 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_optional"))) TS_NodeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
38771         LDKNodeFeatures this_arg_conv;
38772         this_arg_conv.inner = untag_ptr(this_arg);
38773         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38775         this_arg_conv.is_owned = false;
38776         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
38777 }
38778
38779 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_required"))) TS_NodeFeatures_set_scid_privacy_required(uint64_t this_arg) {
38780         LDKNodeFeatures this_arg_conv;
38781         this_arg_conv.inner = untag_ptr(this_arg);
38782         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38784         this_arg_conv.is_owned = false;
38785         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
38786 }
38787
38788 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_scid_privacy"))) TS_NodeFeatures_supports_scid_privacy(uint64_t this_arg) {
38789         LDKNodeFeatures this_arg_conv;
38790         this_arg_conv.inner = untag_ptr(this_arg);
38791         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38793         this_arg_conv.is_owned = false;
38794         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
38795         return ret_conv;
38796 }
38797
38798 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_optional"))) TS_ChannelTypeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
38799         LDKChannelTypeFeatures this_arg_conv;
38800         this_arg_conv.inner = untag_ptr(this_arg);
38801         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38803         this_arg_conv.is_owned = false;
38804         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
38805 }
38806
38807 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_required"))) TS_ChannelTypeFeatures_set_scid_privacy_required(uint64_t this_arg) {
38808         LDKChannelTypeFeatures 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         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
38814 }
38815
38816 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_scid_privacy"))) TS_ChannelTypeFeatures_supports_scid_privacy(uint64_t this_arg) {
38817         LDKChannelTypeFeatures this_arg_conv;
38818         this_arg_conv.inner = untag_ptr(this_arg);
38819         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38821         this_arg_conv.is_owned = false;
38822         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
38823         return ret_conv;
38824 }
38825
38826 jboolean  __attribute__((export_name("TS_InitFeatures_requires_scid_privacy"))) TS_InitFeatures_requires_scid_privacy(uint64_t this_arg) {
38827         LDKInitFeatures this_arg_conv;
38828         this_arg_conv.inner = untag_ptr(this_arg);
38829         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38830         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38831         this_arg_conv.is_owned = false;
38832         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
38833         return ret_conv;
38834 }
38835
38836 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_scid_privacy"))) TS_NodeFeatures_requires_scid_privacy(uint64_t this_arg) {
38837         LDKNodeFeatures this_arg_conv;
38838         this_arg_conv.inner = untag_ptr(this_arg);
38839         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38841         this_arg_conv.is_owned = false;
38842         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
38843         return ret_conv;
38844 }
38845
38846 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_scid_privacy"))) TS_ChannelTypeFeatures_requires_scid_privacy(uint64_t this_arg) {
38847         LDKChannelTypeFeatures this_arg_conv;
38848         this_arg_conv.inner = untag_ptr(this_arg);
38849         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38851         this_arg_conv.is_owned = false;
38852         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
38853         return ret_conv;
38854 }
38855
38856 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_optional"))) TS_InitFeatures_set_zero_conf_optional(uint64_t this_arg) {
38857         LDKInitFeatures this_arg_conv;
38858         this_arg_conv.inner = untag_ptr(this_arg);
38859         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38861         this_arg_conv.is_owned = false;
38862         InitFeatures_set_zero_conf_optional(&this_arg_conv);
38863 }
38864
38865 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_required"))) TS_InitFeatures_set_zero_conf_required(uint64_t this_arg) {
38866         LDKInitFeatures this_arg_conv;
38867         this_arg_conv.inner = untag_ptr(this_arg);
38868         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38870         this_arg_conv.is_owned = false;
38871         InitFeatures_set_zero_conf_required(&this_arg_conv);
38872 }
38873
38874 jboolean  __attribute__((export_name("TS_InitFeatures_supports_zero_conf"))) TS_InitFeatures_supports_zero_conf(uint64_t this_arg) {
38875         LDKInitFeatures this_arg_conv;
38876         this_arg_conv.inner = untag_ptr(this_arg);
38877         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38879         this_arg_conv.is_owned = false;
38880         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
38881         return ret_conv;
38882 }
38883
38884 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_optional"))) TS_NodeFeatures_set_zero_conf_optional(uint64_t this_arg) {
38885         LDKNodeFeatures this_arg_conv;
38886         this_arg_conv.inner = untag_ptr(this_arg);
38887         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38889         this_arg_conv.is_owned = false;
38890         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
38891 }
38892
38893 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_required"))) TS_NodeFeatures_set_zero_conf_required(uint64_t this_arg) {
38894         LDKNodeFeatures this_arg_conv;
38895         this_arg_conv.inner = untag_ptr(this_arg);
38896         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38898         this_arg_conv.is_owned = false;
38899         NodeFeatures_set_zero_conf_required(&this_arg_conv);
38900 }
38901
38902 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_zero_conf"))) TS_NodeFeatures_supports_zero_conf(uint64_t this_arg) {
38903         LDKNodeFeatures this_arg_conv;
38904         this_arg_conv.inner = untag_ptr(this_arg);
38905         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38907         this_arg_conv.is_owned = false;
38908         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
38909         return ret_conv;
38910 }
38911
38912 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_optional"))) TS_ChannelTypeFeatures_set_zero_conf_optional(uint64_t this_arg) {
38913         LDKChannelTypeFeatures this_arg_conv;
38914         this_arg_conv.inner = untag_ptr(this_arg);
38915         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38917         this_arg_conv.is_owned = false;
38918         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
38919 }
38920
38921 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_required"))) TS_ChannelTypeFeatures_set_zero_conf_required(uint64_t this_arg) {
38922         LDKChannelTypeFeatures this_arg_conv;
38923         this_arg_conv.inner = untag_ptr(this_arg);
38924         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38926         this_arg_conv.is_owned = false;
38927         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
38928 }
38929
38930 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_zero_conf"))) TS_ChannelTypeFeatures_supports_zero_conf(uint64_t this_arg) {
38931         LDKChannelTypeFeatures this_arg_conv;
38932         this_arg_conv.inner = untag_ptr(this_arg);
38933         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38935         this_arg_conv.is_owned = false;
38936         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
38937         return ret_conv;
38938 }
38939
38940 jboolean  __attribute__((export_name("TS_InitFeatures_requires_zero_conf"))) TS_InitFeatures_requires_zero_conf(uint64_t this_arg) {
38941         LDKInitFeatures this_arg_conv;
38942         this_arg_conv.inner = untag_ptr(this_arg);
38943         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38945         this_arg_conv.is_owned = false;
38946         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
38947         return ret_conv;
38948 }
38949
38950 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_zero_conf"))) TS_NodeFeatures_requires_zero_conf(uint64_t this_arg) {
38951         LDKNodeFeatures this_arg_conv;
38952         this_arg_conv.inner = untag_ptr(this_arg);
38953         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38955         this_arg_conv.is_owned = false;
38956         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
38957         return ret_conv;
38958 }
38959
38960 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_zero_conf"))) TS_ChannelTypeFeatures_requires_zero_conf(uint64_t this_arg) {
38961         LDKChannelTypeFeatures this_arg_conv;
38962         this_arg_conv.inner = untag_ptr(this_arg);
38963         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38965         this_arg_conv.is_owned = false;
38966         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
38967         return ret_conv;
38968 }
38969
38970 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_optional"))) TS_NodeFeatures_set_keysend_optional(uint64_t this_arg) {
38971         LDKNodeFeatures this_arg_conv;
38972         this_arg_conv.inner = untag_ptr(this_arg);
38973         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38975         this_arg_conv.is_owned = false;
38976         NodeFeatures_set_keysend_optional(&this_arg_conv);
38977 }
38978
38979 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_required"))) TS_NodeFeatures_set_keysend_required(uint64_t this_arg) {
38980         LDKNodeFeatures this_arg_conv;
38981         this_arg_conv.inner = untag_ptr(this_arg);
38982         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38984         this_arg_conv.is_owned = false;
38985         NodeFeatures_set_keysend_required(&this_arg_conv);
38986 }
38987
38988 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_keysend"))) TS_NodeFeatures_supports_keysend(uint64_t this_arg) {
38989         LDKNodeFeatures this_arg_conv;
38990         this_arg_conv.inner = untag_ptr(this_arg);
38991         this_arg_conv.is_owned = ptr_is_owned(this_arg);
38992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
38993         this_arg_conv.is_owned = false;
38994         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
38995         return ret_conv;
38996 }
38997
38998 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_keysend"))) TS_NodeFeatures_requires_keysend(uint64_t this_arg) {
38999         LDKNodeFeatures this_arg_conv;
39000         this_arg_conv.inner = untag_ptr(this_arg);
39001         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39003         this_arg_conv.is_owned = false;
39004         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
39005         return ret_conv;
39006 }
39007
39008 void  __attribute__((export_name("TS_ShutdownScript_free"))) TS_ShutdownScript_free(uint64_t this_obj) {
39009         LDKShutdownScript this_obj_conv;
39010         this_obj_conv.inner = untag_ptr(this_obj);
39011         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39012         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39013         ShutdownScript_free(this_obj_conv);
39014 }
39015
39016 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
39017         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
39018         uint64_t ret_ref = 0;
39019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39021         return ret_ref;
39022 }
39023 int64_t  __attribute__((export_name("TS_ShutdownScript_clone_ptr"))) TS_ShutdownScript_clone_ptr(uint64_t arg) {
39024         LDKShutdownScript arg_conv;
39025         arg_conv.inner = untag_ptr(arg);
39026         arg_conv.is_owned = ptr_is_owned(arg);
39027         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39028         arg_conv.is_owned = false;
39029         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
39030         return ret_conv;
39031 }
39032
39033 uint64_t  __attribute__((export_name("TS_ShutdownScript_clone"))) TS_ShutdownScript_clone(uint64_t orig) {
39034         LDKShutdownScript orig_conv;
39035         orig_conv.inner = untag_ptr(orig);
39036         orig_conv.is_owned = ptr_is_owned(orig);
39037         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39038         orig_conv.is_owned = false;
39039         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
39040         uint64_t ret_ref = 0;
39041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39043         return ret_ref;
39044 }
39045
39046 void  __attribute__((export_name("TS_InvalidShutdownScript_free"))) TS_InvalidShutdownScript_free(uint64_t this_obj) {
39047         LDKInvalidShutdownScript this_obj_conv;
39048         this_obj_conv.inner = untag_ptr(this_obj);
39049         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39051         InvalidShutdownScript_free(this_obj_conv);
39052 }
39053
39054 int8_tArray  __attribute__((export_name("TS_InvalidShutdownScript_get_script"))) TS_InvalidShutdownScript_get_script(uint64_t this_ptr) {
39055         LDKInvalidShutdownScript this_ptr_conv;
39056         this_ptr_conv.inner = untag_ptr(this_ptr);
39057         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39059         this_ptr_conv.is_owned = false;
39060         LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
39061         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39062         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39063         return ret_arr;
39064 }
39065
39066 void  __attribute__((export_name("TS_InvalidShutdownScript_set_script"))) TS_InvalidShutdownScript_set_script(uint64_t this_ptr, int8_tArray val) {
39067         LDKInvalidShutdownScript this_ptr_conv;
39068         this_ptr_conv.inner = untag_ptr(this_ptr);
39069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39071         this_ptr_conv.is_owned = false;
39072         LDKCVec_u8Z val_ref;
39073         val_ref.datalen = val->arr_len;
39074         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
39075         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
39076         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
39077 }
39078
39079 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_new"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
39080         LDKCVec_u8Z script_arg_ref;
39081         script_arg_ref.datalen = script_arg->arr_len;
39082         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
39083         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
39084         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
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 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
39092         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
39093         uint64_t ret_ref = 0;
39094         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39095         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39096         return ret_ref;
39097 }
39098 int64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone_ptr"))) TS_InvalidShutdownScript_clone_ptr(uint64_t arg) {
39099         LDKInvalidShutdownScript arg_conv;
39100         arg_conv.inner = untag_ptr(arg);
39101         arg_conv.is_owned = ptr_is_owned(arg);
39102         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39103         arg_conv.is_owned = false;
39104         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
39105         return ret_conv;
39106 }
39107
39108 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone"))) TS_InvalidShutdownScript_clone(uint64_t orig) {
39109         LDKInvalidShutdownScript orig_conv;
39110         orig_conv.inner = untag_ptr(orig);
39111         orig_conv.is_owned = ptr_is_owned(orig);
39112         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39113         orig_conv.is_owned = false;
39114         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
39115         uint64_t ret_ref = 0;
39116         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39117         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39118         return ret_ref;
39119 }
39120
39121 int8_tArray  __attribute__((export_name("TS_ShutdownScript_write"))) TS_ShutdownScript_write(uint64_t obj) {
39122         LDKShutdownScript obj_conv;
39123         obj_conv.inner = untag_ptr(obj);
39124         obj_conv.is_owned = ptr_is_owned(obj);
39125         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39126         obj_conv.is_owned = false;
39127         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
39128         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39129         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39130         CVec_u8Z_free(ret_var);
39131         return ret_arr;
39132 }
39133
39134 uint64_t  __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScript_read(int8_tArray ser) {
39135         LDKu8slice ser_ref;
39136         ser_ref.datalen = ser->arr_len;
39137         ser_ref.data = ser->elems;
39138         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
39139         *ret_conv = ShutdownScript_read(ser_ref);
39140         FREE(ser);
39141         return tag_ptr(ret_conv, true);
39142 }
39143
39144 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
39145         unsigned char pubkey_hash_arr[20];
39146         CHECK(pubkey_hash->arr_len == 20);
39147         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
39148         unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
39149         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
39150         uint64_t ret_ref = 0;
39151         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39152         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39153         return ret_ref;
39154 }
39155
39156 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
39157         unsigned char script_hash_arr[32];
39158         CHECK(script_hash->arr_len == 32);
39159         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
39160         unsigned char (*script_hash_ref)[32] = &script_hash_arr;
39161         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
39162         uint64_t ret_ref = 0;
39163         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39164         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39165         return ret_ref;
39166 }
39167
39168 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_witness_program"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
39169         
39170         LDKu8slice program_ref;
39171         program_ref.datalen = program->arr_len;
39172         program_ref.data = program->elems;
39173         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
39174         *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
39175         FREE(program);
39176         return tag_ptr(ret_conv, true);
39177 }
39178
39179 int8_tArray  __attribute__((export_name("TS_ShutdownScript_into_inner"))) TS_ShutdownScript_into_inner(uint64_t this_arg) {
39180         LDKShutdownScript this_arg_conv;
39181         this_arg_conv.inner = untag_ptr(this_arg);
39182         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39184         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
39185         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
39186         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39187         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39188         CVec_u8Z_free(ret_var);
39189         return ret_arr;
39190 }
39191
39192 int8_tArray  __attribute__((export_name("TS_ShutdownScript_as_legacy_pubkey"))) TS_ShutdownScript_as_legacy_pubkey(uint64_t this_arg) {
39193         LDKShutdownScript this_arg_conv;
39194         this_arg_conv.inner = untag_ptr(this_arg);
39195         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39197         this_arg_conv.is_owned = false;
39198         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39199         memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
39200         return ret_arr;
39201 }
39202
39203 jboolean  __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_ShutdownScript_is_compatible(uint64_t this_arg, uint64_t features) {
39204         LDKShutdownScript this_arg_conv;
39205         this_arg_conv.inner = untag_ptr(this_arg);
39206         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39208         this_arg_conv.is_owned = false;
39209         LDKInitFeatures features_conv;
39210         features_conv.inner = untag_ptr(features);
39211         features_conv.is_owned = ptr_is_owned(features);
39212         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
39213         features_conv.is_owned = false;
39214         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
39215         return ret_conv;
39216 }
39217
39218 void  __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint64_t this_ptr) {
39219         if (!ptr_is_owned(this_ptr)) return;
39220         void* this_ptr_ptr = untag_ptr(this_ptr);
39221         CHECK_ACCESS(this_ptr_ptr);
39222         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
39223         FREE(untag_ptr(this_ptr));
39224         CustomMessageReader_free(this_ptr_conv);
39225 }
39226
39227 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
39228         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
39229         *ret_ret = Type_clone(arg);
39230         return tag_ptr(ret_ret, true);
39231 }
39232 int64_t  __attribute__((export_name("TS_Type_clone_ptr"))) TS_Type_clone_ptr(uint64_t arg) {
39233         void* arg_ptr = untag_ptr(arg);
39234         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
39235         LDKType* arg_conv = (LDKType*)arg_ptr;
39236         int64_t ret_conv = Type_clone_ptr(arg_conv);
39237         return ret_conv;
39238 }
39239
39240 uint64_t  __attribute__((export_name("TS_Type_clone"))) TS_Type_clone(uint64_t orig) {
39241         void* orig_ptr = untag_ptr(orig);
39242         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
39243         LDKType* orig_conv = (LDKType*)orig_ptr;
39244         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
39245         *ret_ret = Type_clone(orig_conv);
39246         return tag_ptr(ret_ret, true);
39247 }
39248
39249 void  __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint64_t this_ptr) {
39250         if (!ptr_is_owned(this_ptr)) return;
39251         void* this_ptr_ptr = untag_ptr(this_ptr);
39252         CHECK_ACCESS(this_ptr_ptr);
39253         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
39254         FREE(untag_ptr(this_ptr));
39255         Type_free(this_ptr_conv);
39256 }
39257
39258 void  __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint64_t this_obj) {
39259         LDKNodeId this_obj_conv;
39260         this_obj_conv.inner = untag_ptr(this_obj);
39261         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39263         NodeId_free(this_obj_conv);
39264 }
39265
39266 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
39267         LDKNodeId ret_var = NodeId_clone(arg);
39268         uint64_t ret_ref = 0;
39269         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39270         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39271         return ret_ref;
39272 }
39273 int64_t  __attribute__((export_name("TS_NodeId_clone_ptr"))) TS_NodeId_clone_ptr(uint64_t arg) {
39274         LDKNodeId arg_conv;
39275         arg_conv.inner = untag_ptr(arg);
39276         arg_conv.is_owned = ptr_is_owned(arg);
39277         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39278         arg_conv.is_owned = false;
39279         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
39280         return ret_conv;
39281 }
39282
39283 uint64_t  __attribute__((export_name("TS_NodeId_clone"))) TS_NodeId_clone(uint64_t orig) {
39284         LDKNodeId orig_conv;
39285         orig_conv.inner = untag_ptr(orig);
39286         orig_conv.is_owned = ptr_is_owned(orig);
39287         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39288         orig_conv.is_owned = false;
39289         LDKNodeId ret_var = NodeId_clone(&orig_conv);
39290         uint64_t ret_ref = 0;
39291         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39292         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39293         return ret_ref;
39294 }
39295
39296 uint64_t  __attribute__((export_name("TS_NodeId_from_pubkey"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
39297         LDKPublicKey pubkey_ref;
39298         CHECK(pubkey->arr_len == 33);
39299         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
39300         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
39301         uint64_t ret_ref = 0;
39302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39304         return ret_ref;
39305 }
39306
39307 int8_tArray  __attribute__((export_name("TS_NodeId_as_slice"))) TS_NodeId_as_slice(uint64_t this_arg) {
39308         LDKNodeId this_arg_conv;
39309         this_arg_conv.inner = untag_ptr(this_arg);
39310         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39312         this_arg_conv.is_owned = false;
39313         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
39314         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39315         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39316         return ret_arr;
39317 }
39318
39319 int64_t  __attribute__((export_name("TS_NodeId_hash"))) TS_NodeId_hash(uint64_t o) {
39320         LDKNodeId o_conv;
39321         o_conv.inner = untag_ptr(o);
39322         o_conv.is_owned = ptr_is_owned(o);
39323         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39324         o_conv.is_owned = false;
39325         int64_t ret_conv = NodeId_hash(&o_conv);
39326         return ret_conv;
39327 }
39328
39329 int8_tArray  __attribute__((export_name("TS_NodeId_write"))) TS_NodeId_write(uint64_t obj) {
39330         LDKNodeId obj_conv;
39331         obj_conv.inner = untag_ptr(obj);
39332         obj_conv.is_owned = ptr_is_owned(obj);
39333         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39334         obj_conv.is_owned = false;
39335         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
39336         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39337         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39338         CVec_u8Z_free(ret_var);
39339         return ret_arr;
39340 }
39341
39342 uint64_t  __attribute__((export_name("TS_NodeId_read"))) TS_NodeId_read(int8_tArray ser) {
39343         LDKu8slice ser_ref;
39344         ser_ref.datalen = ser->arr_len;
39345         ser_ref.data = ser->elems;
39346         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
39347         *ret_conv = NodeId_read(ser_ref);
39348         FREE(ser);
39349         return tag_ptr(ret_conv, true);
39350 }
39351
39352 void  __attribute__((export_name("TS_NetworkGraph_free"))) TS_NetworkGraph_free(uint64_t this_obj) {
39353         LDKNetworkGraph this_obj_conv;
39354         this_obj_conv.inner = untag_ptr(this_obj);
39355         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39357         NetworkGraph_free(this_obj_conv);
39358 }
39359
39360 void  __attribute__((export_name("TS_ReadOnlyNetworkGraph_free"))) TS_ReadOnlyNetworkGraph_free(uint64_t this_obj) {
39361         LDKReadOnlyNetworkGraph this_obj_conv;
39362         this_obj_conv.inner = untag_ptr(this_obj);
39363         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39365         ReadOnlyNetworkGraph_free(this_obj_conv);
39366 }
39367
39368 void  __attribute__((export_name("TS_NetworkUpdate_free"))) TS_NetworkUpdate_free(uint64_t this_ptr) {
39369         if (!ptr_is_owned(this_ptr)) return;
39370         void* this_ptr_ptr = untag_ptr(this_ptr);
39371         CHECK_ACCESS(this_ptr_ptr);
39372         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
39373         FREE(untag_ptr(this_ptr));
39374         NetworkUpdate_free(this_ptr_conv);
39375 }
39376
39377 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
39378         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39379         *ret_copy = NetworkUpdate_clone(arg);
39380         uint64_t ret_ref = tag_ptr(ret_copy, true);
39381         return ret_ref;
39382 }
39383 int64_t  __attribute__((export_name("TS_NetworkUpdate_clone_ptr"))) TS_NetworkUpdate_clone_ptr(uint64_t arg) {
39384         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
39385         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
39386         return ret_conv;
39387 }
39388
39389 uint64_t  __attribute__((export_name("TS_NetworkUpdate_clone"))) TS_NetworkUpdate_clone(uint64_t orig) {
39390         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
39391         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39392         *ret_copy = NetworkUpdate_clone(orig_conv);
39393         uint64_t ret_ref = tag_ptr(ret_copy, true);
39394         return ret_ref;
39395 }
39396
39397 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_update_message"))) TS_NetworkUpdate_channel_update_message(uint64_t msg) {
39398         LDKChannelUpdate msg_conv;
39399         msg_conv.inner = untag_ptr(msg);
39400         msg_conv.is_owned = ptr_is_owned(msg);
39401         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
39402         msg_conv = ChannelUpdate_clone(&msg_conv);
39403         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39404         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
39405         uint64_t ret_ref = tag_ptr(ret_copy, true);
39406         return ret_ref;
39407 }
39408
39409 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_failure"))) TS_NetworkUpdate_channel_failure(int64_t short_channel_id, jboolean is_permanent) {
39410         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39411         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
39412         uint64_t ret_ref = tag_ptr(ret_copy, true);
39413         return ret_ref;
39414 }
39415
39416 uint64_t  __attribute__((export_name("TS_NetworkUpdate_node_failure"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
39417         LDKPublicKey node_id_ref;
39418         CHECK(node_id->arr_len == 33);
39419         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
39420         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
39421         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
39422         uint64_t ret_ref = tag_ptr(ret_copy, true);
39423         return ret_ref;
39424 }
39425
39426 int8_tArray  __attribute__((export_name("TS_NetworkUpdate_write"))) TS_NetworkUpdate_write(uint64_t obj) {
39427         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
39428         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
39429         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39430         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39431         CVec_u8Z_free(ret_var);
39432         return ret_arr;
39433 }
39434
39435 uint64_t  __attribute__((export_name("TS_NetworkUpdate_read"))) TS_NetworkUpdate_read(int8_tArray ser) {
39436         LDKu8slice ser_ref;
39437         ser_ref.datalen = ser->arr_len;
39438         ser_ref.data = ser->elems;
39439         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
39440         *ret_conv = NetworkUpdate_read(ser_ref);
39441         FREE(ser);
39442         return tag_ptr(ret_conv, true);
39443 }
39444
39445 void  __attribute__((export_name("TS_P2PGossipSync_free"))) TS_P2PGossipSync_free(uint64_t this_obj) {
39446         LDKP2PGossipSync this_obj_conv;
39447         this_obj_conv.inner = untag_ptr(this_obj);
39448         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39450         P2PGossipSync_free(this_obj_conv);
39451 }
39452
39453 uint64_t  __attribute__((export_name("TS_P2PGossipSync_new"))) TS_P2PGossipSync_new(uint64_t network_graph, uint64_t chain_access, uint64_t logger) {
39454         LDKNetworkGraph network_graph_conv;
39455         network_graph_conv.inner = untag_ptr(network_graph);
39456         network_graph_conv.is_owned = ptr_is_owned(network_graph);
39457         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
39458         network_graph_conv.is_owned = false;
39459         void* chain_access_ptr = untag_ptr(chain_access);
39460         CHECK_ACCESS(chain_access_ptr);
39461         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
39462         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
39463         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
39464                 // Manually implement clone for Java trait instances
39465                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
39466                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39467                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
39468                 }
39469         }
39470         void* logger_ptr = untag_ptr(logger);
39471         CHECK_ACCESS(logger_ptr);
39472         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
39473         if (logger_conv.free == LDKLogger_JCalls_free) {
39474                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39475                 LDKLogger_JCalls_cloned(&logger_conv);
39476         }
39477         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, chain_access_conv, logger_conv);
39478         uint64_t ret_ref = 0;
39479         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39480         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39481         return ret_ref;
39482 }
39483
39484 void  __attribute__((export_name("TS_P2PGossipSync_add_chain_access"))) TS_P2PGossipSync_add_chain_access(uint64_t this_arg, uint64_t chain_access) {
39485         LDKP2PGossipSync this_arg_conv;
39486         this_arg_conv.inner = untag_ptr(this_arg);
39487         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39489         this_arg_conv.is_owned = false;
39490         void* chain_access_ptr = untag_ptr(chain_access);
39491         CHECK_ACCESS(chain_access_ptr);
39492         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
39493         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
39494         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
39495                 // Manually implement clone for Java trait instances
39496                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
39497                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39498                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
39499                 }
39500         }
39501         P2PGossipSync_add_chain_access(&this_arg_conv, chain_access_conv);
39502 }
39503
39504 uint64_t  __attribute__((export_name("TS_NetworkGraph_as_EventHandler"))) TS_NetworkGraph_as_EventHandler(uint64_t this_arg) {
39505         LDKNetworkGraph this_arg_conv;
39506         this_arg_conv.inner = untag_ptr(this_arg);
39507         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39509         this_arg_conv.is_owned = false;
39510         LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
39511         *ret_ret = NetworkGraph_as_EventHandler(&this_arg_conv);
39512         return tag_ptr(ret_ret, true);
39513 }
39514
39515 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_RoutingMessageHandler"))) TS_P2PGossipSync_as_RoutingMessageHandler(uint64_t this_arg) {
39516         LDKP2PGossipSync this_arg_conv;
39517         this_arg_conv.inner = untag_ptr(this_arg);
39518         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39520         this_arg_conv.is_owned = false;
39521         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
39522         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
39523         return tag_ptr(ret_ret, true);
39524 }
39525
39526 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_MessageSendEventsProvider"))) TS_P2PGossipSync_as_MessageSendEventsProvider(uint64_t this_arg) {
39527         LDKP2PGossipSync this_arg_conv;
39528         this_arg_conv.inner = untag_ptr(this_arg);
39529         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39531         this_arg_conv.is_owned = false;
39532         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
39533         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
39534         return tag_ptr(ret_ret, true);
39535 }
39536
39537 void  __attribute__((export_name("TS_ChannelUpdateInfo_free"))) TS_ChannelUpdateInfo_free(uint64_t this_obj) {
39538         LDKChannelUpdateInfo this_obj_conv;
39539         this_obj_conv.inner = untag_ptr(this_obj);
39540         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39542         ChannelUpdateInfo_free(this_obj_conv);
39543 }
39544
39545 int32_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update"))) TS_ChannelUpdateInfo_get_last_update(uint64_t this_ptr) {
39546         LDKChannelUpdateInfo this_ptr_conv;
39547         this_ptr_conv.inner = untag_ptr(this_ptr);
39548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39550         this_ptr_conv.is_owned = false;
39551         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
39552         return ret_conv;
39553 }
39554
39555 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update"))) TS_ChannelUpdateInfo_set_last_update(uint64_t this_ptr, int32_t val) {
39556         LDKChannelUpdateInfo this_ptr_conv;
39557         this_ptr_conv.inner = untag_ptr(this_ptr);
39558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39560         this_ptr_conv.is_owned = false;
39561         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
39562 }
39563
39564 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_get_enabled"))) TS_ChannelUpdateInfo_get_enabled(uint64_t this_ptr) {
39565         LDKChannelUpdateInfo this_ptr_conv;
39566         this_ptr_conv.inner = untag_ptr(this_ptr);
39567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39569         this_ptr_conv.is_owned = false;
39570         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
39571         return ret_conv;
39572 }
39573
39574 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_enabled"))) TS_ChannelUpdateInfo_set_enabled(uint64_t this_ptr, jboolean val) {
39575         LDKChannelUpdateInfo this_ptr_conv;
39576         this_ptr_conv.inner = untag_ptr(this_ptr);
39577         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39579         this_ptr_conv.is_owned = false;
39580         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
39581 }
39582
39583 int16_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_cltv_expiry_delta"))) TS_ChannelUpdateInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
39584         LDKChannelUpdateInfo this_ptr_conv;
39585         this_ptr_conv.inner = untag_ptr(this_ptr);
39586         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39588         this_ptr_conv.is_owned = false;
39589         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
39590         return ret_conv;
39591 }
39592
39593 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_cltv_expiry_delta"))) TS_ChannelUpdateInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
39594         LDKChannelUpdateInfo this_ptr_conv;
39595         this_ptr_conv.inner = untag_ptr(this_ptr);
39596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39598         this_ptr_conv.is_owned = false;
39599         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
39600 }
39601
39602 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_minimum_msat"))) TS_ChannelUpdateInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
39603         LDKChannelUpdateInfo this_ptr_conv;
39604         this_ptr_conv.inner = untag_ptr(this_ptr);
39605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39607         this_ptr_conv.is_owned = false;
39608         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
39609         return ret_conv;
39610 }
39611
39612 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_minimum_msat"))) TS_ChannelUpdateInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
39613         LDKChannelUpdateInfo this_ptr_conv;
39614         this_ptr_conv.inner = untag_ptr(this_ptr);
39615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39617         this_ptr_conv.is_owned = false;
39618         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
39619 }
39620
39621 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_maximum_msat"))) TS_ChannelUpdateInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
39622         LDKChannelUpdateInfo this_ptr_conv;
39623         this_ptr_conv.inner = untag_ptr(this_ptr);
39624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39626         this_ptr_conv.is_owned = false;
39627         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
39628         return ret_conv;
39629 }
39630
39631 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_maximum_msat"))) TS_ChannelUpdateInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
39632         LDKChannelUpdateInfo this_ptr_conv;
39633         this_ptr_conv.inner = untag_ptr(this_ptr);
39634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39636         this_ptr_conv.is_owned = false;
39637         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
39638 }
39639
39640 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_fees"))) TS_ChannelUpdateInfo_get_fees(uint64_t this_ptr) {
39641         LDKChannelUpdateInfo this_ptr_conv;
39642         this_ptr_conv.inner = untag_ptr(this_ptr);
39643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39645         this_ptr_conv.is_owned = false;
39646         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
39647         uint64_t ret_ref = 0;
39648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39650         return ret_ref;
39651 }
39652
39653 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_fees"))) TS_ChannelUpdateInfo_set_fees(uint64_t this_ptr, uint64_t val) {
39654         LDKChannelUpdateInfo this_ptr_conv;
39655         this_ptr_conv.inner = untag_ptr(this_ptr);
39656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39658         this_ptr_conv.is_owned = false;
39659         LDKRoutingFees val_conv;
39660         val_conv.inner = untag_ptr(val);
39661         val_conv.is_owned = ptr_is_owned(val);
39662         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39663         val_conv = RoutingFees_clone(&val_conv);
39664         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
39665 }
39666
39667 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update_message"))) TS_ChannelUpdateInfo_get_last_update_message(uint64_t this_ptr) {
39668         LDKChannelUpdateInfo this_ptr_conv;
39669         this_ptr_conv.inner = untag_ptr(this_ptr);
39670         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39672         this_ptr_conv.is_owned = false;
39673         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
39674         uint64_t ret_ref = 0;
39675         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39676         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39677         return ret_ref;
39678 }
39679
39680 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update_message"))) TS_ChannelUpdateInfo_set_last_update_message(uint64_t this_ptr, uint64_t val) {
39681         LDKChannelUpdateInfo this_ptr_conv;
39682         this_ptr_conv.inner = untag_ptr(this_ptr);
39683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39685         this_ptr_conv.is_owned = false;
39686         LDKChannelUpdate val_conv;
39687         val_conv.inner = untag_ptr(val);
39688         val_conv.is_owned = ptr_is_owned(val);
39689         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39690         val_conv = ChannelUpdate_clone(&val_conv);
39691         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
39692 }
39693
39694 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) {
39695         LDKRoutingFees fees_arg_conv;
39696         fees_arg_conv.inner = untag_ptr(fees_arg);
39697         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
39698         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
39699         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
39700         LDKChannelUpdate last_update_message_arg_conv;
39701         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
39702         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
39703         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
39704         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
39705         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);
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 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
39713         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
39714         uint64_t ret_ref = 0;
39715         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39716         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39717         return ret_ref;
39718 }
39719 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone_ptr"))) TS_ChannelUpdateInfo_clone_ptr(uint64_t arg) {
39720         LDKChannelUpdateInfo arg_conv;
39721         arg_conv.inner = untag_ptr(arg);
39722         arg_conv.is_owned = ptr_is_owned(arg);
39723         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39724         arg_conv.is_owned = false;
39725         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
39726         return ret_conv;
39727 }
39728
39729 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone"))) TS_ChannelUpdateInfo_clone(uint64_t orig) {
39730         LDKChannelUpdateInfo orig_conv;
39731         orig_conv.inner = untag_ptr(orig);
39732         orig_conv.is_owned = ptr_is_owned(orig);
39733         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39734         orig_conv.is_owned = false;
39735         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
39736         uint64_t ret_ref = 0;
39737         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39738         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39739         return ret_ref;
39740 }
39741
39742 int8_tArray  __attribute__((export_name("TS_ChannelUpdateInfo_write"))) TS_ChannelUpdateInfo_write(uint64_t obj) {
39743         LDKChannelUpdateInfo obj_conv;
39744         obj_conv.inner = untag_ptr(obj);
39745         obj_conv.is_owned = ptr_is_owned(obj);
39746         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
39747         obj_conv.is_owned = false;
39748         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
39749         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
39750         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
39751         CVec_u8Z_free(ret_var);
39752         return ret_arr;
39753 }
39754
39755 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_read"))) TS_ChannelUpdateInfo_read(int8_tArray ser) {
39756         LDKu8slice ser_ref;
39757         ser_ref.datalen = ser->arr_len;
39758         ser_ref.data = ser->elems;
39759         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
39760         *ret_conv = ChannelUpdateInfo_read(ser_ref);
39761         FREE(ser);
39762         return tag_ptr(ret_conv, true);
39763 }
39764
39765 void  __attribute__((export_name("TS_ChannelInfo_free"))) TS_ChannelInfo_free(uint64_t this_obj) {
39766         LDKChannelInfo this_obj_conv;
39767         this_obj_conv.inner = untag_ptr(this_obj);
39768         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39770         ChannelInfo_free(this_obj_conv);
39771 }
39772
39773 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_features"))) TS_ChannelInfo_get_features(uint64_t this_ptr) {
39774         LDKChannelInfo this_ptr_conv;
39775         this_ptr_conv.inner = untag_ptr(this_ptr);
39776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39778         this_ptr_conv.is_owned = false;
39779         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
39780         uint64_t ret_ref = 0;
39781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39783         return ret_ref;
39784 }
39785
39786 void  __attribute__((export_name("TS_ChannelInfo_set_features"))) TS_ChannelInfo_set_features(uint64_t this_ptr, uint64_t val) {
39787         LDKChannelInfo this_ptr_conv;
39788         this_ptr_conv.inner = untag_ptr(this_ptr);
39789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39791         this_ptr_conv.is_owned = false;
39792         LDKChannelFeatures val_conv;
39793         val_conv.inner = untag_ptr(val);
39794         val_conv.is_owned = ptr_is_owned(val);
39795         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39796         val_conv = ChannelFeatures_clone(&val_conv);
39797         ChannelInfo_set_features(&this_ptr_conv, val_conv);
39798 }
39799
39800 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_one"))) TS_ChannelInfo_get_node_one(uint64_t this_ptr) {
39801         LDKChannelInfo this_ptr_conv;
39802         this_ptr_conv.inner = untag_ptr(this_ptr);
39803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39805         this_ptr_conv.is_owned = false;
39806         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
39807         uint64_t ret_ref = 0;
39808         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39809         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39810         return ret_ref;
39811 }
39812
39813 void  __attribute__((export_name("TS_ChannelInfo_set_node_one"))) TS_ChannelInfo_set_node_one(uint64_t this_ptr, uint64_t val) {
39814         LDKChannelInfo this_ptr_conv;
39815         this_ptr_conv.inner = untag_ptr(this_ptr);
39816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39818         this_ptr_conv.is_owned = false;
39819         LDKNodeId val_conv;
39820         val_conv.inner = untag_ptr(val);
39821         val_conv.is_owned = ptr_is_owned(val);
39822         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39823         val_conv = NodeId_clone(&val_conv);
39824         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
39825 }
39826
39827 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_one_to_two"))) TS_ChannelInfo_get_one_to_two(uint64_t this_ptr) {
39828         LDKChannelInfo this_ptr_conv;
39829         this_ptr_conv.inner = untag_ptr(this_ptr);
39830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39832         this_ptr_conv.is_owned = false;
39833         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
39834         uint64_t ret_ref = 0;
39835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39836         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39837         return ret_ref;
39838 }
39839
39840 void  __attribute__((export_name("TS_ChannelInfo_set_one_to_two"))) TS_ChannelInfo_set_one_to_two(uint64_t this_ptr, uint64_t val) {
39841         LDKChannelInfo this_ptr_conv;
39842         this_ptr_conv.inner = untag_ptr(this_ptr);
39843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39845         this_ptr_conv.is_owned = false;
39846         LDKChannelUpdateInfo val_conv;
39847         val_conv.inner = untag_ptr(val);
39848         val_conv.is_owned = ptr_is_owned(val);
39849         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39850         val_conv = ChannelUpdateInfo_clone(&val_conv);
39851         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
39852 }
39853
39854 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_two"))) TS_ChannelInfo_get_node_two(uint64_t this_ptr) {
39855         LDKChannelInfo this_ptr_conv;
39856         this_ptr_conv.inner = untag_ptr(this_ptr);
39857         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39859         this_ptr_conv.is_owned = false;
39860         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
39861         uint64_t ret_ref = 0;
39862         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39863         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39864         return ret_ref;
39865 }
39866
39867 void  __attribute__((export_name("TS_ChannelInfo_set_node_two"))) TS_ChannelInfo_set_node_two(uint64_t this_ptr, uint64_t val) {
39868         LDKChannelInfo this_ptr_conv;
39869         this_ptr_conv.inner = untag_ptr(this_ptr);
39870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39872         this_ptr_conv.is_owned = false;
39873         LDKNodeId val_conv;
39874         val_conv.inner = untag_ptr(val);
39875         val_conv.is_owned = ptr_is_owned(val);
39876         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39877         val_conv = NodeId_clone(&val_conv);
39878         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
39879 }
39880
39881 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_two_to_one"))) TS_ChannelInfo_get_two_to_one(uint64_t this_ptr) {
39882         LDKChannelInfo this_ptr_conv;
39883         this_ptr_conv.inner = untag_ptr(this_ptr);
39884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39886         this_ptr_conv.is_owned = false;
39887         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
39888         uint64_t ret_ref = 0;
39889         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39890         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39891         return ret_ref;
39892 }
39893
39894 void  __attribute__((export_name("TS_ChannelInfo_set_two_to_one"))) TS_ChannelInfo_set_two_to_one(uint64_t this_ptr, uint64_t val) {
39895         LDKChannelInfo this_ptr_conv;
39896         this_ptr_conv.inner = untag_ptr(this_ptr);
39897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39899         this_ptr_conv.is_owned = false;
39900         LDKChannelUpdateInfo val_conv;
39901         val_conv.inner = untag_ptr(val);
39902         val_conv.is_owned = ptr_is_owned(val);
39903         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39904         val_conv = ChannelUpdateInfo_clone(&val_conv);
39905         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
39906 }
39907
39908 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_capacity_sats"))) TS_ChannelInfo_get_capacity_sats(uint64_t this_ptr) {
39909         LDKChannelInfo this_ptr_conv;
39910         this_ptr_conv.inner = untag_ptr(this_ptr);
39911         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39913         this_ptr_conv.is_owned = false;
39914         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
39915         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
39916         uint64_t ret_ref = tag_ptr(ret_copy, true);
39917         return ret_ref;
39918 }
39919
39920 void  __attribute__((export_name("TS_ChannelInfo_set_capacity_sats"))) TS_ChannelInfo_set_capacity_sats(uint64_t this_ptr, uint64_t val) {
39921         LDKChannelInfo this_ptr_conv;
39922         this_ptr_conv.inner = untag_ptr(this_ptr);
39923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39925         this_ptr_conv.is_owned = false;
39926         void* val_ptr = untag_ptr(val);
39927         CHECK_ACCESS(val_ptr);
39928         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
39929         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
39930         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
39931 }
39932
39933 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_announcement_message"))) TS_ChannelInfo_get_announcement_message(uint64_t this_ptr) {
39934         LDKChannelInfo this_ptr_conv;
39935         this_ptr_conv.inner = untag_ptr(this_ptr);
39936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39938         this_ptr_conv.is_owned = false;
39939         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
39940         uint64_t ret_ref = 0;
39941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39943         return ret_ref;
39944 }
39945
39946 void  __attribute__((export_name("TS_ChannelInfo_set_announcement_message"))) TS_ChannelInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
39947         LDKChannelInfo this_ptr_conv;
39948         this_ptr_conv.inner = untag_ptr(this_ptr);
39949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39951         this_ptr_conv.is_owned = false;
39952         LDKChannelAnnouncement val_conv;
39953         val_conv.inner = untag_ptr(val);
39954         val_conv.is_owned = ptr_is_owned(val);
39955         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
39956         val_conv = ChannelAnnouncement_clone(&val_conv);
39957         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
39958 }
39959
39960 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
39961         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
39962         uint64_t ret_ref = 0;
39963         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39964         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39965         return ret_ref;
39966 }
39967 int64_t  __attribute__((export_name("TS_ChannelInfo_clone_ptr"))) TS_ChannelInfo_clone_ptr(uint64_t arg) {
39968         LDKChannelInfo arg_conv;
39969         arg_conv.inner = untag_ptr(arg);
39970         arg_conv.is_owned = ptr_is_owned(arg);
39971         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39972         arg_conv.is_owned = false;
39973         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
39974         return ret_conv;
39975 }
39976
39977 uint64_t  __attribute__((export_name("TS_ChannelInfo_clone"))) TS_ChannelInfo_clone(uint64_t orig) {
39978         LDKChannelInfo orig_conv;
39979         orig_conv.inner = untag_ptr(orig);
39980         orig_conv.is_owned = ptr_is_owned(orig);
39981         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39982         orig_conv.is_owned = false;
39983         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
39984         uint64_t ret_ref = 0;
39985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39987         return ret_ref;
39988 }
39989
39990 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_directional_info"))) TS_ChannelInfo_get_directional_info(uint64_t this_arg, int8_t channel_flags) {
39991         LDKChannelInfo this_arg_conv;
39992         this_arg_conv.inner = untag_ptr(this_arg);
39993         this_arg_conv.is_owned = ptr_is_owned(this_arg);
39994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
39995         this_arg_conv.is_owned = false;
39996         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
39997         uint64_t ret_ref = 0;
39998         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39999         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40000         return ret_ref;
40001 }
40002
40003 int8_tArray  __attribute__((export_name("TS_ChannelInfo_write"))) TS_ChannelInfo_write(uint64_t obj) {
40004         LDKChannelInfo obj_conv;
40005         obj_conv.inner = untag_ptr(obj);
40006         obj_conv.is_owned = ptr_is_owned(obj);
40007         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40008         obj_conv.is_owned = false;
40009         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
40010         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40011         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40012         CVec_u8Z_free(ret_var);
40013         return ret_arr;
40014 }
40015
40016 uint64_t  __attribute__((export_name("TS_ChannelInfo_read"))) TS_ChannelInfo_read(int8_tArray ser) {
40017         LDKu8slice ser_ref;
40018         ser_ref.datalen = ser->arr_len;
40019         ser_ref.data = ser->elems;
40020         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
40021         *ret_conv = ChannelInfo_read(ser_ref);
40022         FREE(ser);
40023         return tag_ptr(ret_conv, true);
40024 }
40025
40026 void  __attribute__((export_name("TS_DirectedChannelInfo_free"))) TS_DirectedChannelInfo_free(uint64_t this_obj) {
40027         LDKDirectedChannelInfo this_obj_conv;
40028         this_obj_conv.inner = untag_ptr(this_obj);
40029         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40031         DirectedChannelInfo_free(this_obj_conv);
40032 }
40033
40034 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
40035         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
40036         uint64_t ret_ref = 0;
40037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40039         return ret_ref;
40040 }
40041 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone_ptr"))) TS_DirectedChannelInfo_clone_ptr(uint64_t arg) {
40042         LDKDirectedChannelInfo arg_conv;
40043         arg_conv.inner = untag_ptr(arg);
40044         arg_conv.is_owned = ptr_is_owned(arg);
40045         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40046         arg_conv.is_owned = false;
40047         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
40048         return ret_conv;
40049 }
40050
40051 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone"))) TS_DirectedChannelInfo_clone(uint64_t orig) {
40052         LDKDirectedChannelInfo orig_conv;
40053         orig_conv.inner = untag_ptr(orig);
40054         orig_conv.is_owned = ptr_is_owned(orig);
40055         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40056         orig_conv.is_owned = false;
40057         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
40058         uint64_t ret_ref = 0;
40059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40060         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40061         return ret_ref;
40062 }
40063
40064 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_channel"))) TS_DirectedChannelInfo_channel(uint64_t this_arg) {
40065         LDKDirectedChannelInfo this_arg_conv;
40066         this_arg_conv.inner = untag_ptr(this_arg);
40067         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40069         this_arg_conv.is_owned = false;
40070         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
40071         uint64_t ret_ref = 0;
40072         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40073         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40074         return ret_ref;
40075 }
40076
40077 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_direction"))) TS_DirectedChannelInfo_direction(uint64_t this_arg) {
40078         LDKDirectedChannelInfo this_arg_conv;
40079         this_arg_conv.inner = untag_ptr(this_arg);
40080         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40082         this_arg_conv.is_owned = false;
40083         LDKChannelUpdateInfo ret_var = DirectedChannelInfo_direction(&this_arg_conv);
40084         uint64_t ret_ref = 0;
40085         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40086         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40087         return ret_ref;
40088 }
40089
40090 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_htlc_maximum_msat"))) TS_DirectedChannelInfo_htlc_maximum_msat(uint64_t this_arg) {
40091         LDKDirectedChannelInfo this_arg_conv;
40092         this_arg_conv.inner = untag_ptr(this_arg);
40093         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40095         this_arg_conv.is_owned = false;
40096         int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
40097         return ret_conv;
40098 }
40099
40100 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_effective_capacity"))) TS_DirectedChannelInfo_effective_capacity(uint64_t this_arg) {
40101         LDKDirectedChannelInfo this_arg_conv;
40102         this_arg_conv.inner = untag_ptr(this_arg);
40103         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40105         this_arg_conv.is_owned = false;
40106         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40107         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
40108         uint64_t ret_ref = tag_ptr(ret_copy, true);
40109         return ret_ref;
40110 }
40111
40112 void  __attribute__((export_name("TS_EffectiveCapacity_free"))) TS_EffectiveCapacity_free(uint64_t this_ptr) {
40113         if (!ptr_is_owned(this_ptr)) return;
40114         void* this_ptr_ptr = untag_ptr(this_ptr);
40115         CHECK_ACCESS(this_ptr_ptr);
40116         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
40117         FREE(untag_ptr(this_ptr));
40118         EffectiveCapacity_free(this_ptr_conv);
40119 }
40120
40121 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
40122         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40123         *ret_copy = EffectiveCapacity_clone(arg);
40124         uint64_t ret_ref = tag_ptr(ret_copy, true);
40125         return ret_ref;
40126 }
40127 int64_t  __attribute__((export_name("TS_EffectiveCapacity_clone_ptr"))) TS_EffectiveCapacity_clone_ptr(uint64_t arg) {
40128         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
40129         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
40130         return ret_conv;
40131 }
40132
40133 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_clone"))) TS_EffectiveCapacity_clone(uint64_t orig) {
40134         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
40135         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40136         *ret_copy = EffectiveCapacity_clone(orig_conv);
40137         uint64_t ret_ref = tag_ptr(ret_copy, true);
40138         return ret_ref;
40139 }
40140
40141 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_exact_liquidity"))) TS_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
40142         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40143         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
40144         uint64_t ret_ref = tag_ptr(ret_copy, true);
40145         return ret_ref;
40146 }
40147
40148 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_maximum_htlc"))) TS_EffectiveCapacity_maximum_htlc(int64_t amount_msat) {
40149         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40150         *ret_copy = EffectiveCapacity_maximum_htlc(amount_msat);
40151         uint64_t ret_ref = tag_ptr(ret_copy, true);
40152         return ret_ref;
40153 }
40154
40155 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_total"))) TS_EffectiveCapacity_total(int64_t capacity_msat, uint64_t htlc_maximum_msat) {
40156         void* htlc_maximum_msat_ptr = untag_ptr(htlc_maximum_msat);
40157         CHECK_ACCESS(htlc_maximum_msat_ptr);
40158         LDKCOption_u64Z htlc_maximum_msat_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_ptr);
40159         htlc_maximum_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat));
40160         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40161         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat_conv);
40162         uint64_t ret_ref = tag_ptr(ret_copy, true);
40163         return ret_ref;
40164 }
40165
40166 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_infinite"))) TS_EffectiveCapacity_infinite() {
40167         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40168         *ret_copy = EffectiveCapacity_infinite();
40169         uint64_t ret_ref = tag_ptr(ret_copy, true);
40170         return ret_ref;
40171 }
40172
40173 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_unknown"))) TS_EffectiveCapacity_unknown() {
40174         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
40175         *ret_copy = EffectiveCapacity_unknown();
40176         uint64_t ret_ref = tag_ptr(ret_copy, true);
40177         return ret_ref;
40178 }
40179
40180 int64_t  __attribute__((export_name("TS_EffectiveCapacity_as_msat"))) TS_EffectiveCapacity_as_msat(uint64_t this_arg) {
40181         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
40182         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
40183         return ret_conv;
40184 }
40185
40186 void  __attribute__((export_name("TS_RoutingFees_free"))) TS_RoutingFees_free(uint64_t this_obj) {
40187         LDKRoutingFees this_obj_conv;
40188         this_obj_conv.inner = untag_ptr(this_obj);
40189         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40191         RoutingFees_free(this_obj_conv);
40192 }
40193
40194 int32_t  __attribute__((export_name("TS_RoutingFees_get_base_msat"))) TS_RoutingFees_get_base_msat(uint64_t this_ptr) {
40195         LDKRoutingFees this_ptr_conv;
40196         this_ptr_conv.inner = untag_ptr(this_ptr);
40197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40199         this_ptr_conv.is_owned = false;
40200         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
40201         return ret_conv;
40202 }
40203
40204 void  __attribute__((export_name("TS_RoutingFees_set_base_msat"))) TS_RoutingFees_set_base_msat(uint64_t this_ptr, int32_t val) {
40205         LDKRoutingFees this_ptr_conv;
40206         this_ptr_conv.inner = untag_ptr(this_ptr);
40207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40209         this_ptr_conv.is_owned = false;
40210         RoutingFees_set_base_msat(&this_ptr_conv, val);
40211 }
40212
40213 int32_t  __attribute__((export_name("TS_RoutingFees_get_proportional_millionths"))) TS_RoutingFees_get_proportional_millionths(uint64_t this_ptr) {
40214         LDKRoutingFees this_ptr_conv;
40215         this_ptr_conv.inner = untag_ptr(this_ptr);
40216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40218         this_ptr_conv.is_owned = false;
40219         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
40220         return ret_conv;
40221 }
40222
40223 void  __attribute__((export_name("TS_RoutingFees_set_proportional_millionths"))) TS_RoutingFees_set_proportional_millionths(uint64_t this_ptr, int32_t val) {
40224         LDKRoutingFees this_ptr_conv;
40225         this_ptr_conv.inner = untag_ptr(this_ptr);
40226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40228         this_ptr_conv.is_owned = false;
40229         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
40230 }
40231
40232 uint64_t  __attribute__((export_name("TS_RoutingFees_new"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
40233         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
40234         uint64_t ret_ref = 0;
40235         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40236         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40237         return ret_ref;
40238 }
40239
40240 jboolean  __attribute__((export_name("TS_RoutingFees_eq"))) TS_RoutingFees_eq(uint64_t a, uint64_t b) {
40241         LDKRoutingFees a_conv;
40242         a_conv.inner = untag_ptr(a);
40243         a_conv.is_owned = ptr_is_owned(a);
40244         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40245         a_conv.is_owned = false;
40246         LDKRoutingFees b_conv;
40247         b_conv.inner = untag_ptr(b);
40248         b_conv.is_owned = ptr_is_owned(b);
40249         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40250         b_conv.is_owned = false;
40251         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
40252         return ret_conv;
40253 }
40254
40255 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
40256         LDKRoutingFees ret_var = RoutingFees_clone(arg);
40257         uint64_t ret_ref = 0;
40258         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40259         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40260         return ret_ref;
40261 }
40262 int64_t  __attribute__((export_name("TS_RoutingFees_clone_ptr"))) TS_RoutingFees_clone_ptr(uint64_t arg) {
40263         LDKRoutingFees arg_conv;
40264         arg_conv.inner = untag_ptr(arg);
40265         arg_conv.is_owned = ptr_is_owned(arg);
40266         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40267         arg_conv.is_owned = false;
40268         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
40269         return ret_conv;
40270 }
40271
40272 uint64_t  __attribute__((export_name("TS_RoutingFees_clone"))) TS_RoutingFees_clone(uint64_t orig) {
40273         LDKRoutingFees orig_conv;
40274         orig_conv.inner = untag_ptr(orig);
40275         orig_conv.is_owned = ptr_is_owned(orig);
40276         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40277         orig_conv.is_owned = false;
40278         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
40279         uint64_t ret_ref = 0;
40280         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40281         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40282         return ret_ref;
40283 }
40284
40285 int64_t  __attribute__((export_name("TS_RoutingFees_hash"))) TS_RoutingFees_hash(uint64_t o) {
40286         LDKRoutingFees o_conv;
40287         o_conv.inner = untag_ptr(o);
40288         o_conv.is_owned = ptr_is_owned(o);
40289         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40290         o_conv.is_owned = false;
40291         int64_t ret_conv = RoutingFees_hash(&o_conv);
40292         return ret_conv;
40293 }
40294
40295 int8_tArray  __attribute__((export_name("TS_RoutingFees_write"))) TS_RoutingFees_write(uint64_t obj) {
40296         LDKRoutingFees obj_conv;
40297         obj_conv.inner = untag_ptr(obj);
40298         obj_conv.is_owned = ptr_is_owned(obj);
40299         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40300         obj_conv.is_owned = false;
40301         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
40302         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40303         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40304         CVec_u8Z_free(ret_var);
40305         return ret_arr;
40306 }
40307
40308 uint64_t  __attribute__((export_name("TS_RoutingFees_read"))) TS_RoutingFees_read(int8_tArray ser) {
40309         LDKu8slice ser_ref;
40310         ser_ref.datalen = ser->arr_len;
40311         ser_ref.data = ser->elems;
40312         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
40313         *ret_conv = RoutingFees_read(ser_ref);
40314         FREE(ser);
40315         return tag_ptr(ret_conv, true);
40316 }
40317
40318 void  __attribute__((export_name("TS_NodeAnnouncementInfo_free"))) TS_NodeAnnouncementInfo_free(uint64_t this_obj) {
40319         LDKNodeAnnouncementInfo this_obj_conv;
40320         this_obj_conv.inner = untag_ptr(this_obj);
40321         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40323         NodeAnnouncementInfo_free(this_obj_conv);
40324 }
40325
40326 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_features"))) TS_NodeAnnouncementInfo_get_features(uint64_t this_ptr) {
40327         LDKNodeAnnouncementInfo this_ptr_conv;
40328         this_ptr_conv.inner = untag_ptr(this_ptr);
40329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40331         this_ptr_conv.is_owned = false;
40332         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
40333         uint64_t ret_ref = 0;
40334         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40335         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40336         return ret_ref;
40337 }
40338
40339 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_features"))) TS_NodeAnnouncementInfo_set_features(uint64_t this_ptr, uint64_t val) {
40340         LDKNodeAnnouncementInfo this_ptr_conv;
40341         this_ptr_conv.inner = untag_ptr(this_ptr);
40342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40344         this_ptr_conv.is_owned = false;
40345         LDKNodeFeatures val_conv;
40346         val_conv.inner = untag_ptr(val);
40347         val_conv.is_owned = ptr_is_owned(val);
40348         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40349         val_conv = NodeFeatures_clone(&val_conv);
40350         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
40351 }
40352
40353 int32_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_last_update"))) TS_NodeAnnouncementInfo_get_last_update(uint64_t this_ptr) {
40354         LDKNodeAnnouncementInfo this_ptr_conv;
40355         this_ptr_conv.inner = untag_ptr(this_ptr);
40356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40358         this_ptr_conv.is_owned = false;
40359         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
40360         return ret_conv;
40361 }
40362
40363 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_last_update"))) TS_NodeAnnouncementInfo_set_last_update(uint64_t this_ptr, int32_t val) {
40364         LDKNodeAnnouncementInfo this_ptr_conv;
40365         this_ptr_conv.inner = untag_ptr(this_ptr);
40366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40368         this_ptr_conv.is_owned = false;
40369         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
40370 }
40371
40372 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_rgb"))) TS_NodeAnnouncementInfo_get_rgb(uint64_t this_ptr) {
40373         LDKNodeAnnouncementInfo this_ptr_conv;
40374         this_ptr_conv.inner = untag_ptr(this_ptr);
40375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40377         this_ptr_conv.is_owned = false;
40378         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
40379         memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
40380         return ret_arr;
40381 }
40382
40383 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_rgb"))) TS_NodeAnnouncementInfo_set_rgb(uint64_t this_ptr, int8_tArray val) {
40384         LDKNodeAnnouncementInfo this_ptr_conv;
40385         this_ptr_conv.inner = untag_ptr(this_ptr);
40386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40388         this_ptr_conv.is_owned = false;
40389         LDKThreeBytes val_ref;
40390         CHECK(val->arr_len == 3);
40391         memcpy(val_ref.data, val->elems, 3); FREE(val);
40392         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
40393 }
40394
40395 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_alias"))) TS_NodeAnnouncementInfo_get_alias(uint64_t this_ptr) {
40396         LDKNodeAnnouncementInfo this_ptr_conv;
40397         this_ptr_conv.inner = untag_ptr(this_ptr);
40398         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40400         this_ptr_conv.is_owned = false;
40401         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
40402         uint64_t ret_ref = 0;
40403         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40404         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40405         return ret_ref;
40406 }
40407
40408 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_alias"))) TS_NodeAnnouncementInfo_set_alias(uint64_t this_ptr, uint64_t val) {
40409         LDKNodeAnnouncementInfo this_ptr_conv;
40410         this_ptr_conv.inner = untag_ptr(this_ptr);
40411         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40412         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40413         this_ptr_conv.is_owned = false;
40414         LDKNodeAlias val_conv;
40415         val_conv.inner = untag_ptr(val);
40416         val_conv.is_owned = ptr_is_owned(val);
40417         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40418         val_conv = NodeAlias_clone(&val_conv);
40419         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
40420 }
40421
40422 uint64_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_addresses"))) TS_NodeAnnouncementInfo_get_addresses(uint64_t this_ptr) {
40423         LDKNodeAnnouncementInfo this_ptr_conv;
40424         this_ptr_conv.inner = untag_ptr(this_ptr);
40425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40427         this_ptr_conv.is_owned = false;
40428         LDKCVec_NetAddressZ ret_var = NodeAnnouncementInfo_get_addresses(&this_ptr_conv);
40429         uint64_tArray ret_arr = NULL;
40430         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
40431         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
40432         for (size_t m = 0; m < ret_var.datalen; m++) {
40433                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
40434                 *ret_conv_12_copy = ret_var.data[m];
40435                 uint64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
40436                 ret_arr_ptr[m] = ret_conv_12_ref;
40437         }
40438         
40439         FREE(ret_var.data);
40440         return ret_arr;
40441 }
40442
40443 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_addresses"))) TS_NodeAnnouncementInfo_set_addresses(uint64_t this_ptr, uint64_tArray val) {
40444         LDKNodeAnnouncementInfo this_ptr_conv;
40445         this_ptr_conv.inner = untag_ptr(this_ptr);
40446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40448         this_ptr_conv.is_owned = false;
40449         LDKCVec_NetAddressZ val_constr;
40450         val_constr.datalen = val->arr_len;
40451         if (val_constr.datalen > 0)
40452                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
40453         else
40454                 val_constr.data = NULL;
40455         uint64_t* val_vals = val->elems;
40456         for (size_t m = 0; m < val_constr.datalen; m++) {
40457                 uint64_t val_conv_12 = val_vals[m];
40458                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
40459                 CHECK_ACCESS(val_conv_12_ptr);
40460                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
40461                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
40462                 val_constr.data[m] = val_conv_12_conv;
40463         }
40464         FREE(val);
40465         NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
40466 }
40467
40468 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_announcement_message"))) TS_NodeAnnouncementInfo_get_announcement_message(uint64_t this_ptr) {
40469         LDKNodeAnnouncementInfo this_ptr_conv;
40470         this_ptr_conv.inner = untag_ptr(this_ptr);
40471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40473         this_ptr_conv.is_owned = false;
40474         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
40475         uint64_t ret_ref = 0;
40476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40478         return ret_ref;
40479 }
40480
40481 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_announcement_message"))) TS_NodeAnnouncementInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
40482         LDKNodeAnnouncementInfo this_ptr_conv;
40483         this_ptr_conv.inner = untag_ptr(this_ptr);
40484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40486         this_ptr_conv.is_owned = false;
40487         LDKNodeAnnouncement val_conv;
40488         val_conv.inner = untag_ptr(val);
40489         val_conv.is_owned = ptr_is_owned(val);
40490         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40491         val_conv = NodeAnnouncement_clone(&val_conv);
40492         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
40493 }
40494
40495 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) {
40496         LDKNodeFeatures features_arg_conv;
40497         features_arg_conv.inner = untag_ptr(features_arg);
40498         features_arg_conv.is_owned = ptr_is_owned(features_arg);
40499         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
40500         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
40501         LDKThreeBytes rgb_arg_ref;
40502         CHECK(rgb_arg->arr_len == 3);
40503         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
40504         LDKNodeAlias alias_arg_conv;
40505         alias_arg_conv.inner = untag_ptr(alias_arg);
40506         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
40507         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
40508         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
40509         LDKCVec_NetAddressZ addresses_arg_constr;
40510         addresses_arg_constr.datalen = addresses_arg->arr_len;
40511         if (addresses_arg_constr.datalen > 0)
40512                 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
40513         else
40514                 addresses_arg_constr.data = NULL;
40515         uint64_t* addresses_arg_vals = addresses_arg->elems;
40516         for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
40517                 uint64_t addresses_arg_conv_12 = addresses_arg_vals[m];
40518                 void* addresses_arg_conv_12_ptr = untag_ptr(addresses_arg_conv_12);
40519                 CHECK_ACCESS(addresses_arg_conv_12_ptr);
40520                 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(addresses_arg_conv_12_ptr);
40521                 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
40522         }
40523         FREE(addresses_arg);
40524         LDKNodeAnnouncement announcement_message_arg_conv;
40525         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
40526         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
40527         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
40528         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
40529         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, addresses_arg_constr, announcement_message_arg_conv);
40530         uint64_t ret_ref = 0;
40531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40533         return ret_ref;
40534 }
40535
40536 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
40537         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
40538         uint64_t ret_ref = 0;
40539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40541         return ret_ref;
40542 }
40543 int64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone_ptr"))) TS_NodeAnnouncementInfo_clone_ptr(uint64_t arg) {
40544         LDKNodeAnnouncementInfo arg_conv;
40545         arg_conv.inner = untag_ptr(arg);
40546         arg_conv.is_owned = ptr_is_owned(arg);
40547         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40548         arg_conv.is_owned = false;
40549         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
40550         return ret_conv;
40551 }
40552
40553 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone"))) TS_NodeAnnouncementInfo_clone(uint64_t orig) {
40554         LDKNodeAnnouncementInfo orig_conv;
40555         orig_conv.inner = untag_ptr(orig);
40556         orig_conv.is_owned = ptr_is_owned(orig);
40557         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40558         orig_conv.is_owned = false;
40559         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
40560         uint64_t ret_ref = 0;
40561         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40562         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40563         return ret_ref;
40564 }
40565
40566 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_write"))) TS_NodeAnnouncementInfo_write(uint64_t obj) {
40567         LDKNodeAnnouncementInfo obj_conv;
40568         obj_conv.inner = untag_ptr(obj);
40569         obj_conv.is_owned = ptr_is_owned(obj);
40570         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40571         obj_conv.is_owned = false;
40572         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
40573         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40574         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40575         CVec_u8Z_free(ret_var);
40576         return ret_arr;
40577 }
40578
40579 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_read"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
40580         LDKu8slice ser_ref;
40581         ser_ref.datalen = ser->arr_len;
40582         ser_ref.data = ser->elems;
40583         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
40584         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
40585         FREE(ser);
40586         return tag_ptr(ret_conv, true);
40587 }
40588
40589 void  __attribute__((export_name("TS_NodeAlias_free"))) TS_NodeAlias_free(uint64_t this_obj) {
40590         LDKNodeAlias this_obj_conv;
40591         this_obj_conv.inner = untag_ptr(this_obj);
40592         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40594         NodeAlias_free(this_obj_conv);
40595 }
40596
40597 int8_tArray  __attribute__((export_name("TS_NodeAlias_get_a"))) TS_NodeAlias_get_a(uint64_t this_ptr) {
40598         LDKNodeAlias this_ptr_conv;
40599         this_ptr_conv.inner = untag_ptr(this_ptr);
40600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40602         this_ptr_conv.is_owned = false;
40603         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40604         memcpy(ret_arr->elems, *NodeAlias_get_a(&this_ptr_conv), 32);
40605         return ret_arr;
40606 }
40607
40608 void  __attribute__((export_name("TS_NodeAlias_set_a"))) TS_NodeAlias_set_a(uint64_t this_ptr, int8_tArray val) {
40609         LDKNodeAlias this_ptr_conv;
40610         this_ptr_conv.inner = untag_ptr(this_ptr);
40611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40613         this_ptr_conv.is_owned = false;
40614         LDKThirtyTwoBytes val_ref;
40615         CHECK(val->arr_len == 32);
40616         memcpy(val_ref.data, val->elems, 32); FREE(val);
40617         NodeAlias_set_a(&this_ptr_conv, val_ref);
40618 }
40619
40620 uint64_t  __attribute__((export_name("TS_NodeAlias_new"))) TS_NodeAlias_new(int8_tArray a_arg) {
40621         LDKThirtyTwoBytes a_arg_ref;
40622         CHECK(a_arg->arr_len == 32);
40623         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
40624         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
40625         uint64_t ret_ref = 0;
40626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40628         return ret_ref;
40629 }
40630
40631 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
40632         LDKNodeAlias ret_var = NodeAlias_clone(arg);
40633         uint64_t ret_ref = 0;
40634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40636         return ret_ref;
40637 }
40638 int64_t  __attribute__((export_name("TS_NodeAlias_clone_ptr"))) TS_NodeAlias_clone_ptr(uint64_t arg) {
40639         LDKNodeAlias arg_conv;
40640         arg_conv.inner = untag_ptr(arg);
40641         arg_conv.is_owned = ptr_is_owned(arg);
40642         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40643         arg_conv.is_owned = false;
40644         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
40645         return ret_conv;
40646 }
40647
40648 uint64_t  __attribute__((export_name("TS_NodeAlias_clone"))) TS_NodeAlias_clone(uint64_t orig) {
40649         LDKNodeAlias orig_conv;
40650         orig_conv.inner = untag_ptr(orig);
40651         orig_conv.is_owned = ptr_is_owned(orig);
40652         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40653         orig_conv.is_owned = false;
40654         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
40655         uint64_t ret_ref = 0;
40656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40658         return ret_ref;
40659 }
40660
40661 int8_tArray  __attribute__((export_name("TS_NodeAlias_write"))) TS_NodeAlias_write(uint64_t obj) {
40662         LDKNodeAlias obj_conv;
40663         obj_conv.inner = untag_ptr(obj);
40664         obj_conv.is_owned = ptr_is_owned(obj);
40665         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40666         obj_conv.is_owned = false;
40667         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
40668         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40669         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40670         CVec_u8Z_free(ret_var);
40671         return ret_arr;
40672 }
40673
40674 uint64_t  __attribute__((export_name("TS_NodeAlias_read"))) TS_NodeAlias_read(int8_tArray ser) {
40675         LDKu8slice ser_ref;
40676         ser_ref.datalen = ser->arr_len;
40677         ser_ref.data = ser->elems;
40678         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
40679         *ret_conv = NodeAlias_read(ser_ref);
40680         FREE(ser);
40681         return tag_ptr(ret_conv, true);
40682 }
40683
40684 void  __attribute__((export_name("TS_NodeInfo_free"))) TS_NodeInfo_free(uint64_t this_obj) {
40685         LDKNodeInfo this_obj_conv;
40686         this_obj_conv.inner = untag_ptr(this_obj);
40687         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40689         NodeInfo_free(this_obj_conv);
40690 }
40691
40692 int64_tArray  __attribute__((export_name("TS_NodeInfo_get_channels"))) TS_NodeInfo_get_channels(uint64_t this_ptr) {
40693         LDKNodeInfo this_ptr_conv;
40694         this_ptr_conv.inner = untag_ptr(this_ptr);
40695         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40697         this_ptr_conv.is_owned = false;
40698         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
40699         int64_tArray ret_arr = NULL;
40700         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
40701         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
40702         for (size_t i = 0; i < ret_var.datalen; i++) {
40703                 int64_t ret_conv_8_conv = ret_var.data[i];
40704                 ret_arr_ptr[i] = ret_conv_8_conv;
40705         }
40706         
40707         FREE(ret_var.data);
40708         return ret_arr;
40709 }
40710
40711 void  __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_channels(uint64_t this_ptr, int64_tArray val) {
40712         LDKNodeInfo this_ptr_conv;
40713         this_ptr_conv.inner = untag_ptr(this_ptr);
40714         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40716         this_ptr_conv.is_owned = false;
40717         LDKCVec_u64Z val_constr;
40718         val_constr.datalen = val->arr_len;
40719         if (val_constr.datalen > 0)
40720                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
40721         else
40722                 val_constr.data = NULL;
40723         int64_t* val_vals = val->elems;
40724         for (size_t i = 0; i < val_constr.datalen; i++) {
40725                 int64_t val_conv_8 = val_vals[i];
40726                 val_constr.data[i] = val_conv_8;
40727         }
40728         FREE(val);
40729         NodeInfo_set_channels(&this_ptr_conv, val_constr);
40730 }
40731
40732 uint64_t  __attribute__((export_name("TS_NodeInfo_get_lowest_inbound_channel_fees"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint64_t this_ptr) {
40733         LDKNodeInfo this_ptr_conv;
40734         this_ptr_conv.inner = untag_ptr(this_ptr);
40735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40737         this_ptr_conv.is_owned = false;
40738         LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
40739         uint64_t ret_ref = 0;
40740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40742         return ret_ref;
40743 }
40744
40745 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) {
40746         LDKNodeInfo this_ptr_conv;
40747         this_ptr_conv.inner = untag_ptr(this_ptr);
40748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40750         this_ptr_conv.is_owned = false;
40751         LDKRoutingFees val_conv;
40752         val_conv.inner = untag_ptr(val);
40753         val_conv.is_owned = ptr_is_owned(val);
40754         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40755         val_conv = RoutingFees_clone(&val_conv);
40756         NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
40757 }
40758
40759 uint64_t  __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint64_t this_ptr) {
40760         LDKNodeInfo this_ptr_conv;
40761         this_ptr_conv.inner = untag_ptr(this_ptr);
40762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40764         this_ptr_conv.is_owned = false;
40765         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
40766         uint64_t ret_ref = 0;
40767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40769         return ret_ref;
40770 }
40771
40772 void  __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeInfo_set_announcement_info(uint64_t this_ptr, uint64_t val) {
40773         LDKNodeInfo this_ptr_conv;
40774         this_ptr_conv.inner = untag_ptr(this_ptr);
40775         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40777         this_ptr_conv.is_owned = false;
40778         LDKNodeAnnouncementInfo val_conv;
40779         val_conv.inner = untag_ptr(val);
40780         val_conv.is_owned = ptr_is_owned(val);
40781         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40782         val_conv = NodeAnnouncementInfo_clone(&val_conv);
40783         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
40784 }
40785
40786 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) {
40787         LDKCVec_u64Z channels_arg_constr;
40788         channels_arg_constr.datalen = channels_arg->arr_len;
40789         if (channels_arg_constr.datalen > 0)
40790                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
40791         else
40792                 channels_arg_constr.data = NULL;
40793         int64_t* channels_arg_vals = channels_arg->elems;
40794         for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
40795                 int64_t channels_arg_conv_8 = channels_arg_vals[i];
40796                 channels_arg_constr.data[i] = channels_arg_conv_8;
40797         }
40798         FREE(channels_arg);
40799         LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
40800         lowest_inbound_channel_fees_arg_conv.inner = untag_ptr(lowest_inbound_channel_fees_arg);
40801         lowest_inbound_channel_fees_arg_conv.is_owned = ptr_is_owned(lowest_inbound_channel_fees_arg);
40802         CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv);
40803         lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
40804         LDKNodeAnnouncementInfo announcement_info_arg_conv;
40805         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
40806         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
40807         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
40808         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
40809         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
40810         uint64_t ret_ref = 0;
40811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40813         return ret_ref;
40814 }
40815
40816 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
40817         LDKNodeInfo ret_var = NodeInfo_clone(arg);
40818         uint64_t ret_ref = 0;
40819         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40820         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40821         return ret_ref;
40822 }
40823 int64_t  __attribute__((export_name("TS_NodeInfo_clone_ptr"))) TS_NodeInfo_clone_ptr(uint64_t arg) {
40824         LDKNodeInfo arg_conv;
40825         arg_conv.inner = untag_ptr(arg);
40826         arg_conv.is_owned = ptr_is_owned(arg);
40827         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40828         arg_conv.is_owned = false;
40829         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
40830         return ret_conv;
40831 }
40832
40833 uint64_t  __attribute__((export_name("TS_NodeInfo_clone"))) TS_NodeInfo_clone(uint64_t orig) {
40834         LDKNodeInfo orig_conv;
40835         orig_conv.inner = untag_ptr(orig);
40836         orig_conv.is_owned = ptr_is_owned(orig);
40837         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40838         orig_conv.is_owned = false;
40839         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
40840         uint64_t ret_ref = 0;
40841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40843         return ret_ref;
40844 }
40845
40846 int8_tArray  __attribute__((export_name("TS_NodeInfo_write"))) TS_NodeInfo_write(uint64_t obj) {
40847         LDKNodeInfo obj_conv;
40848         obj_conv.inner = untag_ptr(obj);
40849         obj_conv.is_owned = ptr_is_owned(obj);
40850         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40851         obj_conv.is_owned = false;
40852         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
40853         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40854         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40855         CVec_u8Z_free(ret_var);
40856         return ret_arr;
40857 }
40858
40859 uint64_t  __attribute__((export_name("TS_NodeInfo_read"))) TS_NodeInfo_read(int8_tArray ser) {
40860         LDKu8slice ser_ref;
40861         ser_ref.datalen = ser->arr_len;
40862         ser_ref.data = ser->elems;
40863         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
40864         *ret_conv = NodeInfo_read(ser_ref);
40865         FREE(ser);
40866         return tag_ptr(ret_conv, true);
40867 }
40868
40869 int8_tArray  __attribute__((export_name("TS_NetworkGraph_write"))) TS_NetworkGraph_write(uint64_t obj) {
40870         LDKNetworkGraph obj_conv;
40871         obj_conv.inner = untag_ptr(obj);
40872         obj_conv.is_owned = ptr_is_owned(obj);
40873         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40874         obj_conv.is_owned = false;
40875         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
40876         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40877         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40878         CVec_u8Z_free(ret_var);
40879         return ret_arr;
40880 }
40881
40882 uint64_t  __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_read(int8_tArray ser, uint64_t arg) {
40883         LDKu8slice ser_ref;
40884         ser_ref.datalen = ser->arr_len;
40885         ser_ref.data = ser->elems;
40886         void* arg_ptr = untag_ptr(arg);
40887         CHECK_ACCESS(arg_ptr);
40888         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
40889         if (arg_conv.free == LDKLogger_JCalls_free) {
40890                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40891                 LDKLogger_JCalls_cloned(&arg_conv);
40892         }
40893         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
40894         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
40895         FREE(ser);
40896         return tag_ptr(ret_conv, true);
40897 }
40898
40899 uint64_t  __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(int8_tArray genesis_hash, uint64_t logger) {
40900         LDKThirtyTwoBytes genesis_hash_ref;
40901         CHECK(genesis_hash->arr_len == 32);
40902         memcpy(genesis_hash_ref.data, genesis_hash->elems, 32); FREE(genesis_hash);
40903         void* logger_ptr = untag_ptr(logger);
40904         CHECK_ACCESS(logger_ptr);
40905         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
40906         if (logger_conv.free == LDKLogger_JCalls_free) {
40907                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
40908                 LDKLogger_JCalls_cloned(&logger_conv);
40909         }
40910         LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref, logger_conv);
40911         uint64_t ret_ref = 0;
40912         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40913         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40914         return ret_ref;
40915 }
40916
40917 uint64_t  __attribute__((export_name("TS_NetworkGraph_read_only"))) TS_NetworkGraph_read_only(uint64_t this_arg) {
40918         LDKNetworkGraph this_arg_conv;
40919         this_arg_conv.inner = untag_ptr(this_arg);
40920         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40922         this_arg_conv.is_owned = false;
40923         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
40924         uint64_t ret_ref = 0;
40925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40927         return ret_ref;
40928 }
40929
40930 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) {
40931         LDKNetworkGraph this_arg_conv;
40932         this_arg_conv.inner = untag_ptr(this_arg);
40933         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40935         this_arg_conv.is_owned = false;
40936         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
40937         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
40938         uint64_t ret_ref = tag_ptr(ret_copy, true);
40939         return ret_ref;
40940 }
40941
40942 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) {
40943         LDKNetworkGraph this_arg_conv;
40944         this_arg_conv.inner = untag_ptr(this_arg);
40945         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40947         this_arg_conv.is_owned = false;
40948         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
40949 }
40950
40951 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_node_from_announcement"))) TS_NetworkGraph_update_node_from_announcement(uint64_t this_arg, uint64_t msg) {
40952         LDKNetworkGraph this_arg_conv;
40953         this_arg_conv.inner = untag_ptr(this_arg);
40954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40956         this_arg_conv.is_owned = false;
40957         LDKNodeAnnouncement msg_conv;
40958         msg_conv.inner = untag_ptr(msg);
40959         msg_conv.is_owned = ptr_is_owned(msg);
40960         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
40961         msg_conv.is_owned = false;
40962         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
40963         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
40964         return tag_ptr(ret_conv, true);
40965 }
40966
40967 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) {
40968         LDKNetworkGraph this_arg_conv;
40969         this_arg_conv.inner = untag_ptr(this_arg);
40970         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40972         this_arg_conv.is_owned = false;
40973         LDKUnsignedNodeAnnouncement msg_conv;
40974         msg_conv.inner = untag_ptr(msg);
40975         msg_conv.is_owned = ptr_is_owned(msg);
40976         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
40977         msg_conv.is_owned = false;
40978         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
40979         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
40980         return tag_ptr(ret_conv, true);
40981 }
40982
40983 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) {
40984         LDKNetworkGraph this_arg_conv;
40985         this_arg_conv.inner = untag_ptr(this_arg);
40986         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40988         this_arg_conv.is_owned = false;
40989         LDKChannelAnnouncement msg_conv;
40990         msg_conv.inner = untag_ptr(msg);
40991         msg_conv.is_owned = ptr_is_owned(msg);
40992         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
40993         msg_conv.is_owned = false;
40994         void* chain_access_ptr = untag_ptr(chain_access);
40995         CHECK_ACCESS(chain_access_ptr);
40996         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
40997         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
40998         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
40999                 // Manually implement clone for Java trait instances
41000                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
41001                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41002                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
41003                 }
41004         }
41005         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
41006         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
41007         return tag_ptr(ret_conv, true);
41008 }
41009
41010 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) {
41011         LDKNetworkGraph this_arg_conv;
41012         this_arg_conv.inner = untag_ptr(this_arg);
41013         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41015         this_arg_conv.is_owned = false;
41016         LDKUnsignedChannelAnnouncement msg_conv;
41017         msg_conv.inner = untag_ptr(msg);
41018         msg_conv.is_owned = ptr_is_owned(msg);
41019         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41020         msg_conv.is_owned = false;
41021         void* chain_access_ptr = untag_ptr(chain_access);
41022         CHECK_ACCESS(chain_access_ptr);
41023         LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
41024         // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ
41025         if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
41026                 // Manually implement clone for Java trait instances
41027                 if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
41028                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41029                         LDKAccess_JCalls_cloned(&chain_access_conv.some);
41030                 }
41031         }
41032         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
41033         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
41034         return tag_ptr(ret_conv, true);
41035 }
41036
41037 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) {
41038         LDKNetworkGraph 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         LDKChannelFeatures features_conv;
41044         features_conv.inner = untag_ptr(features);
41045         features_conv.is_owned = ptr_is_owned(features);
41046         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
41047         features_conv = ChannelFeatures_clone(&features_conv);
41048         LDKPublicKey node_id_1_ref;
41049         CHECK(node_id_1->arr_len == 33);
41050         memcpy(node_id_1_ref.compressed_form, node_id_1->elems, 33); FREE(node_id_1);
41051         LDKPublicKey node_id_2_ref;
41052         CHECK(node_id_2->arr_len == 33);
41053         memcpy(node_id_2_ref.compressed_form, node_id_2->elems, 33); FREE(node_id_2);
41054         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
41055         *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);
41056         return tag_ptr(ret_conv, true);
41057 }
41058
41059 void  __attribute__((export_name("TS_NetworkGraph_channel_failed"))) TS_NetworkGraph_channel_failed(uint64_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
41060         LDKNetworkGraph this_arg_conv;
41061         this_arg_conv.inner = untag_ptr(this_arg);
41062         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41064         this_arg_conv.is_owned = false;
41065         NetworkGraph_channel_failed(&this_arg_conv, short_channel_id, is_permanent);
41066 }
41067
41068 void  __attribute__((export_name("TS_NetworkGraph_node_failed"))) TS_NetworkGraph_node_failed(uint64_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
41069         LDKNetworkGraph this_arg_conv;
41070         this_arg_conv.inner = untag_ptr(this_arg);
41071         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41073         this_arg_conv.is_owned = false;
41074         LDKPublicKey _node_id_ref;
41075         CHECK(_node_id->arr_len == 33);
41076         memcpy(_node_id_ref.compressed_form, _node_id->elems, 33); FREE(_node_id);
41077         NetworkGraph_node_failed(&this_arg_conv, _node_id_ref, is_permanent);
41078 }
41079
41080 void  __attribute__((export_name("TS_NetworkGraph_remove_stale_channels_with_time"))) TS_NetworkGraph_remove_stale_channels_with_time(uint64_t this_arg, int64_t current_time_unix) {
41081         LDKNetworkGraph this_arg_conv;
41082         this_arg_conv.inner = untag_ptr(this_arg);
41083         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41085         this_arg_conv.is_owned = false;
41086         NetworkGraph_remove_stale_channels_with_time(&this_arg_conv, current_time_unix);
41087 }
41088
41089 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel"))) TS_NetworkGraph_update_channel(uint64_t this_arg, uint64_t msg) {
41090         LDKNetworkGraph this_arg_conv;
41091         this_arg_conv.inner = untag_ptr(this_arg);
41092         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41094         this_arg_conv.is_owned = false;
41095         LDKChannelUpdate msg_conv;
41096         msg_conv.inner = untag_ptr(msg);
41097         msg_conv.is_owned = ptr_is_owned(msg);
41098         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41099         msg_conv.is_owned = false;
41100         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
41101         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
41102         return tag_ptr(ret_conv, true);
41103 }
41104
41105 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel_unsigned"))) TS_NetworkGraph_update_channel_unsigned(uint64_t this_arg, uint64_t msg) {
41106         LDKNetworkGraph this_arg_conv;
41107         this_arg_conv.inner = untag_ptr(this_arg);
41108         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41110         this_arg_conv.is_owned = false;
41111         LDKUnsignedChannelUpdate msg_conv;
41112         msg_conv.inner = untag_ptr(msg);
41113         msg_conv.is_owned = ptr_is_owned(msg);
41114         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
41115         msg_conv.is_owned = false;
41116         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
41117         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
41118         return tag_ptr(ret_conv, true);
41119 }
41120
41121 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_channel"))) TS_ReadOnlyNetworkGraph_channel(uint64_t this_arg, int64_t short_channel_id) {
41122         LDKReadOnlyNetworkGraph this_arg_conv;
41123         this_arg_conv.inner = untag_ptr(this_arg);
41124         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41126         this_arg_conv.is_owned = false;
41127         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
41128         uint64_t ret_ref = 0;
41129         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41130         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41131         return ret_ref;
41132 }
41133
41134 int64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_channels"))) TS_ReadOnlyNetworkGraph_list_channels(uint64_t this_arg) {
41135         LDKReadOnlyNetworkGraph this_arg_conv;
41136         this_arg_conv.inner = untag_ptr(this_arg);
41137         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41139         this_arg_conv.is_owned = false;
41140         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
41141         int64_tArray ret_arr = NULL;
41142         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
41143         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
41144         for (size_t i = 0; i < ret_var.datalen; i++) {
41145                 int64_t ret_conv_8_conv = ret_var.data[i];
41146                 ret_arr_ptr[i] = ret_conv_8_conv;
41147         }
41148         
41149         FREE(ret_var.data);
41150         return ret_arr;
41151 }
41152
41153 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_node"))) TS_ReadOnlyNetworkGraph_node(uint64_t this_arg, uint64_t node_id) {
41154         LDKReadOnlyNetworkGraph this_arg_conv;
41155         this_arg_conv.inner = untag_ptr(this_arg);
41156         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41158         this_arg_conv.is_owned = false;
41159         LDKNodeId node_id_conv;
41160         node_id_conv.inner = untag_ptr(node_id);
41161         node_id_conv.is_owned = ptr_is_owned(node_id);
41162         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
41163         node_id_conv.is_owned = false;
41164         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
41165         uint64_t ret_ref = 0;
41166         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41167         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41168         return ret_ref;
41169 }
41170
41171 uint64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_nodes"))) TS_ReadOnlyNetworkGraph_list_nodes(uint64_t this_arg) {
41172         LDKReadOnlyNetworkGraph 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         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
41178         uint64_tArray ret_arr = NULL;
41179         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
41180         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
41181         for (size_t i = 0; i < ret_var.datalen; i++) {
41182                 LDKNodeId ret_conv_8_var = ret_var.data[i];
41183                 uint64_t ret_conv_8_ref = 0;
41184                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
41185                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
41186                 ret_arr_ptr[i] = ret_conv_8_ref;
41187         }
41188         
41189         FREE(ret_var.data);
41190         return ret_arr;
41191 }
41192
41193 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) TS_ReadOnlyNetworkGraph_get_addresses(uint64_t this_arg, int8_tArray pubkey) {
41194         LDKReadOnlyNetworkGraph this_arg_conv;
41195         this_arg_conv.inner = untag_ptr(this_arg);
41196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41198         this_arg_conv.is_owned = false;
41199         LDKPublicKey pubkey_ref;
41200         CHECK(pubkey->arr_len == 33);
41201         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
41202         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
41203         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
41204         uint64_t ret_ref = tag_ptr(ret_copy, true);
41205         return ret_ref;
41206 }
41207
41208 void  __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint64_t this_obj) {
41209         LDKRouteHop this_obj_conv;
41210         this_obj_conv.inner = untag_ptr(this_obj);
41211         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41213         RouteHop_free(this_obj_conv);
41214 }
41215
41216 int8_tArray  __attribute__((export_name("TS_RouteHop_get_pubkey"))) TS_RouteHop_get_pubkey(uint64_t this_ptr) {
41217         LDKRouteHop this_ptr_conv;
41218         this_ptr_conv.inner = untag_ptr(this_ptr);
41219         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41221         this_ptr_conv.is_owned = false;
41222         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41223         memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
41224         return ret_arr;
41225 }
41226
41227 void  __attribute__((export_name("TS_RouteHop_set_pubkey"))) TS_RouteHop_set_pubkey(uint64_t this_ptr, int8_tArray val) {
41228         LDKRouteHop this_ptr_conv;
41229         this_ptr_conv.inner = untag_ptr(this_ptr);
41230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41232         this_ptr_conv.is_owned = false;
41233         LDKPublicKey val_ref;
41234         CHECK(val->arr_len == 33);
41235         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41236         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
41237 }
41238
41239 uint64_t  __attribute__((export_name("TS_RouteHop_get_node_features"))) TS_RouteHop_get_node_features(uint64_t this_ptr) {
41240         LDKRouteHop this_ptr_conv;
41241         this_ptr_conv.inner = untag_ptr(this_ptr);
41242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41244         this_ptr_conv.is_owned = false;
41245         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
41246         uint64_t ret_ref = 0;
41247         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41248         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41249         return ret_ref;
41250 }
41251
41252 void  __attribute__((export_name("TS_RouteHop_set_node_features"))) TS_RouteHop_set_node_features(uint64_t this_ptr, uint64_t val) {
41253         LDKRouteHop this_ptr_conv;
41254         this_ptr_conv.inner = untag_ptr(this_ptr);
41255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41257         this_ptr_conv.is_owned = false;
41258         LDKNodeFeatures val_conv;
41259         val_conv.inner = untag_ptr(val);
41260         val_conv.is_owned = ptr_is_owned(val);
41261         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41262         val_conv = NodeFeatures_clone(&val_conv);
41263         RouteHop_set_node_features(&this_ptr_conv, val_conv);
41264 }
41265
41266 int64_t  __attribute__((export_name("TS_RouteHop_get_short_channel_id"))) TS_RouteHop_get_short_channel_id(uint64_t this_ptr) {
41267         LDKRouteHop this_ptr_conv;
41268         this_ptr_conv.inner = untag_ptr(this_ptr);
41269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41271         this_ptr_conv.is_owned = false;
41272         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
41273         return ret_conv;
41274 }
41275
41276 void  __attribute__((export_name("TS_RouteHop_set_short_channel_id"))) TS_RouteHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
41277         LDKRouteHop this_ptr_conv;
41278         this_ptr_conv.inner = untag_ptr(this_ptr);
41279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41281         this_ptr_conv.is_owned = false;
41282         RouteHop_set_short_channel_id(&this_ptr_conv, val);
41283 }
41284
41285 uint64_t  __attribute__((export_name("TS_RouteHop_get_channel_features"))) TS_RouteHop_get_channel_features(uint64_t this_ptr) {
41286         LDKRouteHop this_ptr_conv;
41287         this_ptr_conv.inner = untag_ptr(this_ptr);
41288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41290         this_ptr_conv.is_owned = false;
41291         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
41292         uint64_t ret_ref = 0;
41293         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41294         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41295         return ret_ref;
41296 }
41297
41298 void  __attribute__((export_name("TS_RouteHop_set_channel_features"))) TS_RouteHop_set_channel_features(uint64_t this_ptr, uint64_t val) {
41299         LDKRouteHop this_ptr_conv;
41300         this_ptr_conv.inner = untag_ptr(this_ptr);
41301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41303         this_ptr_conv.is_owned = false;
41304         LDKChannelFeatures val_conv;
41305         val_conv.inner = untag_ptr(val);
41306         val_conv.is_owned = ptr_is_owned(val);
41307         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41308         val_conv = ChannelFeatures_clone(&val_conv);
41309         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
41310 }
41311
41312 int64_t  __attribute__((export_name("TS_RouteHop_get_fee_msat"))) TS_RouteHop_get_fee_msat(uint64_t this_ptr) {
41313         LDKRouteHop this_ptr_conv;
41314         this_ptr_conv.inner = untag_ptr(this_ptr);
41315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41317         this_ptr_conv.is_owned = false;
41318         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
41319         return ret_conv;
41320 }
41321
41322 void  __attribute__((export_name("TS_RouteHop_set_fee_msat"))) TS_RouteHop_set_fee_msat(uint64_t this_ptr, int64_t val) {
41323         LDKRouteHop this_ptr_conv;
41324         this_ptr_conv.inner = untag_ptr(this_ptr);
41325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41327         this_ptr_conv.is_owned = false;
41328         RouteHop_set_fee_msat(&this_ptr_conv, val);
41329 }
41330
41331 int32_t  __attribute__((export_name("TS_RouteHop_get_cltv_expiry_delta"))) TS_RouteHop_get_cltv_expiry_delta(uint64_t this_ptr) {
41332         LDKRouteHop this_ptr_conv;
41333         this_ptr_conv.inner = untag_ptr(this_ptr);
41334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41336         this_ptr_conv.is_owned = false;
41337         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
41338         return ret_conv;
41339 }
41340
41341 void  __attribute__((export_name("TS_RouteHop_set_cltv_expiry_delta"))) TS_RouteHop_set_cltv_expiry_delta(uint64_t this_ptr, int32_t val) {
41342         LDKRouteHop this_ptr_conv;
41343         this_ptr_conv.inner = untag_ptr(this_ptr);
41344         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41346         this_ptr_conv.is_owned = false;
41347         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
41348 }
41349
41350 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) {
41351         LDKPublicKey pubkey_arg_ref;
41352         CHECK(pubkey_arg->arr_len == 33);
41353         memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
41354         LDKNodeFeatures node_features_arg_conv;
41355         node_features_arg_conv.inner = untag_ptr(node_features_arg);
41356         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
41357         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
41358         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
41359         LDKChannelFeatures channel_features_arg_conv;
41360         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
41361         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
41362         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
41363         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
41364         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);
41365         uint64_t ret_ref = 0;
41366         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41367         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41368         return ret_ref;
41369 }
41370
41371 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
41372         LDKRouteHop ret_var = RouteHop_clone(arg);
41373         uint64_t ret_ref = 0;
41374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41376         return ret_ref;
41377 }
41378 int64_t  __attribute__((export_name("TS_RouteHop_clone_ptr"))) TS_RouteHop_clone_ptr(uint64_t arg) {
41379         LDKRouteHop arg_conv;
41380         arg_conv.inner = untag_ptr(arg);
41381         arg_conv.is_owned = ptr_is_owned(arg);
41382         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41383         arg_conv.is_owned = false;
41384         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
41385         return ret_conv;
41386 }
41387
41388 uint64_t  __attribute__((export_name("TS_RouteHop_clone"))) TS_RouteHop_clone(uint64_t orig) {
41389         LDKRouteHop orig_conv;
41390         orig_conv.inner = untag_ptr(orig);
41391         orig_conv.is_owned = ptr_is_owned(orig);
41392         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41393         orig_conv.is_owned = false;
41394         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
41395         uint64_t ret_ref = 0;
41396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41398         return ret_ref;
41399 }
41400
41401 int64_t  __attribute__((export_name("TS_RouteHop_hash"))) TS_RouteHop_hash(uint64_t o) {
41402         LDKRouteHop o_conv;
41403         o_conv.inner = untag_ptr(o);
41404         o_conv.is_owned = ptr_is_owned(o);
41405         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41406         o_conv.is_owned = false;
41407         int64_t ret_conv = RouteHop_hash(&o_conv);
41408         return ret_conv;
41409 }
41410
41411 jboolean  __attribute__((export_name("TS_RouteHop_eq"))) TS_RouteHop_eq(uint64_t a, uint64_t b) {
41412         LDKRouteHop a_conv;
41413         a_conv.inner = untag_ptr(a);
41414         a_conv.is_owned = ptr_is_owned(a);
41415         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41416         a_conv.is_owned = false;
41417         LDKRouteHop b_conv;
41418         b_conv.inner = untag_ptr(b);
41419         b_conv.is_owned = ptr_is_owned(b);
41420         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41421         b_conv.is_owned = false;
41422         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
41423         return ret_conv;
41424 }
41425
41426 int8_tArray  __attribute__((export_name("TS_RouteHop_write"))) TS_RouteHop_write(uint64_t obj) {
41427         LDKRouteHop obj_conv;
41428         obj_conv.inner = untag_ptr(obj);
41429         obj_conv.is_owned = ptr_is_owned(obj);
41430         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41431         obj_conv.is_owned = false;
41432         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
41433         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41434         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41435         CVec_u8Z_free(ret_var);
41436         return ret_arr;
41437 }
41438
41439 uint64_t  __attribute__((export_name("TS_RouteHop_read"))) TS_RouteHop_read(int8_tArray ser) {
41440         LDKu8slice ser_ref;
41441         ser_ref.datalen = ser->arr_len;
41442         ser_ref.data = ser->elems;
41443         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
41444         *ret_conv = RouteHop_read(ser_ref);
41445         FREE(ser);
41446         return tag_ptr(ret_conv, true);
41447 }
41448
41449 void  __attribute__((export_name("TS_Route_free"))) TS_Route_free(uint64_t this_obj) {
41450         LDKRoute this_obj_conv;
41451         this_obj_conv.inner = untag_ptr(this_obj);
41452         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41454         Route_free(this_obj_conv);
41455 }
41456
41457 ptrArray  __attribute__((export_name("TS_Route_get_paths"))) TS_Route_get_paths(uint64_t this_ptr) {
41458         LDKRoute this_ptr_conv;
41459         this_ptr_conv.inner = untag_ptr(this_ptr);
41460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41462         this_ptr_conv.is_owned = false;
41463         LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
41464         ptrArray ret_arr = NULL;
41465         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
41466         uint64_tArray *ret_arr_ptr = (uint64_tArray*)(((uint8_t*)ret_arr) + 8);
41467         for (size_t m = 0; m < ret_var.datalen; m++) {
41468                 LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
41469                 uint64_tArray ret_conv_12_arr = NULL;
41470                 ret_conv_12_arr = init_uint64_tArray(ret_conv_12_var.datalen, __LINE__);
41471                 uint64_t *ret_conv_12_arr_ptr = (uint64_t*)(((uint8_t*)ret_conv_12_arr) + 8);
41472                 for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
41473                         LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
41474                         uint64_t ret_conv_12_conv_10_ref = 0;
41475                         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_conv_10_var);
41476                         ret_conv_12_conv_10_ref = tag_ptr(ret_conv_12_conv_10_var.inner, ret_conv_12_conv_10_var.is_owned);
41477                         ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
41478                 }
41479                 
41480                 FREE(ret_conv_12_var.data);
41481                 ret_arr_ptr[m] = ret_conv_12_arr;
41482         }
41483         
41484         FREE(ret_var.data);
41485         return ret_arr;
41486 }
41487
41488 void  __attribute__((export_name("TS_Route_set_paths"))) TS_Route_set_paths(uint64_t this_ptr, ptrArray val) {
41489         LDKRoute this_ptr_conv;
41490         this_ptr_conv.inner = untag_ptr(this_ptr);
41491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41493         this_ptr_conv.is_owned = false;
41494         LDKCVec_CVec_RouteHopZZ val_constr;
41495         val_constr.datalen = val->arr_len;
41496         if (val_constr.datalen > 0)
41497                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
41498         else
41499                 val_constr.data = NULL;
41500         uint64_tArray* val_vals = (void*) val->elems;
41501         for (size_t m = 0; m < val_constr.datalen; m++) {
41502                 uint64_tArray val_conv_12 = val_vals[m];
41503                 LDKCVec_RouteHopZ val_conv_12_constr;
41504                 val_conv_12_constr.datalen = val_conv_12->arr_len;
41505                 if (val_conv_12_constr.datalen > 0)
41506                         val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
41507                 else
41508                         val_conv_12_constr.data = NULL;
41509                 uint64_t* val_conv_12_vals = val_conv_12->elems;
41510                 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
41511                         uint64_t val_conv_12_conv_10 = val_conv_12_vals[k];
41512                         LDKRouteHop val_conv_12_conv_10_conv;
41513                         val_conv_12_conv_10_conv.inner = untag_ptr(val_conv_12_conv_10);
41514                         val_conv_12_conv_10_conv.is_owned = ptr_is_owned(val_conv_12_conv_10);
41515                         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv_10_conv);
41516                         val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
41517                         val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
41518                 }
41519                 FREE(val_conv_12);
41520                 val_constr.data[m] = val_conv_12_constr;
41521         }
41522         FREE(val);
41523         Route_set_paths(&this_ptr_conv, val_constr);
41524 }
41525
41526 uint64_t  __attribute__((export_name("TS_Route_get_payment_params"))) TS_Route_get_payment_params(uint64_t this_ptr) {
41527         LDKRoute this_ptr_conv;
41528         this_ptr_conv.inner = untag_ptr(this_ptr);
41529         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41531         this_ptr_conv.is_owned = false;
41532         LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
41533         uint64_t ret_ref = 0;
41534         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41535         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41536         return ret_ref;
41537 }
41538
41539 void  __attribute__((export_name("TS_Route_set_payment_params"))) TS_Route_set_payment_params(uint64_t this_ptr, uint64_t val) {
41540         LDKRoute this_ptr_conv;
41541         this_ptr_conv.inner = untag_ptr(this_ptr);
41542         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41544         this_ptr_conv.is_owned = false;
41545         LDKPaymentParameters val_conv;
41546         val_conv.inner = untag_ptr(val);
41547         val_conv.is_owned = ptr_is_owned(val);
41548         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41549         val_conv = PaymentParameters_clone(&val_conv);
41550         Route_set_payment_params(&this_ptr_conv, val_conv);
41551 }
41552
41553 uint64_t  __attribute__((export_name("TS_Route_new"))) TS_Route_new(ptrArray paths_arg, uint64_t payment_params_arg) {
41554         LDKCVec_CVec_RouteHopZZ paths_arg_constr;
41555         paths_arg_constr.datalen = paths_arg->arr_len;
41556         if (paths_arg_constr.datalen > 0)
41557                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
41558         else
41559                 paths_arg_constr.data = NULL;
41560         uint64_tArray* paths_arg_vals = (void*) paths_arg->elems;
41561         for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
41562                 uint64_tArray paths_arg_conv_12 = paths_arg_vals[m];
41563                 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
41564                 paths_arg_conv_12_constr.datalen = paths_arg_conv_12->arr_len;
41565                 if (paths_arg_conv_12_constr.datalen > 0)
41566                         paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
41567                 else
41568                         paths_arg_conv_12_constr.data = NULL;
41569                 uint64_t* paths_arg_conv_12_vals = paths_arg_conv_12->elems;
41570                 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
41571                         uint64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
41572                         LDKRouteHop paths_arg_conv_12_conv_10_conv;
41573                         paths_arg_conv_12_conv_10_conv.inner = untag_ptr(paths_arg_conv_12_conv_10);
41574                         paths_arg_conv_12_conv_10_conv.is_owned = ptr_is_owned(paths_arg_conv_12_conv_10);
41575                         CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_12_conv_10_conv);
41576                         paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
41577                         paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
41578                 }
41579                 FREE(paths_arg_conv_12);
41580                 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
41581         }
41582         FREE(paths_arg);
41583         LDKPaymentParameters payment_params_arg_conv;
41584         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
41585         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
41586         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
41587         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
41588         LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
41589         uint64_t ret_ref = 0;
41590         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41591         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41592         return ret_ref;
41593 }
41594
41595 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
41596         LDKRoute ret_var = Route_clone(arg);
41597         uint64_t ret_ref = 0;
41598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41600         return ret_ref;
41601 }
41602 int64_t  __attribute__((export_name("TS_Route_clone_ptr"))) TS_Route_clone_ptr(uint64_t arg) {
41603         LDKRoute arg_conv;
41604         arg_conv.inner = untag_ptr(arg);
41605         arg_conv.is_owned = ptr_is_owned(arg);
41606         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41607         arg_conv.is_owned = false;
41608         int64_t ret_conv = Route_clone_ptr(&arg_conv);
41609         return ret_conv;
41610 }
41611
41612 uint64_t  __attribute__((export_name("TS_Route_clone"))) TS_Route_clone(uint64_t orig) {
41613         LDKRoute orig_conv;
41614         orig_conv.inner = untag_ptr(orig);
41615         orig_conv.is_owned = ptr_is_owned(orig);
41616         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41617         orig_conv.is_owned = false;
41618         LDKRoute ret_var = Route_clone(&orig_conv);
41619         uint64_t ret_ref = 0;
41620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41622         return ret_ref;
41623 }
41624
41625 int64_t  __attribute__((export_name("TS_Route_hash"))) TS_Route_hash(uint64_t o) {
41626         LDKRoute o_conv;
41627         o_conv.inner = untag_ptr(o);
41628         o_conv.is_owned = ptr_is_owned(o);
41629         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41630         o_conv.is_owned = false;
41631         int64_t ret_conv = Route_hash(&o_conv);
41632         return ret_conv;
41633 }
41634
41635 jboolean  __attribute__((export_name("TS_Route_eq"))) TS_Route_eq(uint64_t a, uint64_t b) {
41636         LDKRoute a_conv;
41637         a_conv.inner = untag_ptr(a);
41638         a_conv.is_owned = ptr_is_owned(a);
41639         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41640         a_conv.is_owned = false;
41641         LDKRoute b_conv;
41642         b_conv.inner = untag_ptr(b);
41643         b_conv.is_owned = ptr_is_owned(b);
41644         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41645         b_conv.is_owned = false;
41646         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
41647         return ret_conv;
41648 }
41649
41650 int64_t  __attribute__((export_name("TS_Route_get_total_fees"))) TS_Route_get_total_fees(uint64_t this_arg) {
41651         LDKRoute this_arg_conv;
41652         this_arg_conv.inner = untag_ptr(this_arg);
41653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41655         this_arg_conv.is_owned = false;
41656         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
41657         return ret_conv;
41658 }
41659
41660 int64_t  __attribute__((export_name("TS_Route_get_total_amount"))) TS_Route_get_total_amount(uint64_t this_arg) {
41661         LDKRoute this_arg_conv;
41662         this_arg_conv.inner = untag_ptr(this_arg);
41663         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41665         this_arg_conv.is_owned = false;
41666         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
41667         return ret_conv;
41668 }
41669
41670 int8_tArray  __attribute__((export_name("TS_Route_write"))) TS_Route_write(uint64_t obj) {
41671         LDKRoute obj_conv;
41672         obj_conv.inner = untag_ptr(obj);
41673         obj_conv.is_owned = ptr_is_owned(obj);
41674         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41675         obj_conv.is_owned = false;
41676         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
41677         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41678         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41679         CVec_u8Z_free(ret_var);
41680         return ret_arr;
41681 }
41682
41683 uint64_t  __attribute__((export_name("TS_Route_read"))) TS_Route_read(int8_tArray ser) {
41684         LDKu8slice ser_ref;
41685         ser_ref.datalen = ser->arr_len;
41686         ser_ref.data = ser->elems;
41687         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
41688         *ret_conv = Route_read(ser_ref);
41689         FREE(ser);
41690         return tag_ptr(ret_conv, true);
41691 }
41692
41693 void  __attribute__((export_name("TS_RouteParameters_free"))) TS_RouteParameters_free(uint64_t this_obj) {
41694         LDKRouteParameters this_obj_conv;
41695         this_obj_conv.inner = untag_ptr(this_obj);
41696         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41698         RouteParameters_free(this_obj_conv);
41699 }
41700
41701 uint64_t  __attribute__((export_name("TS_RouteParameters_get_payment_params"))) TS_RouteParameters_get_payment_params(uint64_t this_ptr) {
41702         LDKRouteParameters this_ptr_conv;
41703         this_ptr_conv.inner = untag_ptr(this_ptr);
41704         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41706         this_ptr_conv.is_owned = false;
41707         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
41708         uint64_t ret_ref = 0;
41709         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41710         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41711         return ret_ref;
41712 }
41713
41714 void  __attribute__((export_name("TS_RouteParameters_set_payment_params"))) TS_RouteParameters_set_payment_params(uint64_t this_ptr, uint64_t val) {
41715         LDKRouteParameters this_ptr_conv;
41716         this_ptr_conv.inner = untag_ptr(this_ptr);
41717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41719         this_ptr_conv.is_owned = false;
41720         LDKPaymentParameters val_conv;
41721         val_conv.inner = untag_ptr(val);
41722         val_conv.is_owned = ptr_is_owned(val);
41723         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41724         val_conv = PaymentParameters_clone(&val_conv);
41725         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
41726 }
41727
41728 int64_t  __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint64_t this_ptr) {
41729         LDKRouteParameters this_ptr_conv;
41730         this_ptr_conv.inner = untag_ptr(this_ptr);
41731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41733         this_ptr_conv.is_owned = false;
41734         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
41735         return ret_conv;
41736 }
41737
41738 void  __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint64_t this_ptr, int64_t val) {
41739         LDKRouteParameters this_ptr_conv;
41740         this_ptr_conv.inner = untag_ptr(this_ptr);
41741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41743         this_ptr_conv.is_owned = false;
41744         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
41745 }
41746
41747 int32_t  __attribute__((export_name("TS_RouteParameters_get_final_cltv_expiry_delta"))) TS_RouteParameters_get_final_cltv_expiry_delta(uint64_t this_ptr) {
41748         LDKRouteParameters this_ptr_conv;
41749         this_ptr_conv.inner = untag_ptr(this_ptr);
41750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41752         this_ptr_conv.is_owned = false;
41753         int32_t ret_conv = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
41754         return ret_conv;
41755 }
41756
41757 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) {
41758         LDKRouteParameters this_ptr_conv;
41759         this_ptr_conv.inner = untag_ptr(this_ptr);
41760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41762         this_ptr_conv.is_owned = false;
41763         RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
41764 }
41765
41766 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) {
41767         LDKPaymentParameters payment_params_arg_conv;
41768         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
41769         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
41770         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
41771         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
41772         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
41773         uint64_t ret_ref = 0;
41774         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41775         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41776         return ret_ref;
41777 }
41778
41779 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
41780         LDKRouteParameters ret_var = RouteParameters_clone(arg);
41781         uint64_t ret_ref = 0;
41782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41784         return ret_ref;
41785 }
41786 int64_t  __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint64_t arg) {
41787         LDKRouteParameters arg_conv;
41788         arg_conv.inner = untag_ptr(arg);
41789         arg_conv.is_owned = ptr_is_owned(arg);
41790         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41791         arg_conv.is_owned = false;
41792         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
41793         return ret_conv;
41794 }
41795
41796 uint64_t  __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint64_t orig) {
41797         LDKRouteParameters orig_conv;
41798         orig_conv.inner = untag_ptr(orig);
41799         orig_conv.is_owned = ptr_is_owned(orig);
41800         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41801         orig_conv.is_owned = false;
41802         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
41803         uint64_t ret_ref = 0;
41804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41806         return ret_ref;
41807 }
41808
41809 int8_tArray  __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint64_t obj) {
41810         LDKRouteParameters obj_conv;
41811         obj_conv.inner = untag_ptr(obj);
41812         obj_conv.is_owned = ptr_is_owned(obj);
41813         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41814         obj_conv.is_owned = false;
41815         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
41816         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41817         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41818         CVec_u8Z_free(ret_var);
41819         return ret_arr;
41820 }
41821
41822 uint64_t  __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
41823         LDKu8slice ser_ref;
41824         ser_ref.datalen = ser->arr_len;
41825         ser_ref.data = ser->elems;
41826         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
41827         *ret_conv = RouteParameters_read(ser_ref);
41828         FREE(ser);
41829         return tag_ptr(ret_conv, true);
41830 }
41831
41832 void  __attribute__((export_name("TS_PaymentParameters_free"))) TS_PaymentParameters_free(uint64_t this_obj) {
41833         LDKPaymentParameters this_obj_conv;
41834         this_obj_conv.inner = untag_ptr(this_obj);
41835         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41837         PaymentParameters_free(this_obj_conv);
41838 }
41839
41840 int8_tArray  __attribute__((export_name("TS_PaymentParameters_get_payee_pubkey"))) TS_PaymentParameters_get_payee_pubkey(uint64_t this_ptr) {
41841         LDKPaymentParameters this_ptr_conv;
41842         this_ptr_conv.inner = untag_ptr(this_ptr);
41843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41845         this_ptr_conv.is_owned = false;
41846         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
41847         memcpy(ret_arr->elems, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form, 33);
41848         return ret_arr;
41849 }
41850
41851 void  __attribute__((export_name("TS_PaymentParameters_set_payee_pubkey"))) TS_PaymentParameters_set_payee_pubkey(uint64_t this_ptr, int8_tArray val) {
41852         LDKPaymentParameters this_ptr_conv;
41853         this_ptr_conv.inner = untag_ptr(this_ptr);
41854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41856         this_ptr_conv.is_owned = false;
41857         LDKPublicKey val_ref;
41858         CHECK(val->arr_len == 33);
41859         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
41860         PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
41861 }
41862
41863 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_features"))) TS_PaymentParameters_get_features(uint64_t this_ptr) {
41864         LDKPaymentParameters 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         LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv);
41870         uint64_t ret_ref = 0;
41871         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41872         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41873         return ret_ref;
41874 }
41875
41876 void  __attribute__((export_name("TS_PaymentParameters_set_features"))) TS_PaymentParameters_set_features(uint64_t this_ptr, uint64_t val) {
41877         LDKPaymentParameters this_ptr_conv;
41878         this_ptr_conv.inner = untag_ptr(this_ptr);
41879         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41881         this_ptr_conv.is_owned = false;
41882         LDKInvoiceFeatures val_conv;
41883         val_conv.inner = untag_ptr(val);
41884         val_conv.is_owned = ptr_is_owned(val);
41885         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41886         val_conv = InvoiceFeatures_clone(&val_conv);
41887         PaymentParameters_set_features(&this_ptr_conv, val_conv);
41888 }
41889
41890 uint64_tArray  __attribute__((export_name("TS_PaymentParameters_get_route_hints"))) TS_PaymentParameters_get_route_hints(uint64_t this_ptr) {
41891         LDKPaymentParameters this_ptr_conv;
41892         this_ptr_conv.inner = untag_ptr(this_ptr);
41893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41895         this_ptr_conv.is_owned = false;
41896         LDKCVec_RouteHintZ ret_var = PaymentParameters_get_route_hints(&this_ptr_conv);
41897         uint64_tArray ret_arr = NULL;
41898         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
41899         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
41900         for (size_t l = 0; l < ret_var.datalen; l++) {
41901                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
41902                 uint64_t ret_conv_11_ref = 0;
41903                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
41904                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
41905                 ret_arr_ptr[l] = ret_conv_11_ref;
41906         }
41907         
41908         FREE(ret_var.data);
41909         return ret_arr;
41910 }
41911
41912 void  __attribute__((export_name("TS_PaymentParameters_set_route_hints"))) TS_PaymentParameters_set_route_hints(uint64_t this_ptr, uint64_tArray val) {
41913         LDKPaymentParameters 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         LDKCVec_RouteHintZ val_constr;
41919         val_constr.datalen = val->arr_len;
41920         if (val_constr.datalen > 0)
41921                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
41922         else
41923                 val_constr.data = NULL;
41924         uint64_t* val_vals = val->elems;
41925         for (size_t l = 0; l < val_constr.datalen; l++) {
41926                 uint64_t val_conv_11 = val_vals[l];
41927                 LDKRouteHint val_conv_11_conv;
41928                 val_conv_11_conv.inner = untag_ptr(val_conv_11);
41929                 val_conv_11_conv.is_owned = ptr_is_owned(val_conv_11);
41930                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_11_conv);
41931                 val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
41932                 val_constr.data[l] = val_conv_11_conv;
41933         }
41934         FREE(val);
41935         PaymentParameters_set_route_hints(&this_ptr_conv, val_constr);
41936 }
41937
41938 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_expiry_time"))) TS_PaymentParameters_get_expiry_time(uint64_t this_ptr) {
41939         LDKPaymentParameters this_ptr_conv;
41940         this_ptr_conv.inner = untag_ptr(this_ptr);
41941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41943         this_ptr_conv.is_owned = false;
41944         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
41945         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
41946         uint64_t ret_ref = tag_ptr(ret_copy, true);
41947         return ret_ref;
41948 }
41949
41950 void  __attribute__((export_name("TS_PaymentParameters_set_expiry_time"))) TS_PaymentParameters_set_expiry_time(uint64_t this_ptr, uint64_t val) {
41951         LDKPaymentParameters this_ptr_conv;
41952         this_ptr_conv.inner = untag_ptr(this_ptr);
41953         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41955         this_ptr_conv.is_owned = false;
41956         void* val_ptr = untag_ptr(val);
41957         CHECK_ACCESS(val_ptr);
41958         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
41959         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
41960         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
41961 }
41962
41963 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) {
41964         LDKPaymentParameters this_ptr_conv;
41965         this_ptr_conv.inner = untag_ptr(this_ptr);
41966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41968         this_ptr_conv.is_owned = false;
41969         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
41970         return ret_conv;
41971 }
41972
41973 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) {
41974         LDKPaymentParameters this_ptr_conv;
41975         this_ptr_conv.inner = untag_ptr(this_ptr);
41976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41978         this_ptr_conv.is_owned = false;
41979         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
41980 }
41981
41982 int8_t  __attribute__((export_name("TS_PaymentParameters_get_max_path_count"))) TS_PaymentParameters_get_max_path_count(uint64_t this_ptr) {
41983         LDKPaymentParameters this_ptr_conv;
41984         this_ptr_conv.inner = untag_ptr(this_ptr);
41985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41987         this_ptr_conv.is_owned = false;
41988         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
41989         return ret_conv;
41990 }
41991
41992 void  __attribute__((export_name("TS_PaymentParameters_set_max_path_count"))) TS_PaymentParameters_set_max_path_count(uint64_t this_ptr, int8_t val) {
41993         LDKPaymentParameters this_ptr_conv;
41994         this_ptr_conv.inner = untag_ptr(this_ptr);
41995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41997         this_ptr_conv.is_owned = false;
41998         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
41999 }
42000
42001 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) {
42002         LDKPaymentParameters this_ptr_conv;
42003         this_ptr_conv.inner = untag_ptr(this_ptr);
42004         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42006         this_ptr_conv.is_owned = false;
42007         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
42008         return ret_conv;
42009 }
42010
42011 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) {
42012         LDKPaymentParameters this_ptr_conv;
42013         this_ptr_conv.inner = untag_ptr(this_ptr);
42014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42016         this_ptr_conv.is_owned = false;
42017         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
42018 }
42019
42020 int64_tArray  __attribute__((export_name("TS_PaymentParameters_get_previously_failed_channels"))) TS_PaymentParameters_get_previously_failed_channels(uint64_t this_ptr) {
42021         LDKPaymentParameters 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         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
42027         int64_tArray ret_arr = NULL;
42028         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
42029         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
42030         for (size_t i = 0; i < ret_var.datalen; i++) {
42031                 int64_t ret_conv_8_conv = ret_var.data[i];
42032                 ret_arr_ptr[i] = ret_conv_8_conv;
42033         }
42034         
42035         FREE(ret_var.data);
42036         return ret_arr;
42037 }
42038
42039 void  __attribute__((export_name("TS_PaymentParameters_set_previously_failed_channels"))) TS_PaymentParameters_set_previously_failed_channels(uint64_t this_ptr, int64_tArray val) {
42040         LDKPaymentParameters this_ptr_conv;
42041         this_ptr_conv.inner = untag_ptr(this_ptr);
42042         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42044         this_ptr_conv.is_owned = false;
42045         LDKCVec_u64Z val_constr;
42046         val_constr.datalen = val->arr_len;
42047         if (val_constr.datalen > 0)
42048                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
42049         else
42050                 val_constr.data = NULL;
42051         int64_t* val_vals = val->elems;
42052         for (size_t i = 0; i < val_constr.datalen; i++) {
42053                 int64_t val_conv_8 = val_vals[i];
42054                 val_constr.data[i] = val_conv_8;
42055         }
42056         FREE(val);
42057         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
42058 }
42059
42060 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) {
42061         LDKPublicKey payee_pubkey_arg_ref;
42062         CHECK(payee_pubkey_arg->arr_len == 33);
42063         memcpy(payee_pubkey_arg_ref.compressed_form, payee_pubkey_arg->elems, 33); FREE(payee_pubkey_arg);
42064         LDKInvoiceFeatures features_arg_conv;
42065         features_arg_conv.inner = untag_ptr(features_arg);
42066         features_arg_conv.is_owned = ptr_is_owned(features_arg);
42067         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
42068         features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
42069         LDKCVec_RouteHintZ route_hints_arg_constr;
42070         route_hints_arg_constr.datalen = route_hints_arg->arr_len;
42071         if (route_hints_arg_constr.datalen > 0)
42072                 route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
42073         else
42074                 route_hints_arg_constr.data = NULL;
42075         uint64_t* route_hints_arg_vals = route_hints_arg->elems;
42076         for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
42077                 uint64_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
42078                 LDKRouteHint route_hints_arg_conv_11_conv;
42079                 route_hints_arg_conv_11_conv.inner = untag_ptr(route_hints_arg_conv_11);
42080                 route_hints_arg_conv_11_conv.is_owned = ptr_is_owned(route_hints_arg_conv_11);
42081                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_arg_conv_11_conv);
42082                 route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
42083                 route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
42084         }
42085         FREE(route_hints_arg);
42086         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
42087         CHECK_ACCESS(expiry_time_arg_ptr);
42088         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
42089         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
42090         LDKCVec_u64Z previously_failed_channels_arg_constr;
42091         previously_failed_channels_arg_constr.datalen = previously_failed_channels_arg->arr_len;
42092         if (previously_failed_channels_arg_constr.datalen > 0)
42093                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
42094         else
42095                 previously_failed_channels_arg_constr.data = NULL;
42096         int64_t* previously_failed_channels_arg_vals = previously_failed_channels_arg->elems;
42097         for (size_t i = 0; i < previously_failed_channels_arg_constr.datalen; i++) {
42098                 int64_t previously_failed_channels_arg_conv_8 = previously_failed_channels_arg_vals[i];
42099                 previously_failed_channels_arg_constr.data[i] = previously_failed_channels_arg_conv_8;
42100         }
42101         FREE(previously_failed_channels_arg);
42102         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);
42103         uint64_t ret_ref = 0;
42104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42106         return ret_ref;
42107 }
42108
42109 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
42110         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
42111         uint64_t ret_ref = 0;
42112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42114         return ret_ref;
42115 }
42116 int64_t  __attribute__((export_name("TS_PaymentParameters_clone_ptr"))) TS_PaymentParameters_clone_ptr(uint64_t arg) {
42117         LDKPaymentParameters arg_conv;
42118         arg_conv.inner = untag_ptr(arg);
42119         arg_conv.is_owned = ptr_is_owned(arg);
42120         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42121         arg_conv.is_owned = false;
42122         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
42123         return ret_conv;
42124 }
42125
42126 uint64_t  __attribute__((export_name("TS_PaymentParameters_clone"))) TS_PaymentParameters_clone(uint64_t orig) {
42127         LDKPaymentParameters orig_conv;
42128         orig_conv.inner = untag_ptr(orig);
42129         orig_conv.is_owned = ptr_is_owned(orig);
42130         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42131         orig_conv.is_owned = false;
42132         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
42133         uint64_t ret_ref = 0;
42134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42136         return ret_ref;
42137 }
42138
42139 int64_t  __attribute__((export_name("TS_PaymentParameters_hash"))) TS_PaymentParameters_hash(uint64_t o) {
42140         LDKPaymentParameters o_conv;
42141         o_conv.inner = untag_ptr(o);
42142         o_conv.is_owned = ptr_is_owned(o);
42143         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42144         o_conv.is_owned = false;
42145         int64_t ret_conv = PaymentParameters_hash(&o_conv);
42146         return ret_conv;
42147 }
42148
42149 jboolean  __attribute__((export_name("TS_PaymentParameters_eq"))) TS_PaymentParameters_eq(uint64_t a, uint64_t b) {
42150         LDKPaymentParameters a_conv;
42151         a_conv.inner = untag_ptr(a);
42152         a_conv.is_owned = ptr_is_owned(a);
42153         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42154         a_conv.is_owned = false;
42155         LDKPaymentParameters b_conv;
42156         b_conv.inner = untag_ptr(b);
42157         b_conv.is_owned = ptr_is_owned(b);
42158         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42159         b_conv.is_owned = false;
42160         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
42161         return ret_conv;
42162 }
42163
42164 int8_tArray  __attribute__((export_name("TS_PaymentParameters_write"))) TS_PaymentParameters_write(uint64_t obj) {
42165         LDKPaymentParameters obj_conv;
42166         obj_conv.inner = untag_ptr(obj);
42167         obj_conv.is_owned = ptr_is_owned(obj);
42168         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42169         obj_conv.is_owned = false;
42170         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
42171         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42172         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42173         CVec_u8Z_free(ret_var);
42174         return ret_arr;
42175 }
42176
42177 uint64_t  __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser) {
42178         LDKu8slice ser_ref;
42179         ser_ref.datalen = ser->arr_len;
42180         ser_ref.data = ser->elems;
42181         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
42182         *ret_conv = PaymentParameters_read(ser_ref);
42183         FREE(ser);
42184         return tag_ptr(ret_conv, true);
42185 }
42186
42187 uint64_t  __attribute__((export_name("TS_PaymentParameters_from_node_id"))) TS_PaymentParameters_from_node_id(int8_tArray payee_pubkey) {
42188         LDKPublicKey payee_pubkey_ref;
42189         CHECK(payee_pubkey->arr_len == 33);
42190         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
42191         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref);
42192         uint64_t ret_ref = 0;
42193         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42194         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42195         return ret_ref;
42196 }
42197
42198 uint64_t  __attribute__((export_name("TS_PaymentParameters_for_keysend"))) TS_PaymentParameters_for_keysend(int8_tArray payee_pubkey) {
42199         LDKPublicKey payee_pubkey_ref;
42200         CHECK(payee_pubkey->arr_len == 33);
42201         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
42202         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref);
42203         uint64_t ret_ref = 0;
42204         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42205         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42206         return ret_ref;
42207 }
42208
42209 void  __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint64_t this_obj) {
42210         LDKRouteHint this_obj_conv;
42211         this_obj_conv.inner = untag_ptr(this_obj);
42212         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42214         RouteHint_free(this_obj_conv);
42215 }
42216
42217 uint64_tArray  __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint64_t this_ptr) {
42218         LDKRouteHint this_ptr_conv;
42219         this_ptr_conv.inner = untag_ptr(this_ptr);
42220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42222         this_ptr_conv.is_owned = false;
42223         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
42224         uint64_tArray ret_arr = NULL;
42225         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
42226         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
42227         for (size_t o = 0; o < ret_var.datalen; o++) {
42228                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
42229                 uint64_t ret_conv_14_ref = 0;
42230                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
42231                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
42232                 ret_arr_ptr[o] = ret_conv_14_ref;
42233         }
42234         
42235         FREE(ret_var.data);
42236         return ret_arr;
42237 }
42238
42239 void  __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint64_t this_ptr, uint64_tArray val) {
42240         LDKRouteHint this_ptr_conv;
42241         this_ptr_conv.inner = untag_ptr(this_ptr);
42242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42244         this_ptr_conv.is_owned = false;
42245         LDKCVec_RouteHintHopZ val_constr;
42246         val_constr.datalen = val->arr_len;
42247         if (val_constr.datalen > 0)
42248                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
42249         else
42250                 val_constr.data = NULL;
42251         uint64_t* val_vals = val->elems;
42252         for (size_t o = 0; o < val_constr.datalen; o++) {
42253                 uint64_t val_conv_14 = val_vals[o];
42254                 LDKRouteHintHop val_conv_14_conv;
42255                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
42256                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
42257                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
42258                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
42259                 val_constr.data[o] = val_conv_14_conv;
42260         }
42261         FREE(val);
42262         RouteHint_set_a(&this_ptr_conv, val_constr);
42263 }
42264
42265 uint64_t  __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint64_tArray a_arg) {
42266         LDKCVec_RouteHintHopZ a_arg_constr;
42267         a_arg_constr.datalen = a_arg->arr_len;
42268         if (a_arg_constr.datalen > 0)
42269                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
42270         else
42271                 a_arg_constr.data = NULL;
42272         uint64_t* a_arg_vals = a_arg->elems;
42273         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
42274                 uint64_t a_arg_conv_14 = a_arg_vals[o];
42275                 LDKRouteHintHop a_arg_conv_14_conv;
42276                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
42277                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
42278                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
42279                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
42280                 a_arg_constr.data[o] = a_arg_conv_14_conv;
42281         }
42282         FREE(a_arg);
42283         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
42284         uint64_t ret_ref = 0;
42285         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42286         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42287         return ret_ref;
42288 }
42289
42290 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
42291         LDKRouteHint ret_var = RouteHint_clone(arg);
42292         uint64_t ret_ref = 0;
42293         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42294         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42295         return ret_ref;
42296 }
42297 int64_t  __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint64_t arg) {
42298         LDKRouteHint arg_conv;
42299         arg_conv.inner = untag_ptr(arg);
42300         arg_conv.is_owned = ptr_is_owned(arg);
42301         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42302         arg_conv.is_owned = false;
42303         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
42304         return ret_conv;
42305 }
42306
42307 uint64_t  __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint64_t orig) {
42308         LDKRouteHint orig_conv;
42309         orig_conv.inner = untag_ptr(orig);
42310         orig_conv.is_owned = ptr_is_owned(orig);
42311         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42312         orig_conv.is_owned = false;
42313         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
42314         uint64_t ret_ref = 0;
42315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42317         return ret_ref;
42318 }
42319
42320 int64_t  __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint64_t o) {
42321         LDKRouteHint o_conv;
42322         o_conv.inner = untag_ptr(o);
42323         o_conv.is_owned = ptr_is_owned(o);
42324         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42325         o_conv.is_owned = false;
42326         int64_t ret_conv = RouteHint_hash(&o_conv);
42327         return ret_conv;
42328 }
42329
42330 jboolean  __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint64_t a, uint64_t b) {
42331         LDKRouteHint a_conv;
42332         a_conv.inner = untag_ptr(a);
42333         a_conv.is_owned = ptr_is_owned(a);
42334         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42335         a_conv.is_owned = false;
42336         LDKRouteHint b_conv;
42337         b_conv.inner = untag_ptr(b);
42338         b_conv.is_owned = ptr_is_owned(b);
42339         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42340         b_conv.is_owned = false;
42341         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
42342         return ret_conv;
42343 }
42344
42345 int8_tArray  __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint64_t obj) {
42346         LDKRouteHint obj_conv;
42347         obj_conv.inner = untag_ptr(obj);
42348         obj_conv.is_owned = ptr_is_owned(obj);
42349         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42350         obj_conv.is_owned = false;
42351         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
42352         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42353         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42354         CVec_u8Z_free(ret_var);
42355         return ret_arr;
42356 }
42357
42358 uint64_t  __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
42359         LDKu8slice ser_ref;
42360         ser_ref.datalen = ser->arr_len;
42361         ser_ref.data = ser->elems;
42362         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
42363         *ret_conv = RouteHint_read(ser_ref);
42364         FREE(ser);
42365         return tag_ptr(ret_conv, true);
42366 }
42367
42368 void  __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint64_t this_obj) {
42369         LDKRouteHintHop this_obj_conv;
42370         this_obj_conv.inner = untag_ptr(this_obj);
42371         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42373         RouteHintHop_free(this_obj_conv);
42374 }
42375
42376 int8_tArray  __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint64_t this_ptr) {
42377         LDKRouteHintHop this_ptr_conv;
42378         this_ptr_conv.inner = untag_ptr(this_ptr);
42379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42381         this_ptr_conv.is_owned = false;
42382         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
42383         memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
42384         return ret_arr;
42385 }
42386
42387 void  __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint64_t this_ptr, int8_tArray val) {
42388         LDKRouteHintHop this_ptr_conv;
42389         this_ptr_conv.inner = untag_ptr(this_ptr);
42390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42392         this_ptr_conv.is_owned = false;
42393         LDKPublicKey val_ref;
42394         CHECK(val->arr_len == 33);
42395         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
42396         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
42397 }
42398
42399 int64_t  __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint64_t this_ptr) {
42400         LDKRouteHintHop this_ptr_conv;
42401         this_ptr_conv.inner = untag_ptr(this_ptr);
42402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42404         this_ptr_conv.is_owned = false;
42405         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
42406         return ret_conv;
42407 }
42408
42409 void  __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
42410         LDKRouteHintHop this_ptr_conv;
42411         this_ptr_conv.inner = untag_ptr(this_ptr);
42412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42414         this_ptr_conv.is_owned = false;
42415         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
42416 }
42417
42418 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint64_t this_ptr) {
42419         LDKRouteHintHop this_ptr_conv;
42420         this_ptr_conv.inner = untag_ptr(this_ptr);
42421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42423         this_ptr_conv.is_owned = false;
42424         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
42425         uint64_t ret_ref = 0;
42426         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42427         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42428         return ret_ref;
42429 }
42430
42431 void  __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint64_t this_ptr, uint64_t val) {
42432         LDKRouteHintHop this_ptr_conv;
42433         this_ptr_conv.inner = untag_ptr(this_ptr);
42434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42436         this_ptr_conv.is_owned = false;
42437         LDKRoutingFees val_conv;
42438         val_conv.inner = untag_ptr(val);
42439         val_conv.is_owned = ptr_is_owned(val);
42440         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42441         val_conv = RoutingFees_clone(&val_conv);
42442         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
42443 }
42444
42445 int16_t  __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint64_t this_ptr) {
42446         LDKRouteHintHop this_ptr_conv;
42447         this_ptr_conv.inner = untag_ptr(this_ptr);
42448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42450         this_ptr_conv.is_owned = false;
42451         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
42452         return ret_conv;
42453 }
42454
42455 void  __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
42456         LDKRouteHintHop this_ptr_conv;
42457         this_ptr_conv.inner = untag_ptr(this_ptr);
42458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42460         this_ptr_conv.is_owned = false;
42461         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
42462 }
42463
42464 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint64_t this_ptr) {
42465         LDKRouteHintHop this_ptr_conv;
42466         this_ptr_conv.inner = untag_ptr(this_ptr);
42467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42469         this_ptr_conv.is_owned = false;
42470         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42471         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
42472         uint64_t ret_ref = tag_ptr(ret_copy, true);
42473         return ret_ref;
42474 }
42475
42476 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint64_t this_ptr, uint64_t val) {
42477         LDKRouteHintHop this_ptr_conv;
42478         this_ptr_conv.inner = untag_ptr(this_ptr);
42479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42481         this_ptr_conv.is_owned = false;
42482         void* val_ptr = untag_ptr(val);
42483         CHECK_ACCESS(val_ptr);
42484         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42485         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
42486         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
42487 }
42488
42489 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint64_t this_ptr) {
42490         LDKRouteHintHop this_ptr_conv;
42491         this_ptr_conv.inner = untag_ptr(this_ptr);
42492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42494         this_ptr_conv.is_owned = false;
42495         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
42496         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
42497         uint64_t ret_ref = tag_ptr(ret_copy, true);
42498         return ret_ref;
42499 }
42500
42501 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint64_t this_ptr, uint64_t val) {
42502         LDKRouteHintHop this_ptr_conv;
42503         this_ptr_conv.inner = untag_ptr(this_ptr);
42504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42506         this_ptr_conv.is_owned = false;
42507         void* val_ptr = untag_ptr(val);
42508         CHECK_ACCESS(val_ptr);
42509         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
42510         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
42511         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
42512 }
42513
42514 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) {
42515         LDKPublicKey src_node_id_arg_ref;
42516         CHECK(src_node_id_arg->arr_len == 33);
42517         memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
42518         LDKRoutingFees fees_arg_conv;
42519         fees_arg_conv.inner = untag_ptr(fees_arg);
42520         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
42521         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
42522         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
42523         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
42524         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
42525         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
42526         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
42527         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
42528         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
42529         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
42530         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
42531         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);
42532         uint64_t ret_ref = 0;
42533         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42534         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42535         return ret_ref;
42536 }
42537
42538 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
42539         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
42540         uint64_t ret_ref = 0;
42541         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42542         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42543         return ret_ref;
42544 }
42545 int64_t  __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint64_t arg) {
42546         LDKRouteHintHop arg_conv;
42547         arg_conv.inner = untag_ptr(arg);
42548         arg_conv.is_owned = ptr_is_owned(arg);
42549         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42550         arg_conv.is_owned = false;
42551         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
42552         return ret_conv;
42553 }
42554
42555 uint64_t  __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint64_t orig) {
42556         LDKRouteHintHop orig_conv;
42557         orig_conv.inner = untag_ptr(orig);
42558         orig_conv.is_owned = ptr_is_owned(orig);
42559         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42560         orig_conv.is_owned = false;
42561         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
42562         uint64_t ret_ref = 0;
42563         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42564         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42565         return ret_ref;
42566 }
42567
42568 int64_t  __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint64_t o) {
42569         LDKRouteHintHop o_conv;
42570         o_conv.inner = untag_ptr(o);
42571         o_conv.is_owned = ptr_is_owned(o);
42572         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
42573         o_conv.is_owned = false;
42574         int64_t ret_conv = RouteHintHop_hash(&o_conv);
42575         return ret_conv;
42576 }
42577
42578 jboolean  __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint64_t a, uint64_t b) {
42579         LDKRouteHintHop a_conv;
42580         a_conv.inner = untag_ptr(a);
42581         a_conv.is_owned = ptr_is_owned(a);
42582         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42583         a_conv.is_owned = false;
42584         LDKRouteHintHop b_conv;
42585         b_conv.inner = untag_ptr(b);
42586         b_conv.is_owned = ptr_is_owned(b);
42587         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42588         b_conv.is_owned = false;
42589         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
42590         return ret_conv;
42591 }
42592
42593 int8_tArray  __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint64_t obj) {
42594         LDKRouteHintHop obj_conv;
42595         obj_conv.inner = untag_ptr(obj);
42596         obj_conv.is_owned = ptr_is_owned(obj);
42597         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42598         obj_conv.is_owned = false;
42599         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
42600         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42601         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42602         CVec_u8Z_free(ret_var);
42603         return ret_arr;
42604 }
42605
42606 uint64_t  __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
42607         LDKu8slice ser_ref;
42608         ser_ref.datalen = ser->arr_len;
42609         ser_ref.data = ser->elems;
42610         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
42611         *ret_conv = RouteHintHop_read(ser_ref);
42612         FREE(ser);
42613         return tag_ptr(ret_conv, true);
42614 }
42615
42616 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) {
42617         LDKPublicKey our_node_pubkey_ref;
42618         CHECK(our_node_pubkey->arr_len == 33);
42619         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
42620         LDKRouteParameters route_params_conv;
42621         route_params_conv.inner = untag_ptr(route_params);
42622         route_params_conv.is_owned = ptr_is_owned(route_params);
42623         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
42624         route_params_conv.is_owned = false;
42625         LDKNetworkGraph network_graph_conv;
42626         network_graph_conv.inner = untag_ptr(network_graph);
42627         network_graph_conv.is_owned = ptr_is_owned(network_graph);
42628         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
42629         network_graph_conv.is_owned = false;
42630         LDKCVec_ChannelDetailsZ first_hops_constr;
42631         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
42632         if (first_hops != 0) {
42633                 first_hops_constr.datalen = first_hops->arr_len;
42634                 if (first_hops_constr.datalen > 0)
42635                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
42636                 else
42637                         first_hops_constr.data = NULL;
42638                 uint64_t* first_hops_vals = first_hops->elems;
42639                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
42640                         uint64_t first_hops_conv_16 = first_hops_vals[q];
42641                         LDKChannelDetails first_hops_conv_16_conv;
42642                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
42643                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
42644                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
42645                         first_hops_conv_16_conv.is_owned = false;
42646                         first_hops_constr.data[q] = first_hops_conv_16_conv;
42647                 }
42648                 FREE(first_hops);
42649                 first_hops_ptr = &first_hops_constr;
42650         }
42651         void* logger_ptr = untag_ptr(logger);
42652         CHECK_ACCESS(logger_ptr);
42653         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
42654         if (logger_conv.free == LDKLogger_JCalls_free) {
42655                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42656                 LDKLogger_JCalls_cloned(&logger_conv);
42657         }
42658         void* scorer_ptr = untag_ptr(scorer);
42659         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
42660         LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
42661         unsigned char random_seed_bytes_arr[32];
42662         CHECK(random_seed_bytes->arr_len == 32);
42663         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
42664         unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
42665         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
42666         *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);
42667         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
42668         return tag_ptr(ret_conv, true);
42669 }
42670
42671 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) {
42672         LDKPublicKey our_node_pubkey_ref;
42673         CHECK(our_node_pubkey->arr_len == 33);
42674         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
42675         LDKCVec_PublicKeyZ hops_constr;
42676         hops_constr.datalen = hops->arr_len;
42677         if (hops_constr.datalen > 0)
42678                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
42679         else
42680                 hops_constr.data = NULL;
42681         int8_tArray* hops_vals = (void*) hops->elems;
42682         for (size_t m = 0; m < hops_constr.datalen; m++) {
42683                 int8_tArray hops_conv_12 = hops_vals[m];
42684                 LDKPublicKey hops_conv_12_ref;
42685                 CHECK(hops_conv_12->arr_len == 33);
42686                 memcpy(hops_conv_12_ref.compressed_form, hops_conv_12->elems, 33); FREE(hops_conv_12);
42687                 hops_constr.data[m] = hops_conv_12_ref;
42688         }
42689         FREE(hops);
42690         LDKRouteParameters route_params_conv;
42691         route_params_conv.inner = untag_ptr(route_params);
42692         route_params_conv.is_owned = ptr_is_owned(route_params);
42693         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
42694         route_params_conv.is_owned = false;
42695         LDKNetworkGraph network_graph_conv;
42696         network_graph_conv.inner = untag_ptr(network_graph);
42697         network_graph_conv.is_owned = ptr_is_owned(network_graph);
42698         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
42699         network_graph_conv.is_owned = false;
42700         void* logger_ptr = untag_ptr(logger);
42701         CHECK_ACCESS(logger_ptr);
42702         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
42703         if (logger_conv.free == LDKLogger_JCalls_free) {
42704                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42705                 LDKLogger_JCalls_cloned(&logger_conv);
42706         }
42707         unsigned char random_seed_bytes_arr[32];
42708         CHECK(random_seed_bytes->arr_len == 32);
42709         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
42710         unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
42711         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
42712         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
42713         return tag_ptr(ret_conv, true);
42714 }
42715
42716 void  __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint64_t this_ptr) {
42717         if (!ptr_is_owned(this_ptr)) return;
42718         void* this_ptr_ptr = untag_ptr(this_ptr);
42719         CHECK_ACCESS(this_ptr_ptr);
42720         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
42721         FREE(untag_ptr(this_ptr));
42722         Score_free(this_ptr_conv);
42723 }
42724
42725 void  __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint64_t this_ptr) {
42726         if (!ptr_is_owned(this_ptr)) return;
42727         void* this_ptr_ptr = untag_ptr(this_ptr);
42728         CHECK_ACCESS(this_ptr_ptr);
42729         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
42730         FREE(untag_ptr(this_ptr));
42731         LockableScore_free(this_ptr_conv);
42732 }
42733
42734 void  __attribute__((export_name("TS_WriteableScore_free"))) TS_WriteableScore_free(uint64_t this_ptr) {
42735         if (!ptr_is_owned(this_ptr)) return;
42736         void* this_ptr_ptr = untag_ptr(this_ptr);
42737         CHECK_ACCESS(this_ptr_ptr);
42738         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
42739         FREE(untag_ptr(this_ptr));
42740         WriteableScore_free(this_ptr_conv);
42741 }
42742
42743 void  __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint64_t this_obj) {
42744         LDKMultiThreadedLockableScore this_obj_conv;
42745         this_obj_conv.inner = untag_ptr(this_obj);
42746         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42748         MultiThreadedLockableScore_free(this_obj_conv);
42749 }
42750
42751 void  __attribute__((export_name("TS_MultiThreadedScoreLock_free"))) TS_MultiThreadedScoreLock_free(uint64_t this_obj) {
42752         LDKMultiThreadedScoreLock this_obj_conv;
42753         this_obj_conv.inner = untag_ptr(this_obj);
42754         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42756         MultiThreadedScoreLock_free(this_obj_conv);
42757 }
42758
42759 uint64_t  __attribute__((export_name("TS_MultiThreadedScoreLock_as_Score"))) TS_MultiThreadedScoreLock_as_Score(uint64_t this_arg) {
42760         LDKMultiThreadedScoreLock this_arg_conv;
42761         this_arg_conv.inner = untag_ptr(this_arg);
42762         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42764         this_arg_conv.is_owned = false;
42765         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
42766         *ret_ret = MultiThreadedScoreLock_as_Score(&this_arg_conv);
42767         return tag_ptr(ret_ret, true);
42768 }
42769
42770 int8_tArray  __attribute__((export_name("TS_MultiThreadedScoreLock_write"))) TS_MultiThreadedScoreLock_write(uint64_t obj) {
42771         LDKMultiThreadedScoreLock obj_conv;
42772         obj_conv.inner = untag_ptr(obj);
42773         obj_conv.is_owned = ptr_is_owned(obj);
42774         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42775         obj_conv.is_owned = false;
42776         LDKCVec_u8Z ret_var = MultiThreadedScoreLock_write(&obj_conv);
42777         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42778         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42779         CVec_u8Z_free(ret_var);
42780         return ret_arr;
42781 }
42782
42783 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_LockableScore"))) TS_MultiThreadedLockableScore_as_LockableScore(uint64_t this_arg) {
42784         LDKMultiThreadedLockableScore this_arg_conv;
42785         this_arg_conv.inner = untag_ptr(this_arg);
42786         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42788         this_arg_conv.is_owned = false;
42789         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
42790         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
42791         return tag_ptr(ret_ret, true);
42792 }
42793
42794 int8_tArray  __attribute__((export_name("TS_MultiThreadedLockableScore_write"))) TS_MultiThreadedLockableScore_write(uint64_t obj) {
42795         LDKMultiThreadedLockableScore obj_conv;
42796         obj_conv.inner = untag_ptr(obj);
42797         obj_conv.is_owned = ptr_is_owned(obj);
42798         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42799         obj_conv.is_owned = false;
42800         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
42801         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42802         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42803         CVec_u8Z_free(ret_var);
42804         return ret_arr;
42805 }
42806
42807 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_WriteableScore"))) TS_MultiThreadedLockableScore_as_WriteableScore(uint64_t this_arg) {
42808         LDKMultiThreadedLockableScore this_arg_conv;
42809         this_arg_conv.inner = untag_ptr(this_arg);
42810         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42812         this_arg_conv.is_owned = false;
42813         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
42814         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
42815         return tag_ptr(ret_ret, true);
42816 }
42817
42818 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint64_t score) {
42819         void* score_ptr = untag_ptr(score);
42820         CHECK_ACCESS(score_ptr);
42821         LDKScore score_conv = *(LDKScore*)(score_ptr);
42822         if (score_conv.free == LDKScore_JCalls_free) {
42823                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42824                 LDKScore_JCalls_cloned(&score_conv);
42825         }
42826         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
42827         uint64_t ret_ref = 0;
42828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42830         return ret_ref;
42831 }
42832
42833 void  __attribute__((export_name("TS_ChannelUsage_free"))) TS_ChannelUsage_free(uint64_t this_obj) {
42834         LDKChannelUsage this_obj_conv;
42835         this_obj_conv.inner = untag_ptr(this_obj);
42836         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42838         ChannelUsage_free(this_obj_conv);
42839 }
42840
42841 int64_t  __attribute__((export_name("TS_ChannelUsage_get_amount_msat"))) TS_ChannelUsage_get_amount_msat(uint64_t this_ptr) {
42842         LDKChannelUsage this_ptr_conv;
42843         this_ptr_conv.inner = untag_ptr(this_ptr);
42844         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42846         this_ptr_conv.is_owned = false;
42847         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
42848         return ret_conv;
42849 }
42850
42851 void  __attribute__((export_name("TS_ChannelUsage_set_amount_msat"))) TS_ChannelUsage_set_amount_msat(uint64_t this_ptr, int64_t val) {
42852         LDKChannelUsage this_ptr_conv;
42853         this_ptr_conv.inner = untag_ptr(this_ptr);
42854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42856         this_ptr_conv.is_owned = false;
42857         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
42858 }
42859
42860 int64_t  __attribute__((export_name("TS_ChannelUsage_get_inflight_htlc_msat"))) TS_ChannelUsage_get_inflight_htlc_msat(uint64_t this_ptr) {
42861         LDKChannelUsage this_ptr_conv;
42862         this_ptr_conv.inner = untag_ptr(this_ptr);
42863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42865         this_ptr_conv.is_owned = false;
42866         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
42867         return ret_conv;
42868 }
42869
42870 void  __attribute__((export_name("TS_ChannelUsage_set_inflight_htlc_msat"))) TS_ChannelUsage_set_inflight_htlc_msat(uint64_t this_ptr, int64_t val) {
42871         LDKChannelUsage this_ptr_conv;
42872         this_ptr_conv.inner = untag_ptr(this_ptr);
42873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42875         this_ptr_conv.is_owned = false;
42876         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
42877 }
42878
42879 uint64_t  __attribute__((export_name("TS_ChannelUsage_get_effective_capacity"))) TS_ChannelUsage_get_effective_capacity(uint64_t this_ptr) {
42880         LDKChannelUsage this_ptr_conv;
42881         this_ptr_conv.inner = untag_ptr(this_ptr);
42882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42884         this_ptr_conv.is_owned = false;
42885         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
42886         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
42887         uint64_t ret_ref = tag_ptr(ret_copy, true);
42888         return ret_ref;
42889 }
42890
42891 void  __attribute__((export_name("TS_ChannelUsage_set_effective_capacity"))) TS_ChannelUsage_set_effective_capacity(uint64_t this_ptr, uint64_t val) {
42892         LDKChannelUsage this_ptr_conv;
42893         this_ptr_conv.inner = untag_ptr(this_ptr);
42894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42896         this_ptr_conv.is_owned = false;
42897         void* val_ptr = untag_ptr(val);
42898         CHECK_ACCESS(val_ptr);
42899         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
42900         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
42901         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
42902 }
42903
42904 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) {
42905         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
42906         CHECK_ACCESS(effective_capacity_arg_ptr);
42907         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
42908         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
42909         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
42910         uint64_t ret_ref = 0;
42911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42913         return ret_ref;
42914 }
42915
42916 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
42917         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
42918         uint64_t ret_ref = 0;
42919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42921         return ret_ref;
42922 }
42923 int64_t  __attribute__((export_name("TS_ChannelUsage_clone_ptr"))) TS_ChannelUsage_clone_ptr(uint64_t arg) {
42924         LDKChannelUsage arg_conv;
42925         arg_conv.inner = untag_ptr(arg);
42926         arg_conv.is_owned = ptr_is_owned(arg);
42927         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42928         arg_conv.is_owned = false;
42929         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
42930         return ret_conv;
42931 }
42932
42933 uint64_t  __attribute__((export_name("TS_ChannelUsage_clone"))) TS_ChannelUsage_clone(uint64_t orig) {
42934         LDKChannelUsage orig_conv;
42935         orig_conv.inner = untag_ptr(orig);
42936         orig_conv.is_owned = ptr_is_owned(orig);
42937         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42938         orig_conv.is_owned = false;
42939         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
42940         uint64_t ret_ref = 0;
42941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42943         return ret_ref;
42944 }
42945
42946 void  __attribute__((export_name("TS_FixedPenaltyScorer_free"))) TS_FixedPenaltyScorer_free(uint64_t this_obj) {
42947         LDKFixedPenaltyScorer this_obj_conv;
42948         this_obj_conv.inner = untag_ptr(this_obj);
42949         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42951         FixedPenaltyScorer_free(this_obj_conv);
42952 }
42953
42954 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
42955         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
42956         uint64_t ret_ref = 0;
42957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42959         return ret_ref;
42960 }
42961 int64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone_ptr"))) TS_FixedPenaltyScorer_clone_ptr(uint64_t arg) {
42962         LDKFixedPenaltyScorer arg_conv;
42963         arg_conv.inner = untag_ptr(arg);
42964         arg_conv.is_owned = ptr_is_owned(arg);
42965         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42966         arg_conv.is_owned = false;
42967         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
42968         return ret_conv;
42969 }
42970
42971 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone"))) TS_FixedPenaltyScorer_clone(uint64_t orig) {
42972         LDKFixedPenaltyScorer orig_conv;
42973         orig_conv.inner = untag_ptr(orig);
42974         orig_conv.is_owned = ptr_is_owned(orig);
42975         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42976         orig_conv.is_owned = false;
42977         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
42978         uint64_t ret_ref = 0;
42979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42981         return ret_ref;
42982 }
42983
42984 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_with_penalty"))) TS_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
42985         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
42986         uint64_t ret_ref = 0;
42987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42989         return ret_ref;
42990 }
42991
42992 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_Score"))) TS_FixedPenaltyScorer_as_Score(uint64_t this_arg) {
42993         LDKFixedPenaltyScorer this_arg_conv;
42994         this_arg_conv.inner = untag_ptr(this_arg);
42995         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42997         this_arg_conv.is_owned = false;
42998         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
42999         *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
43000         return tag_ptr(ret_ret, true);
43001 }
43002
43003 int8_tArray  __attribute__((export_name("TS_FixedPenaltyScorer_write"))) TS_FixedPenaltyScorer_write(uint64_t obj) {
43004         LDKFixedPenaltyScorer obj_conv;
43005         obj_conv.inner = untag_ptr(obj);
43006         obj_conv.is_owned = ptr_is_owned(obj);
43007         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43008         obj_conv.is_owned = false;
43009         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
43010         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43011         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43012         CVec_u8Z_free(ret_var);
43013         return ret_arr;
43014 }
43015
43016 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_read"))) TS_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
43017         LDKu8slice ser_ref;
43018         ser_ref.datalen = ser->arr_len;
43019         ser_ref.data = ser->elems;
43020         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
43021         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
43022         FREE(ser);
43023         return tag_ptr(ret_conv, true);
43024 }
43025
43026 void  __attribute__((export_name("TS_ProbabilisticScorer_free"))) TS_ProbabilisticScorer_free(uint64_t this_obj) {
43027         LDKProbabilisticScorer this_obj_conv;
43028         this_obj_conv.inner = untag_ptr(this_obj);
43029         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43031         ProbabilisticScorer_free(this_obj_conv);
43032 }
43033
43034 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_free"))) TS_ProbabilisticScoringParameters_free(uint64_t this_obj) {
43035         LDKProbabilisticScoringParameters this_obj_conv;
43036         this_obj_conv.inner = untag_ptr(this_obj);
43037         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43039         ProbabilisticScoringParameters_free(this_obj_conv);
43040 }
43041
43042 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_base_penalty_msat"))) TS_ProbabilisticScoringParameters_get_base_penalty_msat(uint64_t this_ptr) {
43043         LDKProbabilisticScoringParameters this_ptr_conv;
43044         this_ptr_conv.inner = untag_ptr(this_ptr);
43045         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43047         this_ptr_conv.is_owned = false;
43048         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_msat(&this_ptr_conv);
43049         return ret_conv;
43050 }
43051
43052 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_set_base_penalty_msat"))) TS_ProbabilisticScoringParameters_set_base_penalty_msat(uint64_t this_ptr, int64_t val) {
43053         LDKProbabilisticScoringParameters this_ptr_conv;
43054         this_ptr_conv.inner = untag_ptr(this_ptr);
43055         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43057         this_ptr_conv.is_owned = false;
43058         ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
43059 }
43060
43061 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) {
43062         LDKProbabilisticScoringParameters this_ptr_conv;
43063         this_ptr_conv.inner = untag_ptr(this_ptr);
43064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43066         this_ptr_conv.is_owned = false;
43067         int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
43068         return ret_conv;
43069 }
43070
43071 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) {
43072         LDKProbabilisticScoringParameters this_ptr_conv;
43073         this_ptr_conv.inner = untag_ptr(this_ptr);
43074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43076         this_ptr_conv.is_owned = false;
43077         ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
43078 }
43079
43080 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(uint64_t this_ptr) {
43081         LDKProbabilisticScoringParameters this_ptr_conv;
43082         this_ptr_conv.inner = untag_ptr(this_ptr);
43083         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43085         this_ptr_conv.is_owned = false;
43086         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
43087         return ret_conv;
43088 }
43089
43090 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) {
43091         LDKProbabilisticScoringParameters this_ptr_conv;
43092         this_ptr_conv.inner = untag_ptr(this_ptr);
43093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43095         this_ptr_conv.is_owned = false;
43096         ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
43097 }
43098
43099 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life"))) TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life(uint64_t this_ptr) {
43100         LDKProbabilisticScoringParameters this_ptr_conv;
43101         this_ptr_conv.inner = untag_ptr(this_ptr);
43102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43104         this_ptr_conv.is_owned = false;
43105         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
43106         return ret_conv;
43107 }
43108
43109 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) {
43110         LDKProbabilisticScoringParameters this_ptr_conv;
43111         this_ptr_conv.inner = untag_ptr(this_ptr);
43112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43114         this_ptr_conv.is_owned = false;
43115         ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
43116 }
43117
43118 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) {
43119         LDKProbabilisticScoringParameters this_ptr_conv;
43120         this_ptr_conv.inner = untag_ptr(this_ptr);
43121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43123         this_ptr_conv.is_owned = false;
43124         int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
43125         return ret_conv;
43126 }
43127
43128 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) {
43129         LDKProbabilisticScoringParameters this_ptr_conv;
43130         this_ptr_conv.inner = untag_ptr(this_ptr);
43131         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43133         this_ptr_conv.is_owned = false;
43134         ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
43135 }
43136
43137 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_anti_probing_penalty_msat"))) TS_ProbabilisticScoringParameters_get_anti_probing_penalty_msat(uint64_t this_ptr) {
43138         LDKProbabilisticScoringParameters this_ptr_conv;
43139         this_ptr_conv.inner = untag_ptr(this_ptr);
43140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43142         this_ptr_conv.is_owned = false;
43143         int64_t ret_conv = ProbabilisticScoringParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
43144         return ret_conv;
43145 }
43146
43147 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) {
43148         LDKProbabilisticScoringParameters this_ptr_conv;
43149         this_ptr_conv.inner = untag_ptr(this_ptr);
43150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43152         this_ptr_conv.is_owned = false;
43153         ProbabilisticScoringParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
43154 }
43155
43156 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_get_considered_impossible_penalty_msat"))) TS_ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(uint64_t this_ptr) {
43157         LDKProbabilisticScoringParameters this_ptr_conv;
43158         this_ptr_conv.inner = untag_ptr(this_ptr);
43159         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43161         this_ptr_conv.is_owned = false;
43162         int64_t ret_conv = ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
43163         return ret_conv;
43164 }
43165
43166 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) {
43167         LDKProbabilisticScoringParameters this_ptr_conv;
43168         this_ptr_conv.inner = untag_ptr(this_ptr);
43169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43171         this_ptr_conv.is_owned = false;
43172         ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
43173 }
43174
43175 static inline uint64_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
43176         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
43177         uint64_t ret_ref = 0;
43178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43180         return ret_ref;
43181 }
43182 int64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_clone_ptr"))) TS_ProbabilisticScoringParameters_clone_ptr(uint64_t arg) {
43183         LDKProbabilisticScoringParameters arg_conv;
43184         arg_conv.inner = untag_ptr(arg);
43185         arg_conv.is_owned = ptr_is_owned(arg);
43186         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43187         arg_conv.is_owned = false;
43188         int64_t ret_conv = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
43189         return ret_conv;
43190 }
43191
43192 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_clone"))) TS_ProbabilisticScoringParameters_clone(uint64_t orig) {
43193         LDKProbabilisticScoringParameters orig_conv;
43194         orig_conv.inner = untag_ptr(orig);
43195         orig_conv.is_owned = ptr_is_owned(orig);
43196         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43197         orig_conv.is_owned = false;
43198         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
43199         uint64_t ret_ref = 0;
43200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43202         return ret_ref;
43203 }
43204
43205 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_new"))) TS_ProbabilisticScorer_new(uint64_t params, uint64_t network_graph, uint64_t logger) {
43206         LDKProbabilisticScoringParameters params_conv;
43207         params_conv.inner = untag_ptr(params);
43208         params_conv.is_owned = ptr_is_owned(params);
43209         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
43210         params_conv = ProbabilisticScoringParameters_clone(&params_conv);
43211         LDKNetworkGraph network_graph_conv;
43212         network_graph_conv.inner = untag_ptr(network_graph);
43213         network_graph_conv.is_owned = ptr_is_owned(network_graph);
43214         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
43215         network_graph_conv.is_owned = false;
43216         void* logger_ptr = untag_ptr(logger);
43217         CHECK_ACCESS(logger_ptr);
43218         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43219         if (logger_conv.free == LDKLogger_JCalls_free) {
43220                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43221                 LDKLogger_JCalls_cloned(&logger_conv);
43222         }
43223         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv, logger_conv);
43224         uint64_t ret_ref = 0;
43225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43227         return ret_ref;
43228 }
43229
43230 void  __attribute__((export_name("TS_ProbabilisticScorer_debug_log_liquidity_stats"))) TS_ProbabilisticScorer_debug_log_liquidity_stats(uint64_t this_arg) {
43231         LDKProbabilisticScorer this_arg_conv;
43232         this_arg_conv.inner = untag_ptr(this_arg);
43233         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43235         this_arg_conv.is_owned = false;
43236         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
43237 }
43238
43239 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) {
43240         LDKProbabilisticScorer this_arg_conv;
43241         this_arg_conv.inner = untag_ptr(this_arg);
43242         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43244         this_arg_conv.is_owned = false;
43245         LDKNodeId target_conv;
43246         target_conv.inner = untag_ptr(target);
43247         target_conv.is_owned = ptr_is_owned(target);
43248         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
43249         target_conv.is_owned = false;
43250         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
43251         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
43252         uint64_t ret_ref = tag_ptr(ret_copy, true);
43253         return ret_ref;
43254 }
43255
43256 void  __attribute__((export_name("TS_ProbabilisticScorer_add_banned"))) TS_ProbabilisticScorer_add_banned(uint64_t this_arg, uint64_t node_id) {
43257         LDKProbabilisticScorer this_arg_conv;
43258         this_arg_conv.inner = untag_ptr(this_arg);
43259         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43261         this_arg_conv.is_owned = false;
43262         LDKNodeId node_id_conv;
43263         node_id_conv.inner = untag_ptr(node_id);
43264         node_id_conv.is_owned = ptr_is_owned(node_id);
43265         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
43266         node_id_conv.is_owned = false;
43267         ProbabilisticScorer_add_banned(&this_arg_conv, &node_id_conv);
43268 }
43269
43270 void  __attribute__((export_name("TS_ProbabilisticScorer_remove_banned"))) TS_ProbabilisticScorer_remove_banned(uint64_t this_arg, uint64_t node_id) {
43271         LDKProbabilisticScorer this_arg_conv;
43272         this_arg_conv.inner = untag_ptr(this_arg);
43273         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43275         this_arg_conv.is_owned = false;
43276         LDKNodeId node_id_conv;
43277         node_id_conv.inner = untag_ptr(node_id);
43278         node_id_conv.is_owned = ptr_is_owned(node_id);
43279         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
43280         node_id_conv.is_owned = false;
43281         ProbabilisticScorer_remove_banned(&this_arg_conv, &node_id_conv);
43282 }
43283
43284 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) {
43285         LDKProbabilisticScorer this_arg_conv;
43286         this_arg_conv.inner = untag_ptr(this_arg);
43287         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43289         this_arg_conv.is_owned = false;
43290         LDKNodeId node_id_conv;
43291         node_id_conv.inner = untag_ptr(node_id);
43292         node_id_conv.is_owned = ptr_is_owned(node_id);
43293         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
43294         node_id_conv.is_owned = false;
43295         ProbabilisticScorer_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
43296 }
43297
43298 void  __attribute__((export_name("TS_ProbabilisticScorer_remove_manual_penalty"))) TS_ProbabilisticScorer_remove_manual_penalty(uint64_t this_arg, uint64_t node_id) {
43299         LDKProbabilisticScorer this_arg_conv;
43300         this_arg_conv.inner = untag_ptr(this_arg);
43301         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43303         this_arg_conv.is_owned = false;
43304         LDKNodeId node_id_conv;
43305         node_id_conv.inner = untag_ptr(node_id);
43306         node_id_conv.is_owned = ptr_is_owned(node_id);
43307         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
43308         node_id_conv.is_owned = false;
43309         ProbabilisticScorer_remove_manual_penalty(&this_arg_conv, &node_id_conv);
43310 }
43311
43312 void  __attribute__((export_name("TS_ProbabilisticScorer_clear_manual_penalties"))) TS_ProbabilisticScorer_clear_manual_penalties(uint64_t this_arg) {
43313         LDKProbabilisticScorer this_arg_conv;
43314         this_arg_conv.inner = untag_ptr(this_arg);
43315         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43317         this_arg_conv.is_owned = false;
43318         ProbabilisticScorer_clear_manual_penalties(&this_arg_conv);
43319 }
43320
43321 void  __attribute__((export_name("TS_ProbabilisticScoringParameters_add_banned_from_list"))) TS_ProbabilisticScoringParameters_add_banned_from_list(uint64_t this_arg, uint64_tArray node_ids) {
43322         LDKProbabilisticScoringParameters this_arg_conv;
43323         this_arg_conv.inner = untag_ptr(this_arg);
43324         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43326         this_arg_conv.is_owned = false;
43327         LDKCVec_NodeIdZ node_ids_constr;
43328         node_ids_constr.datalen = node_ids->arr_len;
43329         if (node_ids_constr.datalen > 0)
43330                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
43331         else
43332                 node_ids_constr.data = NULL;
43333         uint64_t* node_ids_vals = node_ids->elems;
43334         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
43335                 uint64_t node_ids_conv_8 = node_ids_vals[i];
43336                 LDKNodeId node_ids_conv_8_conv;
43337                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
43338                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
43339                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
43340                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
43341                 node_ids_constr.data[i] = node_ids_conv_8_conv;
43342         }
43343         FREE(node_ids);
43344         ProbabilisticScoringParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
43345 }
43346
43347 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringParameters_default"))) TS_ProbabilisticScoringParameters_default() {
43348         LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
43349         uint64_t ret_ref = 0;
43350         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43351         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43352         return ret_ref;
43353 }
43354
43355 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_Score"))) TS_ProbabilisticScorer_as_Score(uint64_t this_arg) {
43356         LDKProbabilisticScorer this_arg_conv;
43357         this_arg_conv.inner = untag_ptr(this_arg);
43358         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43360         this_arg_conv.is_owned = false;
43361         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
43362         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
43363         return tag_ptr(ret_ret, true);
43364 }
43365
43366 int8_tArray  __attribute__((export_name("TS_ProbabilisticScorer_write"))) TS_ProbabilisticScorer_write(uint64_t obj) {
43367         LDKProbabilisticScorer obj_conv;
43368         obj_conv.inner = untag_ptr(obj);
43369         obj_conv.is_owned = ptr_is_owned(obj);
43370         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43371         obj_conv.is_owned = false;
43372         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
43373         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43374         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43375         CVec_u8Z_free(ret_var);
43376         return ret_arr;
43377 }
43378
43379 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) {
43380         LDKu8slice ser_ref;
43381         ser_ref.datalen = ser->arr_len;
43382         ser_ref.data = ser->elems;
43383         LDKProbabilisticScoringParameters arg_a_conv;
43384         arg_a_conv.inner = untag_ptr(arg_a);
43385         arg_a_conv.is_owned = ptr_is_owned(arg_a);
43386         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
43387         arg_a_conv = ProbabilisticScoringParameters_clone(&arg_a_conv);
43388         LDKNetworkGraph arg_b_conv;
43389         arg_b_conv.inner = untag_ptr(arg_b);
43390         arg_b_conv.is_owned = ptr_is_owned(arg_b);
43391         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
43392         arg_b_conv.is_owned = false;
43393         void* arg_c_ptr = untag_ptr(arg_c);
43394         CHECK_ACCESS(arg_c_ptr);
43395         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
43396         if (arg_c_conv.free == LDKLogger_JCalls_free) {
43397                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43398                 LDKLogger_JCalls_cloned(&arg_c_conv);
43399         }
43400         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
43401         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
43402         FREE(ser);
43403         return tag_ptr(ret_conv, true);
43404 }
43405
43406 void  __attribute__((export_name("TS_BlindedRoute_free"))) TS_BlindedRoute_free(uint64_t this_obj) {
43407         LDKBlindedRoute this_obj_conv;
43408         this_obj_conv.inner = untag_ptr(this_obj);
43409         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43411         BlindedRoute_free(this_obj_conv);
43412 }
43413
43414 void  __attribute__((export_name("TS_BlindedHop_free"))) TS_BlindedHop_free(uint64_t this_obj) {
43415         LDKBlindedHop this_obj_conv;
43416         this_obj_conv.inner = untag_ptr(this_obj);
43417         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43419         BlindedHop_free(this_obj_conv);
43420 }
43421
43422 uint64_t  __attribute__((export_name("TS_BlindedRoute_new"))) TS_BlindedRoute_new(ptrArray node_pks, uint64_t keys_manager) {
43423         LDKCVec_PublicKeyZ node_pks_constr;
43424         node_pks_constr.datalen = node_pks->arr_len;
43425         if (node_pks_constr.datalen > 0)
43426                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
43427         else
43428                 node_pks_constr.data = NULL;
43429         int8_tArray* node_pks_vals = (void*) node_pks->elems;
43430         for (size_t m = 0; m < node_pks_constr.datalen; m++) {
43431                 int8_tArray node_pks_conv_12 = node_pks_vals[m];
43432                 LDKPublicKey node_pks_conv_12_ref;
43433                 CHECK(node_pks_conv_12->arr_len == 33);
43434                 memcpy(node_pks_conv_12_ref.compressed_form, node_pks_conv_12->elems, 33); FREE(node_pks_conv_12);
43435                 node_pks_constr.data[m] = node_pks_conv_12_ref;
43436         }
43437         FREE(node_pks);
43438         void* keys_manager_ptr = untag_ptr(keys_manager);
43439         if (ptr_is_owned(keys_manager)) { CHECK_ACCESS(keys_manager_ptr); }
43440         LDKKeysInterface* keys_manager_conv = (LDKKeysInterface*)keys_manager_ptr;
43441         LDKCResult_BlindedRouteNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteNoneZ), "LDKCResult_BlindedRouteNoneZ");
43442         *ret_conv = BlindedRoute_new(node_pks_constr, keys_manager_conv);
43443         return tag_ptr(ret_conv, true);
43444 }
43445
43446 int8_tArray  __attribute__((export_name("TS_BlindedRoute_write"))) TS_BlindedRoute_write(uint64_t obj) {
43447         LDKBlindedRoute obj_conv;
43448         obj_conv.inner = untag_ptr(obj);
43449         obj_conv.is_owned = ptr_is_owned(obj);
43450         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43451         obj_conv.is_owned = false;
43452         LDKCVec_u8Z ret_var = BlindedRoute_write(&obj_conv);
43453         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43454         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43455         CVec_u8Z_free(ret_var);
43456         return ret_arr;
43457 }
43458
43459 uint64_t  __attribute__((export_name("TS_BlindedRoute_read"))) TS_BlindedRoute_read(int8_tArray ser) {
43460         LDKu8slice ser_ref;
43461         ser_ref.datalen = ser->arr_len;
43462         ser_ref.data = ser->elems;
43463         LDKCResult_BlindedRouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteDecodeErrorZ), "LDKCResult_BlindedRouteDecodeErrorZ");
43464         *ret_conv = BlindedRoute_read(ser_ref);
43465         FREE(ser);
43466         return tag_ptr(ret_conv, true);
43467 }
43468
43469 int8_tArray  __attribute__((export_name("TS_BlindedHop_write"))) TS_BlindedHop_write(uint64_t obj) {
43470         LDKBlindedHop obj_conv;
43471         obj_conv.inner = untag_ptr(obj);
43472         obj_conv.is_owned = ptr_is_owned(obj);
43473         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43474         obj_conv.is_owned = false;
43475         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
43476         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43477         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43478         CVec_u8Z_free(ret_var);
43479         return ret_arr;
43480 }
43481
43482 uint64_t  __attribute__((export_name("TS_BlindedHop_read"))) TS_BlindedHop_read(int8_tArray ser) {
43483         LDKu8slice ser_ref;
43484         ser_ref.datalen = ser->arr_len;
43485         ser_ref.data = ser->elems;
43486         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
43487         *ret_conv = BlindedHop_read(ser_ref);
43488         FREE(ser);
43489         return tag_ptr(ret_conv, true);
43490 }
43491
43492 void  __attribute__((export_name("TS_OnionMessenger_free"))) TS_OnionMessenger_free(uint64_t this_obj) {
43493         LDKOnionMessenger this_obj_conv;
43494         this_obj_conv.inner = untag_ptr(this_obj);
43495         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43497         OnionMessenger_free(this_obj_conv);
43498 }
43499
43500 void  __attribute__((export_name("TS_Destination_free"))) TS_Destination_free(uint64_t this_ptr) {
43501         if (!ptr_is_owned(this_ptr)) return;
43502         void* this_ptr_ptr = untag_ptr(this_ptr);
43503         CHECK_ACCESS(this_ptr_ptr);
43504         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
43505         FREE(untag_ptr(this_ptr));
43506         Destination_free(this_ptr_conv);
43507 }
43508
43509 uint64_t  __attribute__((export_name("TS_Destination_node"))) TS_Destination_node(int8_tArray a) {
43510         LDKPublicKey a_ref;
43511         CHECK(a->arr_len == 33);
43512         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
43513         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
43514         *ret_copy = Destination_node(a_ref);
43515         uint64_t ret_ref = tag_ptr(ret_copy, true);
43516         return ret_ref;
43517 }
43518
43519 uint64_t  __attribute__((export_name("TS_Destination_blinded_route"))) TS_Destination_blinded_route(uint64_t a) {
43520         LDKBlindedRoute a_conv;
43521         a_conv.inner = untag_ptr(a);
43522         a_conv.is_owned = ptr_is_owned(a);
43523         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43524         // WARNING: we need a move here but no clone is available for LDKBlindedRoute
43525         
43526         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
43527         *ret_copy = Destination_blinded_route(a_conv);
43528         uint64_t ret_ref = tag_ptr(ret_copy, true);
43529         return ret_ref;
43530 }
43531
43532 void  __attribute__((export_name("TS_SendError_free"))) TS_SendError_free(uint64_t this_ptr) {
43533         if (!ptr_is_owned(this_ptr)) return;
43534         void* this_ptr_ptr = untag_ptr(this_ptr);
43535         CHECK_ACCESS(this_ptr_ptr);
43536         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
43537         FREE(untag_ptr(this_ptr));
43538         SendError_free(this_ptr_conv);
43539 }
43540
43541 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
43542         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
43543         *ret_copy = SendError_clone(arg);
43544         uint64_t ret_ref = tag_ptr(ret_copy, true);
43545         return ret_ref;
43546 }
43547 int64_t  __attribute__((export_name("TS_SendError_clone_ptr"))) TS_SendError_clone_ptr(uint64_t arg) {
43548         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
43549         int64_t ret_conv = SendError_clone_ptr(arg_conv);
43550         return ret_conv;
43551 }
43552
43553 uint64_t  __attribute__((export_name("TS_SendError_clone"))) TS_SendError_clone(uint64_t orig) {
43554         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
43555         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
43556         *ret_copy = SendError_clone(orig_conv);
43557         uint64_t ret_ref = tag_ptr(ret_copy, true);
43558         return ret_ref;
43559 }
43560
43561 uint64_t  __attribute__((export_name("TS_SendError_secp256k1"))) TS_SendError_secp256k1(uint32_t a) {
43562         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
43563         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
43564         *ret_copy = SendError_secp256k1(a_conv);
43565         uint64_t ret_ref = tag_ptr(ret_copy, true);
43566         return ret_ref;
43567 }
43568
43569 uint64_t  __attribute__((export_name("TS_SendError_too_big_packet"))) TS_SendError_too_big_packet() {
43570         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
43571         *ret_copy = SendError_too_big_packet();
43572         uint64_t ret_ref = tag_ptr(ret_copy, true);
43573         return ret_ref;
43574 }
43575
43576 uint64_t  __attribute__((export_name("TS_SendError_too_few_blinded_hops"))) TS_SendError_too_few_blinded_hops() {
43577         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
43578         *ret_copy = SendError_too_few_blinded_hops();
43579         uint64_t ret_ref = tag_ptr(ret_copy, true);
43580         return ret_ref;
43581 }
43582
43583 uint64_t  __attribute__((export_name("TS_SendError_invalid_first_hop"))) TS_SendError_invalid_first_hop() {
43584         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
43585         *ret_copy = SendError_invalid_first_hop();
43586         uint64_t ret_ref = tag_ptr(ret_copy, true);
43587         return ret_ref;
43588 }
43589
43590 uint64_t  __attribute__((export_name("TS_SendError_buffer_full"))) TS_SendError_buffer_full() {
43591         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
43592         *ret_copy = SendError_buffer_full();
43593         uint64_t ret_ref = tag_ptr(ret_copy, true);
43594         return ret_ref;
43595 }
43596
43597 uint64_t  __attribute__((export_name("TS_OnionMessenger_new"))) TS_OnionMessenger_new(uint64_t keys_manager, uint64_t logger) {
43598         void* keys_manager_ptr = untag_ptr(keys_manager);
43599         CHECK_ACCESS(keys_manager_ptr);
43600         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
43601         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
43602                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43603                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
43604         }
43605         void* logger_ptr = untag_ptr(logger);
43606         CHECK_ACCESS(logger_ptr);
43607         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
43608         if (logger_conv.free == LDKLogger_JCalls_free) {
43609                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
43610                 LDKLogger_JCalls_cloned(&logger_conv);
43611         }
43612         LDKOnionMessenger ret_var = OnionMessenger_new(keys_manager_conv, logger_conv);
43613         uint64_t ret_ref = 0;
43614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43616         return ret_ref;
43617 }
43618
43619 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 reply_path) {
43620         LDKOnionMessenger this_arg_conv;
43621         this_arg_conv.inner = untag_ptr(this_arg);
43622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43624         this_arg_conv.is_owned = false;
43625         LDKCVec_PublicKeyZ intermediate_nodes_constr;
43626         intermediate_nodes_constr.datalen = intermediate_nodes->arr_len;
43627         if (intermediate_nodes_constr.datalen > 0)
43628                 intermediate_nodes_constr.data = MALLOC(intermediate_nodes_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
43629         else
43630                 intermediate_nodes_constr.data = NULL;
43631         int8_tArray* intermediate_nodes_vals = (void*) intermediate_nodes->elems;
43632         for (size_t m = 0; m < intermediate_nodes_constr.datalen; m++) {
43633                 int8_tArray intermediate_nodes_conv_12 = intermediate_nodes_vals[m];
43634                 LDKPublicKey intermediate_nodes_conv_12_ref;
43635                 CHECK(intermediate_nodes_conv_12->arr_len == 33);
43636                 memcpy(intermediate_nodes_conv_12_ref.compressed_form, intermediate_nodes_conv_12->elems, 33); FREE(intermediate_nodes_conv_12);
43637                 intermediate_nodes_constr.data[m] = intermediate_nodes_conv_12_ref;
43638         }
43639         FREE(intermediate_nodes);
43640         void* destination_ptr = untag_ptr(destination);
43641         CHECK_ACCESS(destination_ptr);
43642         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
43643         // WARNING: we may need a move here but no clone is available for LDKDestination
43644         LDKBlindedRoute reply_path_conv;
43645         reply_path_conv.inner = untag_ptr(reply_path);
43646         reply_path_conv.is_owned = ptr_is_owned(reply_path);
43647         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
43648         reply_path_conv.is_owned = false;
43649         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
43650         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, intermediate_nodes_constr, destination_conv, reply_path_conv);
43651         return tag_ptr(ret_conv, true);
43652 }
43653
43654 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageHandler"))) TS_OnionMessenger_as_OnionMessageHandler(uint64_t this_arg) {
43655         LDKOnionMessenger 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         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
43661         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
43662         return tag_ptr(ret_ret, true);
43663 }
43664
43665 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageProvider"))) TS_OnionMessenger_as_OnionMessageProvider(uint64_t this_arg) {
43666         LDKOnionMessenger this_arg_conv;
43667         this_arg_conv.inner = untag_ptr(this_arg);
43668         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43670         this_arg_conv.is_owned = false;
43671         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
43672         *ret_ret = OnionMessenger_as_OnionMessageProvider(&this_arg_conv);
43673         return tag_ptr(ret_ret, true);
43674 }
43675
43676 void  __attribute__((export_name("TS_RapidGossipSync_free"))) TS_RapidGossipSync_free(uint64_t this_obj) {
43677         LDKRapidGossipSync this_obj_conv;
43678         this_obj_conv.inner = untag_ptr(this_obj);
43679         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43681         RapidGossipSync_free(this_obj_conv);
43682 }
43683
43684 uint64_t  __attribute__((export_name("TS_RapidGossipSync_new"))) TS_RapidGossipSync_new(uint64_t network_graph) {
43685         LDKNetworkGraph network_graph_conv;
43686         network_graph_conv.inner = untag_ptr(network_graph);
43687         network_graph_conv.is_owned = ptr_is_owned(network_graph);
43688         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
43689         network_graph_conv.is_owned = false;
43690         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv);
43691         uint64_t ret_ref = 0;
43692         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43693         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43694         return ret_ref;
43695 }
43696
43697 uint64_t  __attribute__((export_name("TS_RapidGossipSync_update_network_graph"))) TS_RapidGossipSync_update_network_graph(uint64_t this_arg, int8_tArray update_data) {
43698         LDKRapidGossipSync this_arg_conv;
43699         this_arg_conv.inner = untag_ptr(this_arg);
43700         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43702         this_arg_conv.is_owned = false;
43703         LDKu8slice update_data_ref;
43704         update_data_ref.datalen = update_data->arr_len;
43705         update_data_ref.data = update_data->elems;
43706         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
43707         *ret_conv = RapidGossipSync_update_network_graph(&this_arg_conv, update_data_ref);
43708         FREE(update_data);
43709         return tag_ptr(ret_conv, true);
43710 }
43711
43712 jboolean  __attribute__((export_name("TS_RapidGossipSync_is_initial_sync_complete"))) TS_RapidGossipSync_is_initial_sync_complete(uint64_t this_arg) {
43713         LDKRapidGossipSync this_arg_conv;
43714         this_arg_conv.inner = untag_ptr(this_arg);
43715         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43717         this_arg_conv.is_owned = false;
43718         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
43719         return ret_conv;
43720 }
43721
43722 void  __attribute__((export_name("TS_GraphSyncError_free"))) TS_GraphSyncError_free(uint64_t this_ptr) {
43723         if (!ptr_is_owned(this_ptr)) return;
43724         void* this_ptr_ptr = untag_ptr(this_ptr);
43725         CHECK_ACCESS(this_ptr_ptr);
43726         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
43727         FREE(untag_ptr(this_ptr));
43728         GraphSyncError_free(this_ptr_conv);
43729 }
43730
43731 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
43732         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
43733         *ret_copy = GraphSyncError_clone(arg);
43734         uint64_t ret_ref = tag_ptr(ret_copy, true);
43735         return ret_ref;
43736 }
43737 int64_t  __attribute__((export_name("TS_GraphSyncError_clone_ptr"))) TS_GraphSyncError_clone_ptr(uint64_t arg) {
43738         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
43739         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
43740         return ret_conv;
43741 }
43742
43743 uint64_t  __attribute__((export_name("TS_GraphSyncError_clone"))) TS_GraphSyncError_clone(uint64_t orig) {
43744         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
43745         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
43746         *ret_copy = GraphSyncError_clone(orig_conv);
43747         uint64_t ret_ref = tag_ptr(ret_copy, true);
43748         return ret_ref;
43749 }
43750
43751 uint64_t  __attribute__((export_name("TS_GraphSyncError_decode_error"))) TS_GraphSyncError_decode_error(uint64_t a) {
43752         LDKDecodeError a_conv;
43753         a_conv.inner = untag_ptr(a);
43754         a_conv.is_owned = ptr_is_owned(a);
43755         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43756         a_conv = DecodeError_clone(&a_conv);
43757         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
43758         *ret_copy = GraphSyncError_decode_error(a_conv);
43759         uint64_t ret_ref = tag_ptr(ret_copy, true);
43760         return ret_ref;
43761 }
43762
43763 uint64_t  __attribute__((export_name("TS_GraphSyncError_lightning_error"))) TS_GraphSyncError_lightning_error(uint64_t a) {
43764         LDKLightningError a_conv;
43765         a_conv.inner = untag_ptr(a);
43766         a_conv.is_owned = ptr_is_owned(a);
43767         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43768         a_conv = LightningError_clone(&a_conv);
43769         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
43770         *ret_copy = GraphSyncError_lightning_error(a_conv);
43771         uint64_t ret_ref = tag_ptr(ret_copy, true);
43772         return ret_ref;
43773 }
43774
43775 void  __attribute__((export_name("TS_ParseError_free"))) TS_ParseError_free(uint64_t this_ptr) {
43776         if (!ptr_is_owned(this_ptr)) return;
43777         void* this_ptr_ptr = untag_ptr(this_ptr);
43778         CHECK_ACCESS(this_ptr_ptr);
43779         LDKParseError this_ptr_conv = *(LDKParseError*)(this_ptr_ptr);
43780         FREE(untag_ptr(this_ptr));
43781         ParseError_free(this_ptr_conv);
43782 }
43783
43784 static inline uint64_t ParseError_clone_ptr(LDKParseError *NONNULL_PTR arg) {
43785         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43786         *ret_copy = ParseError_clone(arg);
43787         uint64_t ret_ref = tag_ptr(ret_copy, true);
43788         return ret_ref;
43789 }
43790 int64_t  __attribute__((export_name("TS_ParseError_clone_ptr"))) TS_ParseError_clone_ptr(uint64_t arg) {
43791         LDKParseError* arg_conv = (LDKParseError*)untag_ptr(arg);
43792         int64_t ret_conv = ParseError_clone_ptr(arg_conv);
43793         return ret_conv;
43794 }
43795
43796 uint64_t  __attribute__((export_name("TS_ParseError_clone"))) TS_ParseError_clone(uint64_t orig) {
43797         LDKParseError* orig_conv = (LDKParseError*)untag_ptr(orig);
43798         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43799         *ret_copy = ParseError_clone(orig_conv);
43800         uint64_t ret_ref = tag_ptr(ret_copy, true);
43801         return ret_ref;
43802 }
43803
43804 uint64_t  __attribute__((export_name("TS_ParseError_bech32_error"))) TS_ParseError_bech32_error(uint64_t a) {
43805         void* a_ptr = untag_ptr(a);
43806         CHECK_ACCESS(a_ptr);
43807         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
43808         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
43809         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43810         *ret_copy = ParseError_bech32_error(a_conv);
43811         uint64_t ret_ref = tag_ptr(ret_copy, true);
43812         return ret_ref;
43813 }
43814
43815 uint64_t  __attribute__((export_name("TS_ParseError_parse_amount_error"))) TS_ParseError_parse_amount_error(int32_t a) {
43816         
43817         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43818         *ret_copy = ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
43819         uint64_t ret_ref = tag_ptr(ret_copy, true);
43820         return ret_ref;
43821 }
43822
43823 uint64_t  __attribute__((export_name("TS_ParseError_malformed_signature"))) TS_ParseError_malformed_signature(uint32_t a) {
43824         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
43825         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43826         *ret_copy = ParseError_malformed_signature(a_conv);
43827         uint64_t ret_ref = tag_ptr(ret_copy, true);
43828         return ret_ref;
43829 }
43830
43831 uint64_t  __attribute__((export_name("TS_ParseError_bad_prefix"))) TS_ParseError_bad_prefix() {
43832         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43833         *ret_copy = ParseError_bad_prefix();
43834         uint64_t ret_ref = tag_ptr(ret_copy, true);
43835         return ret_ref;
43836 }
43837
43838 uint64_t  __attribute__((export_name("TS_ParseError_unknown_currency"))) TS_ParseError_unknown_currency() {
43839         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43840         *ret_copy = ParseError_unknown_currency();
43841         uint64_t ret_ref = tag_ptr(ret_copy, true);
43842         return ret_ref;
43843 }
43844
43845 uint64_t  __attribute__((export_name("TS_ParseError_unknown_si_prefix"))) TS_ParseError_unknown_si_prefix() {
43846         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43847         *ret_copy = ParseError_unknown_si_prefix();
43848         uint64_t ret_ref = tag_ptr(ret_copy, true);
43849         return ret_ref;
43850 }
43851
43852 uint64_t  __attribute__((export_name("TS_ParseError_malformed_hrp"))) TS_ParseError_malformed_hrp() {
43853         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43854         *ret_copy = ParseError_malformed_hrp();
43855         uint64_t ret_ref = tag_ptr(ret_copy, true);
43856         return ret_ref;
43857 }
43858
43859 uint64_t  __attribute__((export_name("TS_ParseError_too_short_data_part"))) TS_ParseError_too_short_data_part() {
43860         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43861         *ret_copy = ParseError_too_short_data_part();
43862         uint64_t ret_ref = tag_ptr(ret_copy, true);
43863         return ret_ref;
43864 }
43865
43866 uint64_t  __attribute__((export_name("TS_ParseError_unexpected_end_of_tagged_fields"))) TS_ParseError_unexpected_end_of_tagged_fields() {
43867         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43868         *ret_copy = ParseError_unexpected_end_of_tagged_fields();
43869         uint64_t ret_ref = tag_ptr(ret_copy, true);
43870         return ret_ref;
43871 }
43872
43873 uint64_t  __attribute__((export_name("TS_ParseError_description_decode_error"))) TS_ParseError_description_decode_error(int32_t a) {
43874         
43875         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43876         *ret_copy = ParseError_description_decode_error((LDKError){ ._dummy = 0 });
43877         uint64_t ret_ref = tag_ptr(ret_copy, true);
43878         return ret_ref;
43879 }
43880
43881 uint64_t  __attribute__((export_name("TS_ParseError_padding_error"))) TS_ParseError_padding_error() {
43882         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43883         *ret_copy = ParseError_padding_error();
43884         uint64_t ret_ref = tag_ptr(ret_copy, true);
43885         return ret_ref;
43886 }
43887
43888 uint64_t  __attribute__((export_name("TS_ParseError_integer_overflow_error"))) TS_ParseError_integer_overflow_error() {
43889         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43890         *ret_copy = ParseError_integer_overflow_error();
43891         uint64_t ret_ref = tag_ptr(ret_copy, true);
43892         return ret_ref;
43893 }
43894
43895 uint64_t  __attribute__((export_name("TS_ParseError_invalid_seg_wit_program_length"))) TS_ParseError_invalid_seg_wit_program_length() {
43896         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43897         *ret_copy = ParseError_invalid_seg_wit_program_length();
43898         uint64_t ret_ref = tag_ptr(ret_copy, true);
43899         return ret_ref;
43900 }
43901
43902 uint64_t  __attribute__((export_name("TS_ParseError_invalid_pub_key_hash_length"))) TS_ParseError_invalid_pub_key_hash_length() {
43903         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43904         *ret_copy = ParseError_invalid_pub_key_hash_length();
43905         uint64_t ret_ref = tag_ptr(ret_copy, true);
43906         return ret_ref;
43907 }
43908
43909 uint64_t  __attribute__((export_name("TS_ParseError_invalid_script_hash_length"))) TS_ParseError_invalid_script_hash_length() {
43910         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43911         *ret_copy = ParseError_invalid_script_hash_length();
43912         uint64_t ret_ref = tag_ptr(ret_copy, true);
43913         return ret_ref;
43914 }
43915
43916 uint64_t  __attribute__((export_name("TS_ParseError_invalid_recovery_id"))) TS_ParseError_invalid_recovery_id() {
43917         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43918         *ret_copy = ParseError_invalid_recovery_id();
43919         uint64_t ret_ref = tag_ptr(ret_copy, true);
43920         return ret_ref;
43921 }
43922
43923 uint64_t  __attribute__((export_name("TS_ParseError_invalid_slice_length"))) TS_ParseError_invalid_slice_length(jstring a) {
43924         LDKStr a_conv = str_ref_to_owned_c(a);
43925         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43926         *ret_copy = ParseError_invalid_slice_length(a_conv);
43927         uint64_t ret_ref = tag_ptr(ret_copy, true);
43928         return ret_ref;
43929 }
43930
43931 uint64_t  __attribute__((export_name("TS_ParseError_skip"))) TS_ParseError_skip() {
43932         LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError");
43933         *ret_copy = ParseError_skip();
43934         uint64_t ret_ref = tag_ptr(ret_copy, true);
43935         return ret_ref;
43936 }
43937
43938 void  __attribute__((export_name("TS_ParseOrSemanticError_free"))) TS_ParseOrSemanticError_free(uint64_t this_ptr) {
43939         if (!ptr_is_owned(this_ptr)) return;
43940         void* this_ptr_ptr = untag_ptr(this_ptr);
43941         CHECK_ACCESS(this_ptr_ptr);
43942         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
43943         FREE(untag_ptr(this_ptr));
43944         ParseOrSemanticError_free(this_ptr_conv);
43945 }
43946
43947 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
43948         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
43949         *ret_copy = ParseOrSemanticError_clone(arg);
43950         uint64_t ret_ref = tag_ptr(ret_copy, true);
43951         return ret_ref;
43952 }
43953 int64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone_ptr"))) TS_ParseOrSemanticError_clone_ptr(uint64_t arg) {
43954         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
43955         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
43956         return ret_conv;
43957 }
43958
43959 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone"))) TS_ParseOrSemanticError_clone(uint64_t orig) {
43960         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
43961         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
43962         *ret_copy = ParseOrSemanticError_clone(orig_conv);
43963         uint64_t ret_ref = tag_ptr(ret_copy, true);
43964         return ret_ref;
43965 }
43966
43967 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_parse_error"))) TS_ParseOrSemanticError_parse_error(uint64_t a) {
43968         void* a_ptr = untag_ptr(a);
43969         CHECK_ACCESS(a_ptr);
43970         LDKParseError a_conv = *(LDKParseError*)(a_ptr);
43971         a_conv = ParseError_clone((LDKParseError*)untag_ptr(a));
43972         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
43973         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
43974         uint64_t ret_ref = tag_ptr(ret_copy, true);
43975         return ret_ref;
43976 }
43977
43978 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_semantic_error"))) TS_ParseOrSemanticError_semantic_error(uint32_t a) {
43979         LDKSemanticError a_conv = LDKSemanticError_from_js(a);
43980         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
43981         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
43982         uint64_t ret_ref = tag_ptr(ret_copy, true);
43983         return ret_ref;
43984 }
43985
43986 void  __attribute__((export_name("TS_Invoice_free"))) TS_Invoice_free(uint64_t this_obj) {
43987         LDKInvoice this_obj_conv;
43988         this_obj_conv.inner = untag_ptr(this_obj);
43989         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43991         Invoice_free(this_obj_conv);
43992 }
43993
43994 jboolean  __attribute__((export_name("TS_Invoice_eq"))) TS_Invoice_eq(uint64_t a, uint64_t b) {
43995         LDKInvoice a_conv;
43996         a_conv.inner = untag_ptr(a);
43997         a_conv.is_owned = ptr_is_owned(a);
43998         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43999         a_conv.is_owned = false;
44000         LDKInvoice b_conv;
44001         b_conv.inner = untag_ptr(b);
44002         b_conv.is_owned = ptr_is_owned(b);
44003         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44004         b_conv.is_owned = false;
44005         jboolean ret_conv = Invoice_eq(&a_conv, &b_conv);
44006         return ret_conv;
44007 }
44008
44009 static inline uint64_t Invoice_clone_ptr(LDKInvoice *NONNULL_PTR arg) {
44010         LDKInvoice ret_var = Invoice_clone(arg);
44011         uint64_t ret_ref = 0;
44012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44014         return ret_ref;
44015 }
44016 int64_t  __attribute__((export_name("TS_Invoice_clone_ptr"))) TS_Invoice_clone_ptr(uint64_t arg) {
44017         LDKInvoice arg_conv;
44018         arg_conv.inner = untag_ptr(arg);
44019         arg_conv.is_owned = ptr_is_owned(arg);
44020         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44021         arg_conv.is_owned = false;
44022         int64_t ret_conv = Invoice_clone_ptr(&arg_conv);
44023         return ret_conv;
44024 }
44025
44026 uint64_t  __attribute__((export_name("TS_Invoice_clone"))) TS_Invoice_clone(uint64_t orig) {
44027         LDKInvoice orig_conv;
44028         orig_conv.inner = untag_ptr(orig);
44029         orig_conv.is_owned = ptr_is_owned(orig);
44030         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44031         orig_conv.is_owned = false;
44032         LDKInvoice ret_var = Invoice_clone(&orig_conv);
44033         uint64_t ret_ref = 0;
44034         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44035         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44036         return ret_ref;
44037 }
44038
44039 int64_t  __attribute__((export_name("TS_Invoice_hash"))) TS_Invoice_hash(uint64_t o) {
44040         LDKInvoice o_conv;
44041         o_conv.inner = untag_ptr(o);
44042         o_conv.is_owned = ptr_is_owned(o);
44043         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44044         o_conv.is_owned = false;
44045         int64_t ret_conv = Invoice_hash(&o_conv);
44046         return ret_conv;
44047 }
44048
44049 void  __attribute__((export_name("TS_SignedRawInvoice_free"))) TS_SignedRawInvoice_free(uint64_t this_obj) {
44050         LDKSignedRawInvoice this_obj_conv;
44051         this_obj_conv.inner = untag_ptr(this_obj);
44052         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44053         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44054         SignedRawInvoice_free(this_obj_conv);
44055 }
44056
44057 jboolean  __attribute__((export_name("TS_SignedRawInvoice_eq"))) TS_SignedRawInvoice_eq(uint64_t a, uint64_t b) {
44058         LDKSignedRawInvoice a_conv;
44059         a_conv.inner = untag_ptr(a);
44060         a_conv.is_owned = ptr_is_owned(a);
44061         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44062         a_conv.is_owned = false;
44063         LDKSignedRawInvoice b_conv;
44064         b_conv.inner = untag_ptr(b);
44065         b_conv.is_owned = ptr_is_owned(b);
44066         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44067         b_conv.is_owned = false;
44068         jboolean ret_conv = SignedRawInvoice_eq(&a_conv, &b_conv);
44069         return ret_conv;
44070 }
44071
44072 static inline uint64_t SignedRawInvoice_clone_ptr(LDKSignedRawInvoice *NONNULL_PTR arg) {
44073         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(arg);
44074         uint64_t ret_ref = 0;
44075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44077         return ret_ref;
44078 }
44079 int64_t  __attribute__((export_name("TS_SignedRawInvoice_clone_ptr"))) TS_SignedRawInvoice_clone_ptr(uint64_t arg) {
44080         LDKSignedRawInvoice arg_conv;
44081         arg_conv.inner = untag_ptr(arg);
44082         arg_conv.is_owned = ptr_is_owned(arg);
44083         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44084         arg_conv.is_owned = false;
44085         int64_t ret_conv = SignedRawInvoice_clone_ptr(&arg_conv);
44086         return ret_conv;
44087 }
44088
44089 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_clone"))) TS_SignedRawInvoice_clone(uint64_t orig) {
44090         LDKSignedRawInvoice orig_conv;
44091         orig_conv.inner = untag_ptr(orig);
44092         orig_conv.is_owned = ptr_is_owned(orig);
44093         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44094         orig_conv.is_owned = false;
44095         LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
44096         uint64_t ret_ref = 0;
44097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44099         return ret_ref;
44100 }
44101
44102 int64_t  __attribute__((export_name("TS_SignedRawInvoice_hash"))) TS_SignedRawInvoice_hash(uint64_t o) {
44103         LDKSignedRawInvoice o_conv;
44104         o_conv.inner = untag_ptr(o);
44105         o_conv.is_owned = ptr_is_owned(o);
44106         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44107         o_conv.is_owned = false;
44108         int64_t ret_conv = SignedRawInvoice_hash(&o_conv);
44109         return ret_conv;
44110 }
44111
44112 void  __attribute__((export_name("TS_RawInvoice_free"))) TS_RawInvoice_free(uint64_t this_obj) {
44113         LDKRawInvoice this_obj_conv;
44114         this_obj_conv.inner = untag_ptr(this_obj);
44115         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44117         RawInvoice_free(this_obj_conv);
44118 }
44119
44120 uint64_t  __attribute__((export_name("TS_RawInvoice_get_data"))) TS_RawInvoice_get_data(uint64_t this_ptr) {
44121         LDKRawInvoice this_ptr_conv;
44122         this_ptr_conv.inner = untag_ptr(this_ptr);
44123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44125         this_ptr_conv.is_owned = false;
44126         LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
44127         uint64_t ret_ref = 0;
44128         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44129         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44130         return ret_ref;
44131 }
44132
44133 void  __attribute__((export_name("TS_RawInvoice_set_data"))) TS_RawInvoice_set_data(uint64_t this_ptr, uint64_t val) {
44134         LDKRawInvoice this_ptr_conv;
44135         this_ptr_conv.inner = untag_ptr(this_ptr);
44136         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44138         this_ptr_conv.is_owned = false;
44139         LDKRawDataPart val_conv;
44140         val_conv.inner = untag_ptr(val);
44141         val_conv.is_owned = ptr_is_owned(val);
44142         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44143         val_conv = RawDataPart_clone(&val_conv);
44144         RawInvoice_set_data(&this_ptr_conv, val_conv);
44145 }
44146
44147 jboolean  __attribute__((export_name("TS_RawInvoice_eq"))) TS_RawInvoice_eq(uint64_t a, uint64_t b) {
44148         LDKRawInvoice a_conv;
44149         a_conv.inner = untag_ptr(a);
44150         a_conv.is_owned = ptr_is_owned(a);
44151         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44152         a_conv.is_owned = false;
44153         LDKRawInvoice b_conv;
44154         b_conv.inner = untag_ptr(b);
44155         b_conv.is_owned = ptr_is_owned(b);
44156         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44157         b_conv.is_owned = false;
44158         jboolean ret_conv = RawInvoice_eq(&a_conv, &b_conv);
44159         return ret_conv;
44160 }
44161
44162 static inline uint64_t RawInvoice_clone_ptr(LDKRawInvoice *NONNULL_PTR arg) {
44163         LDKRawInvoice ret_var = RawInvoice_clone(arg);
44164         uint64_t ret_ref = 0;
44165         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44166         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44167         return ret_ref;
44168 }
44169 int64_t  __attribute__((export_name("TS_RawInvoice_clone_ptr"))) TS_RawInvoice_clone_ptr(uint64_t arg) {
44170         LDKRawInvoice arg_conv;
44171         arg_conv.inner = untag_ptr(arg);
44172         arg_conv.is_owned = ptr_is_owned(arg);
44173         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44174         arg_conv.is_owned = false;
44175         int64_t ret_conv = RawInvoice_clone_ptr(&arg_conv);
44176         return ret_conv;
44177 }
44178
44179 uint64_t  __attribute__((export_name("TS_RawInvoice_clone"))) TS_RawInvoice_clone(uint64_t orig) {
44180         LDKRawInvoice orig_conv;
44181         orig_conv.inner = untag_ptr(orig);
44182         orig_conv.is_owned = ptr_is_owned(orig);
44183         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44184         orig_conv.is_owned = false;
44185         LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
44186         uint64_t ret_ref = 0;
44187         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44188         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44189         return ret_ref;
44190 }
44191
44192 int64_t  __attribute__((export_name("TS_RawInvoice_hash"))) TS_RawInvoice_hash(uint64_t o) {
44193         LDKRawInvoice o_conv;
44194         o_conv.inner = untag_ptr(o);
44195         o_conv.is_owned = ptr_is_owned(o);
44196         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44197         o_conv.is_owned = false;
44198         int64_t ret_conv = RawInvoice_hash(&o_conv);
44199         return ret_conv;
44200 }
44201
44202 void  __attribute__((export_name("TS_RawDataPart_free"))) TS_RawDataPart_free(uint64_t this_obj) {
44203         LDKRawDataPart this_obj_conv;
44204         this_obj_conv.inner = untag_ptr(this_obj);
44205         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44207         RawDataPart_free(this_obj_conv);
44208 }
44209
44210 uint64_t  __attribute__((export_name("TS_RawDataPart_get_timestamp"))) TS_RawDataPart_get_timestamp(uint64_t this_ptr) {
44211         LDKRawDataPart this_ptr_conv;
44212         this_ptr_conv.inner = untag_ptr(this_ptr);
44213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44215         this_ptr_conv.is_owned = false;
44216         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
44217         uint64_t ret_ref = 0;
44218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44220         return ret_ref;
44221 }
44222
44223 void  __attribute__((export_name("TS_RawDataPart_set_timestamp"))) TS_RawDataPart_set_timestamp(uint64_t this_ptr, uint64_t val) {
44224         LDKRawDataPart this_ptr_conv;
44225         this_ptr_conv.inner = untag_ptr(this_ptr);
44226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44228         this_ptr_conv.is_owned = false;
44229         LDKPositiveTimestamp val_conv;
44230         val_conv.inner = untag_ptr(val);
44231         val_conv.is_owned = ptr_is_owned(val);
44232         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44233         val_conv = PositiveTimestamp_clone(&val_conv);
44234         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
44235 }
44236
44237 jboolean  __attribute__((export_name("TS_RawDataPart_eq"))) TS_RawDataPart_eq(uint64_t a, uint64_t b) {
44238         LDKRawDataPart a_conv;
44239         a_conv.inner = untag_ptr(a);
44240         a_conv.is_owned = ptr_is_owned(a);
44241         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44242         a_conv.is_owned = false;
44243         LDKRawDataPart b_conv;
44244         b_conv.inner = untag_ptr(b);
44245         b_conv.is_owned = ptr_is_owned(b);
44246         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44247         b_conv.is_owned = false;
44248         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
44249         return ret_conv;
44250 }
44251
44252 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
44253         LDKRawDataPart ret_var = RawDataPart_clone(arg);
44254         uint64_t ret_ref = 0;
44255         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44256         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44257         return ret_ref;
44258 }
44259 int64_t  __attribute__((export_name("TS_RawDataPart_clone_ptr"))) TS_RawDataPart_clone_ptr(uint64_t arg) {
44260         LDKRawDataPart arg_conv;
44261         arg_conv.inner = untag_ptr(arg);
44262         arg_conv.is_owned = ptr_is_owned(arg);
44263         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44264         arg_conv.is_owned = false;
44265         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
44266         return ret_conv;
44267 }
44268
44269 uint64_t  __attribute__((export_name("TS_RawDataPart_clone"))) TS_RawDataPart_clone(uint64_t orig) {
44270         LDKRawDataPart orig_conv;
44271         orig_conv.inner = untag_ptr(orig);
44272         orig_conv.is_owned = ptr_is_owned(orig);
44273         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44274         orig_conv.is_owned = false;
44275         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
44276         uint64_t ret_ref = 0;
44277         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44278         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44279         return ret_ref;
44280 }
44281
44282 int64_t  __attribute__((export_name("TS_RawDataPart_hash"))) TS_RawDataPart_hash(uint64_t o) {
44283         LDKRawDataPart o_conv;
44284         o_conv.inner = untag_ptr(o);
44285         o_conv.is_owned = ptr_is_owned(o);
44286         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44287         o_conv.is_owned = false;
44288         int64_t ret_conv = RawDataPart_hash(&o_conv);
44289         return ret_conv;
44290 }
44291
44292 void  __attribute__((export_name("TS_PositiveTimestamp_free"))) TS_PositiveTimestamp_free(uint64_t this_obj) {
44293         LDKPositiveTimestamp this_obj_conv;
44294         this_obj_conv.inner = untag_ptr(this_obj);
44295         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44297         PositiveTimestamp_free(this_obj_conv);
44298 }
44299
44300 jboolean  __attribute__((export_name("TS_PositiveTimestamp_eq"))) TS_PositiveTimestamp_eq(uint64_t a, uint64_t b) {
44301         LDKPositiveTimestamp a_conv;
44302         a_conv.inner = untag_ptr(a);
44303         a_conv.is_owned = ptr_is_owned(a);
44304         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44305         a_conv.is_owned = false;
44306         LDKPositiveTimestamp b_conv;
44307         b_conv.inner = untag_ptr(b);
44308         b_conv.is_owned = ptr_is_owned(b);
44309         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44310         b_conv.is_owned = false;
44311         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
44312         return ret_conv;
44313 }
44314
44315 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
44316         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
44317         uint64_t ret_ref = 0;
44318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44320         return ret_ref;
44321 }
44322 int64_t  __attribute__((export_name("TS_PositiveTimestamp_clone_ptr"))) TS_PositiveTimestamp_clone_ptr(uint64_t arg) {
44323         LDKPositiveTimestamp arg_conv;
44324         arg_conv.inner = untag_ptr(arg);
44325         arg_conv.is_owned = ptr_is_owned(arg);
44326         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44327         arg_conv.is_owned = false;
44328         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
44329         return ret_conv;
44330 }
44331
44332 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_clone"))) TS_PositiveTimestamp_clone(uint64_t orig) {
44333         LDKPositiveTimestamp orig_conv;
44334         orig_conv.inner = untag_ptr(orig);
44335         orig_conv.is_owned = ptr_is_owned(orig);
44336         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44337         orig_conv.is_owned = false;
44338         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
44339         uint64_t ret_ref = 0;
44340         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44341         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44342         return ret_ref;
44343 }
44344
44345 int64_t  __attribute__((export_name("TS_PositiveTimestamp_hash"))) TS_PositiveTimestamp_hash(uint64_t o) {
44346         LDKPositiveTimestamp o_conv;
44347         o_conv.inner = untag_ptr(o);
44348         o_conv.is_owned = ptr_is_owned(o);
44349         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44350         o_conv.is_owned = false;
44351         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
44352         return ret_conv;
44353 }
44354
44355 uint32_t  __attribute__((export_name("TS_SiPrefix_clone"))) TS_SiPrefix_clone(uint64_t orig) {
44356         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
44357         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
44358         return ret_conv;
44359 }
44360
44361 uint32_t  __attribute__((export_name("TS_SiPrefix_milli"))) TS_SiPrefix_milli() {
44362         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
44363         return ret_conv;
44364 }
44365
44366 uint32_t  __attribute__((export_name("TS_SiPrefix_micro"))) TS_SiPrefix_micro() {
44367         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
44368         return ret_conv;
44369 }
44370
44371 uint32_t  __attribute__((export_name("TS_SiPrefix_nano"))) TS_SiPrefix_nano() {
44372         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
44373         return ret_conv;
44374 }
44375
44376 uint32_t  __attribute__((export_name("TS_SiPrefix_pico"))) TS_SiPrefix_pico() {
44377         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
44378         return ret_conv;
44379 }
44380
44381 jboolean  __attribute__((export_name("TS_SiPrefix_eq"))) TS_SiPrefix_eq(uint64_t a, uint64_t b) {
44382         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
44383         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
44384         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
44385         return ret_conv;
44386 }
44387
44388 int64_t  __attribute__((export_name("TS_SiPrefix_hash"))) TS_SiPrefix_hash(uint64_t o) {
44389         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
44390         int64_t ret_conv = SiPrefix_hash(o_conv);
44391         return ret_conv;
44392 }
44393
44394 int64_t  __attribute__((export_name("TS_SiPrefix_multiplier"))) TS_SiPrefix_multiplier(uint64_t this_arg) {
44395         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
44396         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
44397         return ret_conv;
44398 }
44399
44400 uint32_t  __attribute__((export_name("TS_Currency_clone"))) TS_Currency_clone(uint64_t orig) {
44401         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
44402         uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
44403         return ret_conv;
44404 }
44405
44406 uint32_t  __attribute__((export_name("TS_Currency_bitcoin"))) TS_Currency_bitcoin() {
44407         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
44408         return ret_conv;
44409 }
44410
44411 uint32_t  __attribute__((export_name("TS_Currency_bitcoin_testnet"))) TS_Currency_bitcoin_testnet() {
44412         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
44413         return ret_conv;
44414 }
44415
44416 uint32_t  __attribute__((export_name("TS_Currency_regtest"))) TS_Currency_regtest() {
44417         uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
44418         return ret_conv;
44419 }
44420
44421 uint32_t  __attribute__((export_name("TS_Currency_simnet"))) TS_Currency_simnet() {
44422         uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
44423         return ret_conv;
44424 }
44425
44426 uint32_t  __attribute__((export_name("TS_Currency_signet"))) TS_Currency_signet() {
44427         uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
44428         return ret_conv;
44429 }
44430
44431 int64_t  __attribute__((export_name("TS_Currency_hash"))) TS_Currency_hash(uint64_t o) {
44432         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
44433         int64_t ret_conv = Currency_hash(o_conv);
44434         return ret_conv;
44435 }
44436
44437 jboolean  __attribute__((export_name("TS_Currency_eq"))) TS_Currency_eq(uint64_t a, uint64_t b) {
44438         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
44439         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
44440         jboolean ret_conv = Currency_eq(a_conv, b_conv);
44441         return ret_conv;
44442 }
44443
44444 void  __attribute__((export_name("TS_Sha256_free"))) TS_Sha256_free(uint64_t this_obj) {
44445         LDKSha256 this_obj_conv;
44446         this_obj_conv.inner = untag_ptr(this_obj);
44447         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44449         Sha256_free(this_obj_conv);
44450 }
44451
44452 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
44453         LDKSha256 ret_var = Sha256_clone(arg);
44454         uint64_t ret_ref = 0;
44455         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44456         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44457         return ret_ref;
44458 }
44459 int64_t  __attribute__((export_name("TS_Sha256_clone_ptr"))) TS_Sha256_clone_ptr(uint64_t arg) {
44460         LDKSha256 arg_conv;
44461         arg_conv.inner = untag_ptr(arg);
44462         arg_conv.is_owned = ptr_is_owned(arg);
44463         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44464         arg_conv.is_owned = false;
44465         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
44466         return ret_conv;
44467 }
44468
44469 uint64_t  __attribute__((export_name("TS_Sha256_clone"))) TS_Sha256_clone(uint64_t orig) {
44470         LDKSha256 orig_conv;
44471         orig_conv.inner = untag_ptr(orig);
44472         orig_conv.is_owned = ptr_is_owned(orig);
44473         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44474         orig_conv.is_owned = false;
44475         LDKSha256 ret_var = Sha256_clone(&orig_conv);
44476         uint64_t ret_ref = 0;
44477         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44478         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44479         return ret_ref;
44480 }
44481
44482 int64_t  __attribute__((export_name("TS_Sha256_hash"))) TS_Sha256_hash(uint64_t o) {
44483         LDKSha256 o_conv;
44484         o_conv.inner = untag_ptr(o);
44485         o_conv.is_owned = ptr_is_owned(o);
44486         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44487         o_conv.is_owned = false;
44488         int64_t ret_conv = Sha256_hash(&o_conv);
44489         return ret_conv;
44490 }
44491
44492 jboolean  __attribute__((export_name("TS_Sha256_eq"))) TS_Sha256_eq(uint64_t a, uint64_t b) {
44493         LDKSha256 a_conv;
44494         a_conv.inner = untag_ptr(a);
44495         a_conv.is_owned = ptr_is_owned(a);
44496         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44497         a_conv.is_owned = false;
44498         LDKSha256 b_conv;
44499         b_conv.inner = untag_ptr(b);
44500         b_conv.is_owned = ptr_is_owned(b);
44501         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44502         b_conv.is_owned = false;
44503         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
44504         return ret_conv;
44505 }
44506
44507 void  __attribute__((export_name("TS_Description_free"))) TS_Description_free(uint64_t this_obj) {
44508         LDKDescription this_obj_conv;
44509         this_obj_conv.inner = untag_ptr(this_obj);
44510         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44512         Description_free(this_obj_conv);
44513 }
44514
44515 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
44516         LDKDescription ret_var = Description_clone(arg);
44517         uint64_t ret_ref = 0;
44518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44520         return ret_ref;
44521 }
44522 int64_t  __attribute__((export_name("TS_Description_clone_ptr"))) TS_Description_clone_ptr(uint64_t arg) {
44523         LDKDescription arg_conv;
44524         arg_conv.inner = untag_ptr(arg);
44525         arg_conv.is_owned = ptr_is_owned(arg);
44526         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44527         arg_conv.is_owned = false;
44528         int64_t ret_conv = Description_clone_ptr(&arg_conv);
44529         return ret_conv;
44530 }
44531
44532 uint64_t  __attribute__((export_name("TS_Description_clone"))) TS_Description_clone(uint64_t orig) {
44533         LDKDescription orig_conv;
44534         orig_conv.inner = untag_ptr(orig);
44535         orig_conv.is_owned = ptr_is_owned(orig);
44536         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44537         orig_conv.is_owned = false;
44538         LDKDescription ret_var = Description_clone(&orig_conv);
44539         uint64_t ret_ref = 0;
44540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44542         return ret_ref;
44543 }
44544
44545 int64_t  __attribute__((export_name("TS_Description_hash"))) TS_Description_hash(uint64_t o) {
44546         LDKDescription o_conv;
44547         o_conv.inner = untag_ptr(o);
44548         o_conv.is_owned = ptr_is_owned(o);
44549         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44550         o_conv.is_owned = false;
44551         int64_t ret_conv = Description_hash(&o_conv);
44552         return ret_conv;
44553 }
44554
44555 jboolean  __attribute__((export_name("TS_Description_eq"))) TS_Description_eq(uint64_t a, uint64_t b) {
44556         LDKDescription a_conv;
44557         a_conv.inner = untag_ptr(a);
44558         a_conv.is_owned = ptr_is_owned(a);
44559         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44560         a_conv.is_owned = false;
44561         LDKDescription b_conv;
44562         b_conv.inner = untag_ptr(b);
44563         b_conv.is_owned = ptr_is_owned(b);
44564         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44565         b_conv.is_owned = false;
44566         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
44567         return ret_conv;
44568 }
44569
44570 void  __attribute__((export_name("TS_PayeePubKey_free"))) TS_PayeePubKey_free(uint64_t this_obj) {
44571         LDKPayeePubKey this_obj_conv;
44572         this_obj_conv.inner = untag_ptr(this_obj);
44573         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44575         PayeePubKey_free(this_obj_conv);
44576 }
44577
44578 int8_tArray  __attribute__((export_name("TS_PayeePubKey_get_a"))) TS_PayeePubKey_get_a(uint64_t this_ptr) {
44579         LDKPayeePubKey this_ptr_conv;
44580         this_ptr_conv.inner = untag_ptr(this_ptr);
44581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44583         this_ptr_conv.is_owned = false;
44584         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44585         memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
44586         return ret_arr;
44587 }
44588
44589 void  __attribute__((export_name("TS_PayeePubKey_set_a"))) TS_PayeePubKey_set_a(uint64_t this_ptr, int8_tArray val) {
44590         LDKPayeePubKey this_ptr_conv;
44591         this_ptr_conv.inner = untag_ptr(this_ptr);
44592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44594         this_ptr_conv.is_owned = false;
44595         LDKPublicKey val_ref;
44596         CHECK(val->arr_len == 33);
44597         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44598         PayeePubKey_set_a(&this_ptr_conv, val_ref);
44599 }
44600
44601 uint64_t  __attribute__((export_name("TS_PayeePubKey_new"))) TS_PayeePubKey_new(int8_tArray a_arg) {
44602         LDKPublicKey a_arg_ref;
44603         CHECK(a_arg->arr_len == 33);
44604         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
44605         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
44606         uint64_t ret_ref = 0;
44607         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44608         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44609         return ret_ref;
44610 }
44611
44612 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
44613         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
44614         uint64_t ret_ref = 0;
44615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44617         return ret_ref;
44618 }
44619 int64_t  __attribute__((export_name("TS_PayeePubKey_clone_ptr"))) TS_PayeePubKey_clone_ptr(uint64_t arg) {
44620         LDKPayeePubKey arg_conv;
44621         arg_conv.inner = untag_ptr(arg);
44622         arg_conv.is_owned = ptr_is_owned(arg);
44623         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44624         arg_conv.is_owned = false;
44625         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
44626         return ret_conv;
44627 }
44628
44629 uint64_t  __attribute__((export_name("TS_PayeePubKey_clone"))) TS_PayeePubKey_clone(uint64_t orig) {
44630         LDKPayeePubKey orig_conv;
44631         orig_conv.inner = untag_ptr(orig);
44632         orig_conv.is_owned = ptr_is_owned(orig);
44633         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44634         orig_conv.is_owned = false;
44635         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
44636         uint64_t ret_ref = 0;
44637         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44638         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44639         return ret_ref;
44640 }
44641
44642 int64_t  __attribute__((export_name("TS_PayeePubKey_hash"))) TS_PayeePubKey_hash(uint64_t o) {
44643         LDKPayeePubKey o_conv;
44644         o_conv.inner = untag_ptr(o);
44645         o_conv.is_owned = ptr_is_owned(o);
44646         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44647         o_conv.is_owned = false;
44648         int64_t ret_conv = PayeePubKey_hash(&o_conv);
44649         return ret_conv;
44650 }
44651
44652 jboolean  __attribute__((export_name("TS_PayeePubKey_eq"))) TS_PayeePubKey_eq(uint64_t a, uint64_t b) {
44653         LDKPayeePubKey a_conv;
44654         a_conv.inner = untag_ptr(a);
44655         a_conv.is_owned = ptr_is_owned(a);
44656         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44657         a_conv.is_owned = false;
44658         LDKPayeePubKey b_conv;
44659         b_conv.inner = untag_ptr(b);
44660         b_conv.is_owned = ptr_is_owned(b);
44661         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44662         b_conv.is_owned = false;
44663         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
44664         return ret_conv;
44665 }
44666
44667 void  __attribute__((export_name("TS_ExpiryTime_free"))) TS_ExpiryTime_free(uint64_t this_obj) {
44668         LDKExpiryTime this_obj_conv;
44669         this_obj_conv.inner = untag_ptr(this_obj);
44670         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44672         ExpiryTime_free(this_obj_conv);
44673 }
44674
44675 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
44676         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
44677         uint64_t ret_ref = 0;
44678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44680         return ret_ref;
44681 }
44682 int64_t  __attribute__((export_name("TS_ExpiryTime_clone_ptr"))) TS_ExpiryTime_clone_ptr(uint64_t arg) {
44683         LDKExpiryTime arg_conv;
44684         arg_conv.inner = untag_ptr(arg);
44685         arg_conv.is_owned = ptr_is_owned(arg);
44686         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44687         arg_conv.is_owned = false;
44688         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
44689         return ret_conv;
44690 }
44691
44692 uint64_t  __attribute__((export_name("TS_ExpiryTime_clone"))) TS_ExpiryTime_clone(uint64_t orig) {
44693         LDKExpiryTime orig_conv;
44694         orig_conv.inner = untag_ptr(orig);
44695         orig_conv.is_owned = ptr_is_owned(orig);
44696         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44697         orig_conv.is_owned = false;
44698         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
44699         uint64_t ret_ref = 0;
44700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44702         return ret_ref;
44703 }
44704
44705 int64_t  __attribute__((export_name("TS_ExpiryTime_hash"))) TS_ExpiryTime_hash(uint64_t o) {
44706         LDKExpiryTime o_conv;
44707         o_conv.inner = untag_ptr(o);
44708         o_conv.is_owned = ptr_is_owned(o);
44709         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44710         o_conv.is_owned = false;
44711         int64_t ret_conv = ExpiryTime_hash(&o_conv);
44712         return ret_conv;
44713 }
44714
44715 jboolean  __attribute__((export_name("TS_ExpiryTime_eq"))) TS_ExpiryTime_eq(uint64_t a, uint64_t b) {
44716         LDKExpiryTime a_conv;
44717         a_conv.inner = untag_ptr(a);
44718         a_conv.is_owned = ptr_is_owned(a);
44719         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44720         a_conv.is_owned = false;
44721         LDKExpiryTime b_conv;
44722         b_conv.inner = untag_ptr(b);
44723         b_conv.is_owned = ptr_is_owned(b);
44724         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44725         b_conv.is_owned = false;
44726         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
44727         return ret_conv;
44728 }
44729
44730 void  __attribute__((export_name("TS_MinFinalCltvExpiry_free"))) TS_MinFinalCltvExpiry_free(uint64_t this_obj) {
44731         LDKMinFinalCltvExpiry this_obj_conv;
44732         this_obj_conv.inner = untag_ptr(this_obj);
44733         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44735         MinFinalCltvExpiry_free(this_obj_conv);
44736 }
44737
44738 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_get_a"))) TS_MinFinalCltvExpiry_get_a(uint64_t this_ptr) {
44739         LDKMinFinalCltvExpiry this_ptr_conv;
44740         this_ptr_conv.inner = untag_ptr(this_ptr);
44741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44743         this_ptr_conv.is_owned = false;
44744         int64_t ret_conv = MinFinalCltvExpiry_get_a(&this_ptr_conv);
44745         return ret_conv;
44746 }
44747
44748 void  __attribute__((export_name("TS_MinFinalCltvExpiry_set_a"))) TS_MinFinalCltvExpiry_set_a(uint64_t this_ptr, int64_t val) {
44749         LDKMinFinalCltvExpiry this_ptr_conv;
44750         this_ptr_conv.inner = untag_ptr(this_ptr);
44751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44753         this_ptr_conv.is_owned = false;
44754         MinFinalCltvExpiry_set_a(&this_ptr_conv, val);
44755 }
44756
44757 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_new"))) TS_MinFinalCltvExpiry_new(int64_t a_arg) {
44758         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg);
44759         uint64_t ret_ref = 0;
44760         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44761         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44762         return ret_ref;
44763 }
44764
44765 static inline uint64_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) {
44766         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(arg);
44767         uint64_t ret_ref = 0;
44768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44770         return ret_ref;
44771 }
44772 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_clone_ptr"))) TS_MinFinalCltvExpiry_clone_ptr(uint64_t arg) {
44773         LDKMinFinalCltvExpiry arg_conv;
44774         arg_conv.inner = untag_ptr(arg);
44775         arg_conv.is_owned = ptr_is_owned(arg);
44776         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44777         arg_conv.is_owned = false;
44778         int64_t ret_conv = MinFinalCltvExpiry_clone_ptr(&arg_conv);
44779         return ret_conv;
44780 }
44781
44782 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_clone"))) TS_MinFinalCltvExpiry_clone(uint64_t orig) {
44783         LDKMinFinalCltvExpiry orig_conv;
44784         orig_conv.inner = untag_ptr(orig);
44785         orig_conv.is_owned = ptr_is_owned(orig);
44786         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44787         orig_conv.is_owned = false;
44788         LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
44789         uint64_t ret_ref = 0;
44790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44792         return ret_ref;
44793 }
44794
44795 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiry_hash"))) TS_MinFinalCltvExpiry_hash(uint64_t o) {
44796         LDKMinFinalCltvExpiry o_conv;
44797         o_conv.inner = untag_ptr(o);
44798         o_conv.is_owned = ptr_is_owned(o);
44799         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44800         o_conv.is_owned = false;
44801         int64_t ret_conv = MinFinalCltvExpiry_hash(&o_conv);
44802         return ret_conv;
44803 }
44804
44805 jboolean  __attribute__((export_name("TS_MinFinalCltvExpiry_eq"))) TS_MinFinalCltvExpiry_eq(uint64_t a, uint64_t b) {
44806         LDKMinFinalCltvExpiry a_conv;
44807         a_conv.inner = untag_ptr(a);
44808         a_conv.is_owned = ptr_is_owned(a);
44809         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44810         a_conv.is_owned = false;
44811         LDKMinFinalCltvExpiry b_conv;
44812         b_conv.inner = untag_ptr(b);
44813         b_conv.is_owned = ptr_is_owned(b);
44814         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44815         b_conv.is_owned = false;
44816         jboolean ret_conv = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
44817         return ret_conv;
44818 }
44819
44820 void  __attribute__((export_name("TS_Fallback_free"))) TS_Fallback_free(uint64_t this_ptr) {
44821         if (!ptr_is_owned(this_ptr)) return;
44822         void* this_ptr_ptr = untag_ptr(this_ptr);
44823         CHECK_ACCESS(this_ptr_ptr);
44824         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
44825         FREE(untag_ptr(this_ptr));
44826         Fallback_free(this_ptr_conv);
44827 }
44828
44829 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
44830         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
44831         *ret_copy = Fallback_clone(arg);
44832         uint64_t ret_ref = tag_ptr(ret_copy, true);
44833         return ret_ref;
44834 }
44835 int64_t  __attribute__((export_name("TS_Fallback_clone_ptr"))) TS_Fallback_clone_ptr(uint64_t arg) {
44836         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
44837         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
44838         return ret_conv;
44839 }
44840
44841 uint64_t  __attribute__((export_name("TS_Fallback_clone"))) TS_Fallback_clone(uint64_t orig) {
44842         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
44843         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
44844         *ret_copy = Fallback_clone(orig_conv);
44845         uint64_t ret_ref = tag_ptr(ret_copy, true);
44846         return ret_ref;
44847 }
44848
44849 uint64_t  __attribute__((export_name("TS_Fallback_seg_wit_program"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
44850         
44851         LDKCVec_u8Z program_ref;
44852         program_ref.datalen = program->arr_len;
44853         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
44854         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
44855         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
44856         *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref);
44857         uint64_t ret_ref = tag_ptr(ret_copy, true);
44858         return ret_ref;
44859 }
44860
44861 uint64_t  __attribute__((export_name("TS_Fallback_pub_key_hash"))) TS_Fallback_pub_key_hash(int8_tArray a) {
44862         LDKTwentyBytes a_ref;
44863         CHECK(a->arr_len == 20);
44864         memcpy(a_ref.data, a->elems, 20); FREE(a);
44865         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
44866         *ret_copy = Fallback_pub_key_hash(a_ref);
44867         uint64_t ret_ref = tag_ptr(ret_copy, true);
44868         return ret_ref;
44869 }
44870
44871 uint64_t  __attribute__((export_name("TS_Fallback_script_hash"))) TS_Fallback_script_hash(int8_tArray a) {
44872         LDKTwentyBytes a_ref;
44873         CHECK(a->arr_len == 20);
44874         memcpy(a_ref.data, a->elems, 20); FREE(a);
44875         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
44876         *ret_copy = Fallback_script_hash(a_ref);
44877         uint64_t ret_ref = tag_ptr(ret_copy, true);
44878         return ret_ref;
44879 }
44880
44881 int64_t  __attribute__((export_name("TS_Fallback_hash"))) TS_Fallback_hash(uint64_t o) {
44882         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
44883         int64_t ret_conv = Fallback_hash(o_conv);
44884         return ret_conv;
44885 }
44886
44887 jboolean  __attribute__((export_name("TS_Fallback_eq"))) TS_Fallback_eq(uint64_t a, uint64_t b) {
44888         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
44889         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
44890         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
44891         return ret_conv;
44892 }
44893
44894 void  __attribute__((export_name("TS_InvoiceSignature_free"))) TS_InvoiceSignature_free(uint64_t this_obj) {
44895         LDKInvoiceSignature this_obj_conv;
44896         this_obj_conv.inner = untag_ptr(this_obj);
44897         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44899         InvoiceSignature_free(this_obj_conv);
44900 }
44901
44902 static inline uint64_t InvoiceSignature_clone_ptr(LDKInvoiceSignature *NONNULL_PTR arg) {
44903         LDKInvoiceSignature ret_var = InvoiceSignature_clone(arg);
44904         uint64_t ret_ref = 0;
44905         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44906         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44907         return ret_ref;
44908 }
44909 int64_t  __attribute__((export_name("TS_InvoiceSignature_clone_ptr"))) TS_InvoiceSignature_clone_ptr(uint64_t arg) {
44910         LDKInvoiceSignature arg_conv;
44911         arg_conv.inner = untag_ptr(arg);
44912         arg_conv.is_owned = ptr_is_owned(arg);
44913         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44914         arg_conv.is_owned = false;
44915         int64_t ret_conv = InvoiceSignature_clone_ptr(&arg_conv);
44916         return ret_conv;
44917 }
44918
44919 uint64_t  __attribute__((export_name("TS_InvoiceSignature_clone"))) TS_InvoiceSignature_clone(uint64_t orig) {
44920         LDKInvoiceSignature orig_conv;
44921         orig_conv.inner = untag_ptr(orig);
44922         orig_conv.is_owned = ptr_is_owned(orig);
44923         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44924         orig_conv.is_owned = false;
44925         LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
44926         uint64_t ret_ref = 0;
44927         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44928         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44929         return ret_ref;
44930 }
44931
44932 int64_t  __attribute__((export_name("TS_InvoiceSignature_hash"))) TS_InvoiceSignature_hash(uint64_t o) {
44933         LDKInvoiceSignature o_conv;
44934         o_conv.inner = untag_ptr(o);
44935         o_conv.is_owned = ptr_is_owned(o);
44936         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44937         o_conv.is_owned = false;
44938         int64_t ret_conv = InvoiceSignature_hash(&o_conv);
44939         return ret_conv;
44940 }
44941
44942 jboolean  __attribute__((export_name("TS_InvoiceSignature_eq"))) TS_InvoiceSignature_eq(uint64_t a, uint64_t b) {
44943         LDKInvoiceSignature a_conv;
44944         a_conv.inner = untag_ptr(a);
44945         a_conv.is_owned = ptr_is_owned(a);
44946         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44947         a_conv.is_owned = false;
44948         LDKInvoiceSignature b_conv;
44949         b_conv.inner = untag_ptr(b);
44950         b_conv.is_owned = ptr_is_owned(b);
44951         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44952         b_conv.is_owned = false;
44953         jboolean ret_conv = InvoiceSignature_eq(&a_conv, &b_conv);
44954         return ret_conv;
44955 }
44956
44957 void  __attribute__((export_name("TS_PrivateRoute_free"))) TS_PrivateRoute_free(uint64_t this_obj) {
44958         LDKPrivateRoute this_obj_conv;
44959         this_obj_conv.inner = untag_ptr(this_obj);
44960         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44962         PrivateRoute_free(this_obj_conv);
44963 }
44964
44965 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
44966         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
44967         uint64_t ret_ref = 0;
44968         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44969         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44970         return ret_ref;
44971 }
44972 int64_t  __attribute__((export_name("TS_PrivateRoute_clone_ptr"))) TS_PrivateRoute_clone_ptr(uint64_t arg) {
44973         LDKPrivateRoute arg_conv;
44974         arg_conv.inner = untag_ptr(arg);
44975         arg_conv.is_owned = ptr_is_owned(arg);
44976         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44977         arg_conv.is_owned = false;
44978         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
44979         return ret_conv;
44980 }
44981
44982 uint64_t  __attribute__((export_name("TS_PrivateRoute_clone"))) TS_PrivateRoute_clone(uint64_t orig) {
44983         LDKPrivateRoute orig_conv;
44984         orig_conv.inner = untag_ptr(orig);
44985         orig_conv.is_owned = ptr_is_owned(orig);
44986         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44987         orig_conv.is_owned = false;
44988         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
44989         uint64_t ret_ref = 0;
44990         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44991         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44992         return ret_ref;
44993 }
44994
44995 int64_t  __attribute__((export_name("TS_PrivateRoute_hash"))) TS_PrivateRoute_hash(uint64_t o) {
44996         LDKPrivateRoute o_conv;
44997         o_conv.inner = untag_ptr(o);
44998         o_conv.is_owned = ptr_is_owned(o);
44999         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45000         o_conv.is_owned = false;
45001         int64_t ret_conv = PrivateRoute_hash(&o_conv);
45002         return ret_conv;
45003 }
45004
45005 jboolean  __attribute__((export_name("TS_PrivateRoute_eq"))) TS_PrivateRoute_eq(uint64_t a, uint64_t b) {
45006         LDKPrivateRoute a_conv;
45007         a_conv.inner = untag_ptr(a);
45008         a_conv.is_owned = ptr_is_owned(a);
45009         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45010         a_conv.is_owned = false;
45011         LDKPrivateRoute b_conv;
45012         b_conv.inner = untag_ptr(b);
45013         b_conv.is_owned = ptr_is_owned(b);
45014         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45015         b_conv.is_owned = false;
45016         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
45017         return ret_conv;
45018 }
45019
45020 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_into_parts"))) TS_SignedRawInvoice_into_parts(uint64_t this_arg) {
45021         LDKSignedRawInvoice this_arg_conv;
45022         this_arg_conv.inner = untag_ptr(this_arg);
45023         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45025         this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
45026         LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
45027         *ret_conv = SignedRawInvoice_into_parts(this_arg_conv);
45028         return tag_ptr(ret_conv, true);
45029 }
45030
45031 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_raw_invoice"))) TS_SignedRawInvoice_raw_invoice(uint64_t this_arg) {
45032         LDKSignedRawInvoice this_arg_conv;
45033         this_arg_conv.inner = untag_ptr(this_arg);
45034         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45036         this_arg_conv.is_owned = false;
45037         LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
45038         uint64_t ret_ref = 0;
45039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45041         return ret_ref;
45042 }
45043
45044 int8_tArray  __attribute__((export_name("TS_SignedRawInvoice_signable_hash"))) TS_SignedRawInvoice_signable_hash(uint64_t this_arg) {
45045         LDKSignedRawInvoice this_arg_conv;
45046         this_arg_conv.inner = untag_ptr(this_arg);
45047         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45049         this_arg_conv.is_owned = false;
45050         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45051         memcpy(ret_arr->elems, *SignedRawInvoice_signable_hash(&this_arg_conv), 32);
45052         return ret_arr;
45053 }
45054
45055 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_signature"))) TS_SignedRawInvoice_signature(uint64_t this_arg) {
45056         LDKSignedRawInvoice this_arg_conv;
45057         this_arg_conv.inner = untag_ptr(this_arg);
45058         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45060         this_arg_conv.is_owned = false;
45061         LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
45062         uint64_t ret_ref = 0;
45063         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45064         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45065         return ret_ref;
45066 }
45067
45068 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_recover_payee_pub_key"))) TS_SignedRawInvoice_recover_payee_pub_key(uint64_t this_arg) {
45069         LDKSignedRawInvoice this_arg_conv;
45070         this_arg_conv.inner = untag_ptr(this_arg);
45071         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45073         this_arg_conv.is_owned = false;
45074         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
45075         *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
45076         return tag_ptr(ret_conv, true);
45077 }
45078
45079 jboolean  __attribute__((export_name("TS_SignedRawInvoice_check_signature"))) TS_SignedRawInvoice_check_signature(uint64_t this_arg) {
45080         LDKSignedRawInvoice this_arg_conv;
45081         this_arg_conv.inner = untag_ptr(this_arg);
45082         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45084         this_arg_conv.is_owned = false;
45085         jboolean ret_conv = SignedRawInvoice_check_signature(&this_arg_conv);
45086         return ret_conv;
45087 }
45088
45089 int8_tArray  __attribute__((export_name("TS_RawInvoice_signable_hash"))) TS_RawInvoice_signable_hash(uint64_t this_arg) {
45090         LDKRawInvoice this_arg_conv;
45091         this_arg_conv.inner = untag_ptr(this_arg);
45092         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45094         this_arg_conv.is_owned = false;
45095         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45096         memcpy(ret_arr->elems, RawInvoice_signable_hash(&this_arg_conv).data, 32);
45097         return ret_arr;
45098 }
45099
45100 uint64_t  __attribute__((export_name("TS_RawInvoice_payment_hash"))) TS_RawInvoice_payment_hash(uint64_t this_arg) {
45101         LDKRawInvoice this_arg_conv;
45102         this_arg_conv.inner = untag_ptr(this_arg);
45103         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45105         this_arg_conv.is_owned = false;
45106         LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
45107         uint64_t ret_ref = 0;
45108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45109         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45110         return ret_ref;
45111 }
45112
45113 uint64_t  __attribute__((export_name("TS_RawInvoice_description"))) TS_RawInvoice_description(uint64_t this_arg) {
45114         LDKRawInvoice this_arg_conv;
45115         this_arg_conv.inner = untag_ptr(this_arg);
45116         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45118         this_arg_conv.is_owned = false;
45119         LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
45120         uint64_t ret_ref = 0;
45121         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45122         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45123         return ret_ref;
45124 }
45125
45126 uint64_t  __attribute__((export_name("TS_RawInvoice_payee_pub_key"))) TS_RawInvoice_payee_pub_key(uint64_t this_arg) {
45127         LDKRawInvoice this_arg_conv;
45128         this_arg_conv.inner = untag_ptr(this_arg);
45129         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45131         this_arg_conv.is_owned = false;
45132         LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
45133         uint64_t ret_ref = 0;
45134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45136         return ret_ref;
45137 }
45138
45139 uint64_t  __attribute__((export_name("TS_RawInvoice_description_hash"))) TS_RawInvoice_description_hash(uint64_t this_arg) {
45140         LDKRawInvoice this_arg_conv;
45141         this_arg_conv.inner = untag_ptr(this_arg);
45142         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45144         this_arg_conv.is_owned = false;
45145         LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
45146         uint64_t ret_ref = 0;
45147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45149         return ret_ref;
45150 }
45151
45152 uint64_t  __attribute__((export_name("TS_RawInvoice_expiry_time"))) TS_RawInvoice_expiry_time(uint64_t this_arg) {
45153         LDKRawInvoice this_arg_conv;
45154         this_arg_conv.inner = untag_ptr(this_arg);
45155         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45157         this_arg_conv.is_owned = false;
45158         LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
45159         uint64_t ret_ref = 0;
45160         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45161         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45162         return ret_ref;
45163 }
45164
45165 uint64_t  __attribute__((export_name("TS_RawInvoice_min_final_cltv_expiry"))) TS_RawInvoice_min_final_cltv_expiry(uint64_t this_arg) {
45166         LDKRawInvoice this_arg_conv;
45167         this_arg_conv.inner = untag_ptr(this_arg);
45168         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45170         this_arg_conv.is_owned = false;
45171         LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
45172         uint64_t ret_ref = 0;
45173         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45174         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45175         return ret_ref;
45176 }
45177
45178 int8_tArray  __attribute__((export_name("TS_RawInvoice_payment_secret"))) TS_RawInvoice_payment_secret(uint64_t this_arg) {
45179         LDKRawInvoice this_arg_conv;
45180         this_arg_conv.inner = untag_ptr(this_arg);
45181         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45183         this_arg_conv.is_owned = false;
45184         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45185         memcpy(ret_arr->elems, RawInvoice_payment_secret(&this_arg_conv).data, 32);
45186         return ret_arr;
45187 }
45188
45189 uint64_t  __attribute__((export_name("TS_RawInvoice_features"))) TS_RawInvoice_features(uint64_t this_arg) {
45190         LDKRawInvoice this_arg_conv;
45191         this_arg_conv.inner = untag_ptr(this_arg);
45192         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45194         this_arg_conv.is_owned = false;
45195         LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
45196         uint64_t ret_ref = 0;
45197         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45198         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45199         return ret_ref;
45200 }
45201
45202 uint64_tArray  __attribute__((export_name("TS_RawInvoice_private_routes"))) TS_RawInvoice_private_routes(uint64_t this_arg) {
45203         LDKRawInvoice this_arg_conv;
45204         this_arg_conv.inner = untag_ptr(this_arg);
45205         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45207         this_arg_conv.is_owned = false;
45208         LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
45209         uint64_tArray ret_arr = NULL;
45210         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
45211         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
45212         for (size_t o = 0; o < ret_var.datalen; o++) {
45213                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
45214                 uint64_t ret_conv_14_ref = 0;
45215                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
45216                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
45217                 ret_arr_ptr[o] = ret_conv_14_ref;
45218         }
45219         
45220         FREE(ret_var.data);
45221         return ret_arr;
45222 }
45223
45224 uint64_t  __attribute__((export_name("TS_RawInvoice_amount_pico_btc"))) TS_RawInvoice_amount_pico_btc(uint64_t this_arg) {
45225         LDKRawInvoice this_arg_conv;
45226         this_arg_conv.inner = untag_ptr(this_arg);
45227         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45229         this_arg_conv.is_owned = false;
45230         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
45231         *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
45232         uint64_t ret_ref = tag_ptr(ret_copy, true);
45233         return ret_ref;
45234 }
45235
45236 uint32_t  __attribute__((export_name("TS_RawInvoice_currency"))) TS_RawInvoice_currency(uint64_t this_arg) {
45237         LDKRawInvoice this_arg_conv;
45238         this_arg_conv.inner = untag_ptr(this_arg);
45239         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45241         this_arg_conv.is_owned = false;
45242         uint32_t ret_conv = LDKCurrency_to_js(RawInvoice_currency(&this_arg_conv));
45243         return ret_conv;
45244 }
45245
45246 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_unix_timestamp"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
45247         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
45248         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
45249         return tag_ptr(ret_conv, true);
45250 }
45251
45252 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_duration_since_epoch"))) TS_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
45253         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
45254         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
45255         return tag_ptr(ret_conv, true);
45256 }
45257
45258 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_unix_timestamp"))) TS_PositiveTimestamp_as_unix_timestamp(uint64_t this_arg) {
45259         LDKPositiveTimestamp this_arg_conv;
45260         this_arg_conv.inner = untag_ptr(this_arg);
45261         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45263         this_arg_conv.is_owned = false;
45264         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
45265         return ret_conv;
45266 }
45267
45268 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_duration_since_epoch"))) TS_PositiveTimestamp_as_duration_since_epoch(uint64_t this_arg) {
45269         LDKPositiveTimestamp this_arg_conv;
45270         this_arg_conv.inner = untag_ptr(this_arg);
45271         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45273         this_arg_conv.is_owned = false;
45274         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
45275         return ret_conv;
45276 }
45277
45278 uint64_t  __attribute__((export_name("TS_Invoice_into_signed_raw"))) TS_Invoice_into_signed_raw(uint64_t this_arg) {
45279         LDKInvoice this_arg_conv;
45280         this_arg_conv.inner = untag_ptr(this_arg);
45281         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45283         this_arg_conv = Invoice_clone(&this_arg_conv);
45284         LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
45285         uint64_t ret_ref = 0;
45286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45288         return ret_ref;
45289 }
45290
45291 uint64_t  __attribute__((export_name("TS_Invoice_check_signature"))) TS_Invoice_check_signature(uint64_t this_arg) {
45292         LDKInvoice this_arg_conv;
45293         this_arg_conv.inner = untag_ptr(this_arg);
45294         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45296         this_arg_conv.is_owned = false;
45297         LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
45298         *ret_conv = Invoice_check_signature(&this_arg_conv);
45299         return tag_ptr(ret_conv, true);
45300 }
45301
45302 uint64_t  __attribute__((export_name("TS_Invoice_from_signed"))) TS_Invoice_from_signed(uint64_t signed_invoice) {
45303         LDKSignedRawInvoice signed_invoice_conv;
45304         signed_invoice_conv.inner = untag_ptr(signed_invoice);
45305         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
45306         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
45307         signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
45308         LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
45309         *ret_conv = Invoice_from_signed(signed_invoice_conv);
45310         return tag_ptr(ret_conv, true);
45311 }
45312
45313 int64_t  __attribute__((export_name("TS_Invoice_duration_since_epoch"))) TS_Invoice_duration_since_epoch(uint64_t this_arg) {
45314         LDKInvoice this_arg_conv;
45315         this_arg_conv.inner = untag_ptr(this_arg);
45316         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45318         this_arg_conv.is_owned = false;
45319         int64_t ret_conv = Invoice_duration_since_epoch(&this_arg_conv);
45320         return ret_conv;
45321 }
45322
45323 int8_tArray  __attribute__((export_name("TS_Invoice_payment_hash"))) TS_Invoice_payment_hash(uint64_t this_arg) {
45324         LDKInvoice this_arg_conv;
45325         this_arg_conv.inner = untag_ptr(this_arg);
45326         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45328         this_arg_conv.is_owned = false;
45329         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45330         memcpy(ret_arr->elems, *Invoice_payment_hash(&this_arg_conv), 32);
45331         return ret_arr;
45332 }
45333
45334 int8_tArray  __attribute__((export_name("TS_Invoice_payee_pub_key"))) TS_Invoice_payee_pub_key(uint64_t this_arg) {
45335         LDKInvoice this_arg_conv;
45336         this_arg_conv.inner = untag_ptr(this_arg);
45337         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45339         this_arg_conv.is_owned = false;
45340         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45341         memcpy(ret_arr->elems, Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
45342         return ret_arr;
45343 }
45344
45345 int8_tArray  __attribute__((export_name("TS_Invoice_payment_secret"))) TS_Invoice_payment_secret(uint64_t this_arg) {
45346         LDKInvoice this_arg_conv;
45347         this_arg_conv.inner = untag_ptr(this_arg);
45348         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45350         this_arg_conv.is_owned = false;
45351         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45352         memcpy(ret_arr->elems, *Invoice_payment_secret(&this_arg_conv), 32);
45353         return ret_arr;
45354 }
45355
45356 uint64_t  __attribute__((export_name("TS_Invoice_features"))) TS_Invoice_features(uint64_t this_arg) {
45357         LDKInvoice this_arg_conv;
45358         this_arg_conv.inner = untag_ptr(this_arg);
45359         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45361         this_arg_conv.is_owned = false;
45362         LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
45363         uint64_t ret_ref = 0;
45364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45366         return ret_ref;
45367 }
45368
45369 int8_tArray  __attribute__((export_name("TS_Invoice_recover_payee_pub_key"))) TS_Invoice_recover_payee_pub_key(uint64_t this_arg) {
45370         LDKInvoice this_arg_conv;
45371         this_arg_conv.inner = untag_ptr(this_arg);
45372         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45374         this_arg_conv.is_owned = false;
45375         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45376         memcpy(ret_arr->elems, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
45377         return ret_arr;
45378 }
45379
45380 int64_t  __attribute__((export_name("TS_Invoice_expiry_time"))) TS_Invoice_expiry_time(uint64_t this_arg) {
45381         LDKInvoice this_arg_conv;
45382         this_arg_conv.inner = untag_ptr(this_arg);
45383         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45385         this_arg_conv.is_owned = false;
45386         int64_t ret_conv = Invoice_expiry_time(&this_arg_conv);
45387         return ret_conv;
45388 }
45389
45390 jboolean  __attribute__((export_name("TS_Invoice_would_expire"))) TS_Invoice_would_expire(uint64_t this_arg, int64_t at_time) {
45391         LDKInvoice this_arg_conv;
45392         this_arg_conv.inner = untag_ptr(this_arg);
45393         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45395         this_arg_conv.is_owned = false;
45396         jboolean ret_conv = Invoice_would_expire(&this_arg_conv, at_time);
45397         return ret_conv;
45398 }
45399
45400 int64_t  __attribute__((export_name("TS_Invoice_min_final_cltv_expiry"))) TS_Invoice_min_final_cltv_expiry(uint64_t this_arg) {
45401         LDKInvoice this_arg_conv;
45402         this_arg_conv.inner = untag_ptr(this_arg);
45403         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45405         this_arg_conv.is_owned = false;
45406         int64_t ret_conv = Invoice_min_final_cltv_expiry(&this_arg_conv);
45407         return ret_conv;
45408 }
45409
45410 uint64_tArray  __attribute__((export_name("TS_Invoice_private_routes"))) TS_Invoice_private_routes(uint64_t this_arg) {
45411         LDKInvoice this_arg_conv;
45412         this_arg_conv.inner = untag_ptr(this_arg);
45413         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45415         this_arg_conv.is_owned = false;
45416         LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
45417         uint64_tArray ret_arr = NULL;
45418         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
45419         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
45420         for (size_t o = 0; o < ret_var.datalen; o++) {
45421                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
45422                 uint64_t ret_conv_14_ref = 0;
45423                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
45424                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
45425                 ret_arr_ptr[o] = ret_conv_14_ref;
45426         }
45427         
45428         FREE(ret_var.data);
45429         return ret_arr;
45430 }
45431
45432 uint64_tArray  __attribute__((export_name("TS_Invoice_route_hints"))) TS_Invoice_route_hints(uint64_t this_arg) {
45433         LDKInvoice this_arg_conv;
45434         this_arg_conv.inner = untag_ptr(this_arg);
45435         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45437         this_arg_conv.is_owned = false;
45438         LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
45439         uint64_tArray ret_arr = NULL;
45440         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
45441         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
45442         for (size_t l = 0; l < ret_var.datalen; l++) {
45443                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
45444                 uint64_t ret_conv_11_ref = 0;
45445                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
45446                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
45447                 ret_arr_ptr[l] = ret_conv_11_ref;
45448         }
45449         
45450         FREE(ret_var.data);
45451         return ret_arr;
45452 }
45453
45454 uint32_t  __attribute__((export_name("TS_Invoice_currency"))) TS_Invoice_currency(uint64_t this_arg) {
45455         LDKInvoice this_arg_conv;
45456         this_arg_conv.inner = untag_ptr(this_arg);
45457         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45459         this_arg_conv.is_owned = false;
45460         uint32_t ret_conv = LDKCurrency_to_js(Invoice_currency(&this_arg_conv));
45461         return ret_conv;
45462 }
45463
45464 uint64_t  __attribute__((export_name("TS_Invoice_amount_milli_satoshis"))) TS_Invoice_amount_milli_satoshis(uint64_t this_arg) {
45465         LDKInvoice this_arg_conv;
45466         this_arg_conv.inner = untag_ptr(this_arg);
45467         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45469         this_arg_conv.is_owned = false;
45470         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
45471         *ret_copy = Invoice_amount_milli_satoshis(&this_arg_conv);
45472         uint64_t ret_ref = tag_ptr(ret_copy, true);
45473         return ret_ref;
45474 }
45475
45476 uint64_t  __attribute__((export_name("TS_Description_new"))) TS_Description_new(jstring description) {
45477         LDKStr description_conv = str_ref_to_owned_c(description);
45478         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
45479         *ret_conv = Description_new(description_conv);
45480         return tag_ptr(ret_conv, true);
45481 }
45482
45483 jstring  __attribute__((export_name("TS_Description_into_inner"))) TS_Description_into_inner(uint64_t this_arg) {
45484         LDKDescription 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 = Description_clone(&this_arg_conv);
45489         LDKStr ret_str = Description_into_inner(this_arg_conv);
45490         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
45491         Str_free(ret_str);
45492         return ret_conv;
45493 }
45494
45495 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_seconds"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
45496         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
45497         uint64_t ret_ref = 0;
45498         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45499         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45500         return ret_ref;
45501 }
45502
45503 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_duration"))) TS_ExpiryTime_from_duration(int64_t duration) {
45504         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
45505         uint64_t ret_ref = 0;
45506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45508         return ret_ref;
45509 }
45510
45511 int64_t  __attribute__((export_name("TS_ExpiryTime_as_seconds"))) TS_ExpiryTime_as_seconds(uint64_t this_arg) {
45512         LDKExpiryTime this_arg_conv;
45513         this_arg_conv.inner = untag_ptr(this_arg);
45514         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45516         this_arg_conv.is_owned = false;
45517         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
45518         return ret_conv;
45519 }
45520
45521 int64_t  __attribute__((export_name("TS_ExpiryTime_as_duration"))) TS_ExpiryTime_as_duration(uint64_t this_arg) {
45522         LDKExpiryTime this_arg_conv;
45523         this_arg_conv.inner = untag_ptr(this_arg);
45524         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45526         this_arg_conv.is_owned = false;
45527         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
45528         return ret_conv;
45529 }
45530
45531 uint64_t  __attribute__((export_name("TS_PrivateRoute_new"))) TS_PrivateRoute_new(uint64_t hops) {
45532         LDKRouteHint hops_conv;
45533         hops_conv.inner = untag_ptr(hops);
45534         hops_conv.is_owned = ptr_is_owned(hops);
45535         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
45536         hops_conv = RouteHint_clone(&hops_conv);
45537         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
45538         *ret_conv = PrivateRoute_new(hops_conv);
45539         return tag_ptr(ret_conv, true);
45540 }
45541
45542 uint64_t  __attribute__((export_name("TS_PrivateRoute_into_inner"))) TS_PrivateRoute_into_inner(uint64_t this_arg) {
45543         LDKPrivateRoute this_arg_conv;
45544         this_arg_conv.inner = untag_ptr(this_arg);
45545         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45547         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
45548         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
45549         uint64_t ret_ref = 0;
45550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45552         return ret_ref;
45553 }
45554
45555 uint32_t  __attribute__((export_name("TS_CreationError_clone"))) TS_CreationError_clone(uint64_t orig) {
45556         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
45557         uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
45558         return ret_conv;
45559 }
45560
45561 uint32_t  __attribute__((export_name("TS_CreationError_description_too_long"))) TS_CreationError_description_too_long() {
45562         uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
45563         return ret_conv;
45564 }
45565
45566 uint32_t  __attribute__((export_name("TS_CreationError_route_too_long"))) TS_CreationError_route_too_long() {
45567         uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
45568         return ret_conv;
45569 }
45570
45571 uint32_t  __attribute__((export_name("TS_CreationError_timestamp_out_of_bounds"))) TS_CreationError_timestamp_out_of_bounds() {
45572         uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
45573         return ret_conv;
45574 }
45575
45576 uint32_t  __attribute__((export_name("TS_CreationError_invalid_amount"))) TS_CreationError_invalid_amount() {
45577         uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount());
45578         return ret_conv;
45579 }
45580
45581 uint32_t  __attribute__((export_name("TS_CreationError_missing_route_hints"))) TS_CreationError_missing_route_hints() {
45582         uint32_t ret_conv = LDKCreationError_to_js(CreationError_missing_route_hints());
45583         return ret_conv;
45584 }
45585
45586 jboolean  __attribute__((export_name("TS_CreationError_eq"))) TS_CreationError_eq(uint64_t a, uint64_t b) {
45587         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
45588         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
45589         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
45590         return ret_conv;
45591 }
45592
45593 jstring  __attribute__((export_name("TS_CreationError_to_str"))) TS_CreationError_to_str(uint64_t o) {
45594         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
45595         LDKStr ret_str = CreationError_to_str(o_conv);
45596         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
45597         Str_free(ret_str);
45598         return ret_conv;
45599 }
45600
45601 uint32_t  __attribute__((export_name("TS_SemanticError_clone"))) TS_SemanticError_clone(uint64_t orig) {
45602         LDKSemanticError* orig_conv = (LDKSemanticError*)untag_ptr(orig);
45603         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_clone(orig_conv));
45604         return ret_conv;
45605 }
45606
45607 uint32_t  __attribute__((export_name("TS_SemanticError_no_payment_hash"))) TS_SemanticError_no_payment_hash() {
45608         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_hash());
45609         return ret_conv;
45610 }
45611
45612 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_payment_hashes"))) TS_SemanticError_multiple_payment_hashes() {
45613         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_hashes());
45614         return ret_conv;
45615 }
45616
45617 uint32_t  __attribute__((export_name("TS_SemanticError_no_description"))) TS_SemanticError_no_description() {
45618         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_description());
45619         return ret_conv;
45620 }
45621
45622 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_descriptions"))) TS_SemanticError_multiple_descriptions() {
45623         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_descriptions());
45624         return ret_conv;
45625 }
45626
45627 uint32_t  __attribute__((export_name("TS_SemanticError_no_payment_secret"))) TS_SemanticError_no_payment_secret() {
45628         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_secret());
45629         return ret_conv;
45630 }
45631
45632 uint32_t  __attribute__((export_name("TS_SemanticError_multiple_payment_secrets"))) TS_SemanticError_multiple_payment_secrets() {
45633         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
45634         return ret_conv;
45635 }
45636
45637 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_features"))) TS_SemanticError_invalid_features() {
45638         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_features());
45639         return ret_conv;
45640 }
45641
45642 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_recovery_id"))) TS_SemanticError_invalid_recovery_id() {
45643         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_recovery_id());
45644         return ret_conv;
45645 }
45646
45647 uint32_t  __attribute__((export_name("TS_SemanticError_invalid_signature"))) TS_SemanticError_invalid_signature() {
45648         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_invalid_signature());
45649         return ret_conv;
45650 }
45651
45652 uint32_t  __attribute__((export_name("TS_SemanticError_imprecise_amount"))) TS_SemanticError_imprecise_amount() {
45653         uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_imprecise_amount());
45654         return ret_conv;
45655 }
45656
45657 jboolean  __attribute__((export_name("TS_SemanticError_eq"))) TS_SemanticError_eq(uint64_t a, uint64_t b) {
45658         LDKSemanticError* a_conv = (LDKSemanticError*)untag_ptr(a);
45659         LDKSemanticError* b_conv = (LDKSemanticError*)untag_ptr(b);
45660         jboolean ret_conv = SemanticError_eq(a_conv, b_conv);
45661         return ret_conv;
45662 }
45663
45664 jstring  __attribute__((export_name("TS_SemanticError_to_str"))) TS_SemanticError_to_str(uint64_t o) {
45665         LDKSemanticError* o_conv = (LDKSemanticError*)untag_ptr(o);
45666         LDKStr ret_str = SemanticError_to_str(o_conv);
45667         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
45668         Str_free(ret_str);
45669         return ret_conv;
45670 }
45671
45672 void  __attribute__((export_name("TS_SignOrCreationError_free"))) TS_SignOrCreationError_free(uint64_t this_ptr) {
45673         if (!ptr_is_owned(this_ptr)) return;
45674         void* this_ptr_ptr = untag_ptr(this_ptr);
45675         CHECK_ACCESS(this_ptr_ptr);
45676         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
45677         FREE(untag_ptr(this_ptr));
45678         SignOrCreationError_free(this_ptr_conv);
45679 }
45680
45681 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
45682         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
45683         *ret_copy = SignOrCreationError_clone(arg);
45684         uint64_t ret_ref = tag_ptr(ret_copy, true);
45685         return ret_ref;
45686 }
45687 int64_t  __attribute__((export_name("TS_SignOrCreationError_clone_ptr"))) TS_SignOrCreationError_clone_ptr(uint64_t arg) {
45688         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
45689         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
45690         return ret_conv;
45691 }
45692
45693 uint64_t  __attribute__((export_name("TS_SignOrCreationError_clone"))) TS_SignOrCreationError_clone(uint64_t orig) {
45694         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
45695         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
45696         *ret_copy = SignOrCreationError_clone(orig_conv);
45697         uint64_t ret_ref = tag_ptr(ret_copy, true);
45698         return ret_ref;
45699 }
45700
45701 uint64_t  __attribute__((export_name("TS_SignOrCreationError_sign_error"))) TS_SignOrCreationError_sign_error() {
45702         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
45703         *ret_copy = SignOrCreationError_sign_error();
45704         uint64_t ret_ref = tag_ptr(ret_copy, true);
45705         return ret_ref;
45706 }
45707
45708 uint64_t  __attribute__((export_name("TS_SignOrCreationError_creation_error"))) TS_SignOrCreationError_creation_error(uint32_t a) {
45709         LDKCreationError a_conv = LDKCreationError_from_js(a);
45710         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
45711         *ret_copy = SignOrCreationError_creation_error(a_conv);
45712         uint64_t ret_ref = tag_ptr(ret_copy, true);
45713         return ret_ref;
45714 }
45715
45716 jboolean  __attribute__((export_name("TS_SignOrCreationError_eq"))) TS_SignOrCreationError_eq(uint64_t a, uint64_t b) {
45717         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
45718         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
45719         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
45720         return ret_conv;
45721 }
45722
45723 jstring  __attribute__((export_name("TS_SignOrCreationError_to_str"))) TS_SignOrCreationError_to_str(uint64_t o) {
45724         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
45725         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
45726         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
45727         Str_free(ret_str);
45728         return ret_conv;
45729 }
45730
45731 void  __attribute__((export_name("TS_InvoicePayer_free"))) TS_InvoicePayer_free(uint64_t this_obj) {
45732         LDKInvoicePayer this_obj_conv;
45733         this_obj_conv.inner = untag_ptr(this_obj);
45734         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45736         InvoicePayer_free(this_obj_conv);
45737 }
45738
45739 void  __attribute__((export_name("TS_Payer_free"))) TS_Payer_free(uint64_t this_ptr) {
45740         if (!ptr_is_owned(this_ptr)) return;
45741         void* this_ptr_ptr = untag_ptr(this_ptr);
45742         CHECK_ACCESS(this_ptr_ptr);
45743         LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr);
45744         FREE(untag_ptr(this_ptr));
45745         Payer_free(this_ptr_conv);
45746 }
45747
45748 void  __attribute__((export_name("TS_Router_free"))) TS_Router_free(uint64_t this_ptr) {
45749         if (!ptr_is_owned(this_ptr)) return;
45750         void* this_ptr_ptr = untag_ptr(this_ptr);
45751         CHECK_ACCESS(this_ptr_ptr);
45752         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
45753         FREE(untag_ptr(this_ptr));
45754         Router_free(this_ptr_conv);
45755 }
45756
45757 void  __attribute__((export_name("TS_Retry_free"))) TS_Retry_free(uint64_t this_ptr) {
45758         if (!ptr_is_owned(this_ptr)) return;
45759         void* this_ptr_ptr = untag_ptr(this_ptr);
45760         CHECK_ACCESS(this_ptr_ptr);
45761         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
45762         FREE(untag_ptr(this_ptr));
45763         Retry_free(this_ptr_conv);
45764 }
45765
45766 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
45767         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
45768         *ret_copy = Retry_clone(arg);
45769         uint64_t ret_ref = tag_ptr(ret_copy, true);
45770         return ret_ref;
45771 }
45772 int64_t  __attribute__((export_name("TS_Retry_clone_ptr"))) TS_Retry_clone_ptr(uint64_t arg) {
45773         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
45774         int64_t ret_conv = Retry_clone_ptr(arg_conv);
45775         return ret_conv;
45776 }
45777
45778 uint64_t  __attribute__((export_name("TS_Retry_clone"))) TS_Retry_clone(uint64_t orig) {
45779         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
45780         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
45781         *ret_copy = Retry_clone(orig_conv);
45782         uint64_t ret_ref = tag_ptr(ret_copy, true);
45783         return ret_ref;
45784 }
45785
45786 uint64_t  __attribute__((export_name("TS_Retry_attempts"))) TS_Retry_attempts(uint32_t a) {
45787         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
45788         *ret_copy = Retry_attempts(a);
45789         uint64_t ret_ref = tag_ptr(ret_copy, true);
45790         return ret_ref;
45791 }
45792
45793 jboolean  __attribute__((export_name("TS_Retry_eq"))) TS_Retry_eq(uint64_t a, uint64_t b) {
45794         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
45795         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
45796         jboolean ret_conv = Retry_eq(a_conv, b_conv);
45797         return ret_conv;
45798 }
45799
45800 int64_t  __attribute__((export_name("TS_Retry_hash"))) TS_Retry_hash(uint64_t o) {
45801         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
45802         int64_t ret_conv = Retry_hash(o_conv);
45803         return ret_conv;
45804 }
45805
45806 void  __attribute__((export_name("TS_PaymentError_free"))) TS_PaymentError_free(uint64_t this_ptr) {
45807         if (!ptr_is_owned(this_ptr)) return;
45808         void* this_ptr_ptr = untag_ptr(this_ptr);
45809         CHECK_ACCESS(this_ptr_ptr);
45810         LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
45811         FREE(untag_ptr(this_ptr));
45812         PaymentError_free(this_ptr_conv);
45813 }
45814
45815 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
45816         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
45817         *ret_copy = PaymentError_clone(arg);
45818         uint64_t ret_ref = tag_ptr(ret_copy, true);
45819         return ret_ref;
45820 }
45821 int64_t  __attribute__((export_name("TS_PaymentError_clone_ptr"))) TS_PaymentError_clone_ptr(uint64_t arg) {
45822         LDKPaymentError* arg_conv = (LDKPaymentError*)untag_ptr(arg);
45823         int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
45824         return ret_conv;
45825 }
45826
45827 uint64_t  __attribute__((export_name("TS_PaymentError_clone"))) TS_PaymentError_clone(uint64_t orig) {
45828         LDKPaymentError* orig_conv = (LDKPaymentError*)untag_ptr(orig);
45829         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
45830         *ret_copy = PaymentError_clone(orig_conv);
45831         uint64_t ret_ref = tag_ptr(ret_copy, true);
45832         return ret_ref;
45833 }
45834
45835 uint64_t  __attribute__((export_name("TS_PaymentError_invoice"))) TS_PaymentError_invoice(jstring a) {
45836         LDKStr a_conv = str_ref_to_owned_c(a);
45837         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
45838         *ret_copy = PaymentError_invoice(a_conv);
45839         uint64_t ret_ref = tag_ptr(ret_copy, true);
45840         return ret_ref;
45841 }
45842
45843 uint64_t  __attribute__((export_name("TS_PaymentError_routing"))) TS_PaymentError_routing(uint64_t a) {
45844         LDKLightningError a_conv;
45845         a_conv.inner = untag_ptr(a);
45846         a_conv.is_owned = ptr_is_owned(a);
45847         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45848         a_conv = LightningError_clone(&a_conv);
45849         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
45850         *ret_copy = PaymentError_routing(a_conv);
45851         uint64_t ret_ref = tag_ptr(ret_copy, true);
45852         return ret_ref;
45853 }
45854
45855 uint64_t  __attribute__((export_name("TS_PaymentError_sending"))) TS_PaymentError_sending(uint64_t a) {
45856         void* a_ptr = untag_ptr(a);
45857         CHECK_ACCESS(a_ptr);
45858         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
45859         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
45860         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
45861         *ret_copy = PaymentError_sending(a_conv);
45862         uint64_t ret_ref = tag_ptr(ret_copy, true);
45863         return ret_ref;
45864 }
45865
45866 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) {
45867         void* payer_ptr = untag_ptr(payer);
45868         CHECK_ACCESS(payer_ptr);
45869         LDKPayer payer_conv = *(LDKPayer*)(payer_ptr);
45870         if (payer_conv.free == LDKPayer_JCalls_free) {
45871                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45872                 LDKPayer_JCalls_cloned(&payer_conv);
45873         }
45874         void* router_ptr = untag_ptr(router);
45875         CHECK_ACCESS(router_ptr);
45876         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
45877         if (router_conv.free == LDKRouter_JCalls_free) {
45878                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45879                 LDKRouter_JCalls_cloned(&router_conv);
45880         }
45881         void* logger_ptr = untag_ptr(logger);
45882         CHECK_ACCESS(logger_ptr);
45883         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
45884         if (logger_conv.free == LDKLogger_JCalls_free) {
45885                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45886                 LDKLogger_JCalls_cloned(&logger_conv);
45887         }
45888         void* event_handler_ptr = untag_ptr(event_handler);
45889         CHECK_ACCESS(event_handler_ptr);
45890         LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
45891         if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
45892                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45893                 LDKEventHandler_JCalls_cloned(&event_handler_conv);
45894         }
45895         void* retry_ptr = untag_ptr(retry);
45896         CHECK_ACCESS(retry_ptr);
45897         LDKRetry retry_conv = *(LDKRetry*)(retry_ptr);
45898         retry_conv = Retry_clone((LDKRetry*)untag_ptr(retry));
45899         LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, logger_conv, event_handler_conv, retry_conv);
45900         uint64_t ret_ref = 0;
45901         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45902         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45903         return ret_ref;
45904 }
45905
45906 uint64_t  __attribute__((export_name("TS_InvoicePayer_pay_invoice"))) TS_InvoicePayer_pay_invoice(uint64_t this_arg, uint64_t invoice) {
45907         LDKInvoicePayer this_arg_conv;
45908         this_arg_conv.inner = untag_ptr(this_arg);
45909         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45911         this_arg_conv.is_owned = false;
45912         LDKInvoice invoice_conv;
45913         invoice_conv.inner = untag_ptr(invoice);
45914         invoice_conv.is_owned = ptr_is_owned(invoice);
45915         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
45916         invoice_conv.is_owned = false;
45917         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
45918         *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv);
45919         return tag_ptr(ret_conv, true);
45920 }
45921
45922 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) {
45923         LDKInvoicePayer this_arg_conv;
45924         this_arg_conv.inner = untag_ptr(this_arg);
45925         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45927         this_arg_conv.is_owned = false;
45928         LDKInvoice invoice_conv;
45929         invoice_conv.inner = untag_ptr(invoice);
45930         invoice_conv.is_owned = ptr_is_owned(invoice);
45931         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
45932         invoice_conv.is_owned = false;
45933         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
45934         *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats);
45935         return tag_ptr(ret_conv, true);
45936 }
45937
45938 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) {
45939         LDKInvoicePayer this_arg_conv;
45940         this_arg_conv.inner = untag_ptr(this_arg);
45941         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45943         this_arg_conv.is_owned = false;
45944         LDKPublicKey pubkey_ref;
45945         CHECK(pubkey->arr_len == 33);
45946         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
45947         LDKThirtyTwoBytes payment_preimage_ref;
45948         CHECK(payment_preimage->arr_len == 32);
45949         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
45950         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
45951         *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta);
45952         return tag_ptr(ret_conv, true);
45953 }
45954
45955 void  __attribute__((export_name("TS_InvoicePayer_remove_cached_payment"))) TS_InvoicePayer_remove_cached_payment(uint64_t this_arg, int8_tArray payment_hash) {
45956         LDKInvoicePayer this_arg_conv;
45957         this_arg_conv.inner = untag_ptr(this_arg);
45958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45960         this_arg_conv.is_owned = false;
45961         unsigned char payment_hash_arr[32];
45962         CHECK(payment_hash->arr_len == 32);
45963         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
45964         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
45965         InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref);
45966 }
45967
45968 uint64_t  __attribute__((export_name("TS_InvoicePayer_as_EventHandler"))) TS_InvoicePayer_as_EventHandler(uint64_t this_arg) {
45969         LDKInvoicePayer this_arg_conv;
45970         this_arg_conv.inner = untag_ptr(this_arg);
45971         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45973         this_arg_conv.is_owned = false;
45974         LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
45975         *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv);
45976         return tag_ptr(ret_ret, true);
45977 }
45978
45979 void  __attribute__((export_name("TS_InFlightHtlcs_free"))) TS_InFlightHtlcs_free(uint64_t this_obj) {
45980         LDKInFlightHtlcs this_obj_conv;
45981         this_obj_conv.inner = untag_ptr(this_obj);
45982         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45984         InFlightHtlcs_free(this_obj_conv);
45985 }
45986
45987 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) {
45988         LDKInFlightHtlcs this_arg_conv;
45989         this_arg_conv.inner = untag_ptr(this_arg);
45990         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45991         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45992         this_arg_conv.is_owned = false;
45993         LDKNodeId source_conv;
45994         source_conv.inner = untag_ptr(source);
45995         source_conv.is_owned = ptr_is_owned(source);
45996         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
45997         source_conv.is_owned = false;
45998         LDKNodeId target_conv;
45999         target_conv.inner = untag_ptr(target);
46000         target_conv.is_owned = ptr_is_owned(target);
46001         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
46002         target_conv.is_owned = false;
46003         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46004         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
46005         uint64_t ret_ref = tag_ptr(ret_copy, true);
46006         return ret_ref;
46007 }
46008
46009 int8_tArray  __attribute__((export_name("TS_InFlightHtlcs_write"))) TS_InFlightHtlcs_write(uint64_t obj) {
46010         LDKInFlightHtlcs obj_conv;
46011         obj_conv.inner = untag_ptr(obj);
46012         obj_conv.is_owned = ptr_is_owned(obj);
46013         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46014         obj_conv.is_owned = false;
46015         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
46016         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46017         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46018         CVec_u8Z_free(ret_var);
46019         return ret_arr;
46020 }
46021
46022 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_read"))) TS_InFlightHtlcs_read(int8_tArray ser) {
46023         LDKu8slice ser_ref;
46024         ser_ref.datalen = ser->arr_len;
46025         ser_ref.data = ser->elems;
46026         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
46027         *ret_conv = InFlightHtlcs_read(ser_ref);
46028         FREE(ser);
46029         return tag_ptr(ret_conv, true);
46030 }
46031
46032 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, uint32_t network, uint64_t amt_msat, uint64_t description_hash, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs) {
46033         LDKChannelManager channelmanager_conv;
46034         channelmanager_conv.inner = untag_ptr(channelmanager);
46035         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
46036         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
46037         channelmanager_conv.is_owned = false;
46038         void* keys_manager_ptr = untag_ptr(keys_manager);
46039         CHECK_ACCESS(keys_manager_ptr);
46040         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
46041         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
46042                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46043                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
46044         }
46045         LDKCurrency network_conv = LDKCurrency_from_js(network);
46046         void* amt_msat_ptr = untag_ptr(amt_msat);
46047         CHECK_ACCESS(amt_msat_ptr);
46048         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
46049         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
46050         LDKSha256 description_hash_conv;
46051         description_hash_conv.inner = untag_ptr(description_hash);
46052         description_hash_conv.is_owned = ptr_is_owned(description_hash);
46053         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
46054         description_hash_conv = Sha256_clone(&description_hash_conv);
46055         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
46056         *ret_conv = create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_hash_conv, duration_since_epoch, invoice_expiry_delta_secs);
46057         return tag_ptr(ret_conv, true);
46058 }
46059
46060 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, uint32_t network, uint64_t amt_msat, jstring description, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs) {
46061         LDKChannelManager channelmanager_conv;
46062         channelmanager_conv.inner = untag_ptr(channelmanager);
46063         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
46064         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
46065         channelmanager_conv.is_owned = false;
46066         void* keys_manager_ptr = untag_ptr(keys_manager);
46067         CHECK_ACCESS(keys_manager_ptr);
46068         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
46069         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
46070                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46071                 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
46072         }
46073         LDKCurrency network_conv = LDKCurrency_from_js(network);
46074         void* amt_msat_ptr = untag_ptr(amt_msat);
46075         CHECK_ACCESS(amt_msat_ptr);
46076         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
46077         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
46078         LDKStr description_conv = str_ref_to_owned_c(description);
46079         LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
46080         *ret_conv = create_invoice_from_channelmanager_and_duration_since_epoch(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv, duration_since_epoch, invoice_expiry_delta_secs);
46081         return tag_ptr(ret_conv, true);
46082 }
46083
46084 void  __attribute__((export_name("TS_DefaultRouter_free"))) TS_DefaultRouter_free(uint64_t this_obj) {
46085         LDKDefaultRouter this_obj_conv;
46086         this_obj_conv.inner = untag_ptr(this_obj);
46087         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46089         DefaultRouter_free(this_obj_conv);
46090 }
46091
46092 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) {
46093         LDKNetworkGraph network_graph_conv;
46094         network_graph_conv.inner = untag_ptr(network_graph);
46095         network_graph_conv.is_owned = ptr_is_owned(network_graph);
46096         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
46097         network_graph_conv.is_owned = false;
46098         void* logger_ptr = untag_ptr(logger);
46099         CHECK_ACCESS(logger_ptr);
46100         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
46101         if (logger_conv.free == LDKLogger_JCalls_free) {
46102                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46103                 LDKLogger_JCalls_cloned(&logger_conv);
46104         }
46105         LDKThirtyTwoBytes random_seed_bytes_ref;
46106         CHECK(random_seed_bytes->arr_len == 32);
46107         memcpy(random_seed_bytes_ref.data, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
46108         void* scorer_ptr = untag_ptr(scorer);
46109         CHECK_ACCESS(scorer_ptr);
46110         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
46111         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
46112                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
46113                 LDKLockableScore_JCalls_cloned(&scorer_conv);
46114         }
46115         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref, scorer_conv);
46116         uint64_t ret_ref = 0;
46117         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46118         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46119         return ret_ref;
46120 }
46121
46122 uint64_t  __attribute__((export_name("TS_DefaultRouter_as_Router"))) TS_DefaultRouter_as_Router(uint64_t this_arg) {
46123         LDKDefaultRouter this_arg_conv;
46124         this_arg_conv.inner = untag_ptr(this_arg);
46125         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46127         this_arg_conv.is_owned = false;
46128         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
46129         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
46130         return tag_ptr(ret_ret, true);
46131 }
46132
46133 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Payer"))) TS_ChannelManager_as_Payer(uint64_t this_arg) {
46134         LDKChannelManager this_arg_conv;
46135         this_arg_conv.inner = untag_ptr(this_arg);
46136         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46138         this_arg_conv.is_owned = false;
46139         LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer");
46140         *ret_ret = ChannelManager_as_Payer(&this_arg_conv);
46141         return tag_ptr(ret_ret, true);
46142 }
46143
46144 uint64_t  __attribute__((export_name("TS_SiPrefix_from_str"))) TS_SiPrefix_from_str(jstring s) {
46145         LDKStr s_conv = str_ref_to_owned_c(s);
46146         LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");
46147         *ret_conv = SiPrefix_from_str(s_conv);
46148         return tag_ptr(ret_conv, true);
46149 }
46150
46151 uint64_t  __attribute__((export_name("TS_Invoice_from_str"))) TS_Invoice_from_str(jstring s) {
46152         LDKStr s_conv = str_ref_to_owned_c(s);
46153         LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ");
46154         *ret_conv = Invoice_from_str(s_conv);
46155         return tag_ptr(ret_conv, true);
46156 }
46157
46158 uint64_t  __attribute__((export_name("TS_SignedRawInvoice_from_str"))) TS_SignedRawInvoice_from_str(jstring s) {
46159         LDKStr s_conv = str_ref_to_owned_c(s);
46160         LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ");
46161         *ret_conv = SignedRawInvoice_from_str(s_conv);
46162         return tag_ptr(ret_conv, true);
46163 }
46164
46165 jstring  __attribute__((export_name("TS_ParseError_to_str"))) TS_ParseError_to_str(uint64_t o) {
46166         LDKParseError* o_conv = (LDKParseError*)untag_ptr(o);
46167         LDKStr ret_str = ParseError_to_str(o_conv);
46168         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
46169         Str_free(ret_str);
46170         return ret_conv;
46171 }
46172
46173 jstring  __attribute__((export_name("TS_ParseOrSemanticError_to_str"))) TS_ParseOrSemanticError_to_str(uint64_t o) {
46174         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
46175         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
46176         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
46177         Str_free(ret_str);
46178         return ret_conv;
46179 }
46180
46181 jstring  __attribute__((export_name("TS_Invoice_to_str"))) TS_Invoice_to_str(uint64_t o) {
46182         LDKInvoice o_conv;
46183         o_conv.inner = untag_ptr(o);
46184         o_conv.is_owned = ptr_is_owned(o);
46185         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46186         o_conv.is_owned = false;
46187         LDKStr ret_str = Invoice_to_str(&o_conv);
46188         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
46189         Str_free(ret_str);
46190         return ret_conv;
46191 }
46192
46193 jstring  __attribute__((export_name("TS_SignedRawInvoice_to_str"))) TS_SignedRawInvoice_to_str(uint64_t o) {
46194         LDKSignedRawInvoice o_conv;
46195         o_conv.inner = untag_ptr(o);
46196         o_conv.is_owned = ptr_is_owned(o);
46197         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46198         o_conv.is_owned = false;
46199         LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
46200         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
46201         Str_free(ret_str);
46202         return ret_conv;
46203 }
46204
46205 jstring  __attribute__((export_name("TS_Currency_to_str"))) TS_Currency_to_str(uint64_t o) {
46206         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
46207         LDKStr ret_str = Currency_to_str(o_conv);
46208         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
46209         Str_free(ret_str);
46210         return ret_conv;
46211 }
46212
46213 jstring  __attribute__((export_name("TS_SiPrefix_to_str"))) TS_SiPrefix_to_str(uint64_t o) {
46214         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
46215         LDKStr ret_str = SiPrefix_to_str(o_conv);
46216         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
46217         Str_free(ret_str);
46218         return ret_conv;
46219 }
46220